diff options
Diffstat (limited to 'Source/WebKit/mac')
64 files changed, 2094 insertions, 472 deletions
diff --git a/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm b/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm index 9747350..7348304 100644 --- a/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm +++ b/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm @@ -179,7 +179,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall osStatus = GetWindowModality(_windowRef, &windowModality, NULL); if (osStatus != noErr) { - NSLog(@"Couldn't get window modality: error=%d", osStatus); + NSLog(@"Couldn't get window modality: error=%ld", osStatus); return nil; } @@ -334,7 +334,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall if ([self _hasWindowRef]) { osStatus = GetWindowClass([self windowRef], &windowClass); if (osStatus != noErr) { - NSLog(@"Couldn't get window class: error=%d", osStatus); + NSLog(@"Couldn't get window class: error=%ld", osStatus); } } return windowClass; diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 32f8e50..afaa1e3 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,791 @@ +2011-03-30 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r82320): Spacebar no longer pages down + https://bugs.webkit.org/show_bug.cgi?id=57423 + <rdar://problem/9207702> + + Also includes some unrelated cleanup that I had in my tree. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _interpretKeyEvent:savingCommands:]): Added an assertion that the event is + being dispatched to the right frame. + (-[WebHTMLView setMarkedText:selectedRange:]): Use 0 for a pointer, not NULL. + (-[WebHTMLView doCommandBySelector:]): Update eventInterpretationHadSideEffects with "|=". + Even if this specific command hasn't been handled, that doesn't nullify side effects from + previous commands. + (-[WebHTMLView insertText:]): Besides looking at the return value of insertText() to fix the + bug, removed setting _private->interpretKeyEventsParameters to 0. I don't see any way for + another WebHTMLView NSTextInput method to be called from within insertText:, so no one is + going to look at it. + +2011-03-30 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + WebKit2: Attempting to view css file from url causes it to download + <rdar://problem/9102611> + https://bugs.webkit.org/show_bug.cgi?id=57501 + + * WebView/WebHTMLRepresentation.h: + * WebView/WebHTMLRepresentation.mm: + (+[WebHTMLRepresentation unsupportedTextMIMETypes]): + * WebView/WebHTMLView.mm: + (+[WebHTMLView unsupportedTextMIMETypes]): + Re-factor unsupportedTextMIMETypes to pull from WebCore's + MIMETypeRegistry, so that the list can be shared with WebKit2. + +2011-03-29 Beth Dakin <bdakin@apple.com> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=57408 + webkit-min-device-pixel-ratio media query doesn't work post-SnowLeopard + -and corresponding- + <rdar://problem/8665411> + + * Misc/WebNSControlExtras.m: + (-[NSControl sizeToFitAndAdjustWindowHeight]): + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::scaleFactor): + * WebView/WebHTMLView.mm: + (-[WebHTMLView viewDidMoveToWindow]): + (-[WebHTMLView attachRootLayer:]): + +2011-03-29 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + Make validation message bubble testable + https://bugs.webkit.org/show_bug.cgi?id=57290 + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): Copy the private value of + the timer magnification to WebCore::Settings. + (-[WebView validationMessageTimerMagnification]): Added. + (-[WebView setValidationMessageTimerMagnification:]): Added. + * WebView/WebViewData.h: Declare a member for the timer magnification. + * WebView/WebViewData.mm: + (-[WebViewPrivate init]): Initialize the timer magnification. + * WebView/WebViewPrivate.h: + Declare a setter and a getter for the timer magnification. + +2011-03-29 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Mac] Enable interactive-validation tests on Mac DRT + https://bugs.webkit.org/show_bug.cgi?id=57308 + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + Convey a WebView flag for interactive validation to WebCore::Settings. + (-[WebView interactiveFormValidationEnabled]): Added. + (-[WebView setInteractiveFormValidationEnabled:]): Added. + * WebView/WebViewData.h: Add interactiveFormValidationEnabled. + * WebView/WebViewData.mm: + (-[WebViewPrivate init]): Initialize interactiveFormValidationEnabled. + * WebView/WebViewPrivate.h: Add setter and getter for interactiveFormValidationEnabled. + +2011-03-29 Timothy Hatcher <timothy@apple.com> + + Update the order of the context menu to better match AppKit on Mac. + + <rdar://problem/9054893> + + Reviewed by John Sullivan. + + * DefaultDelegates/WebDefaultContextMenuDelegate.mm: + (-[WebDefaultUIDelegate webView:contextMenuItemsForElement:defaultMenuItems:]): Update the order of items. + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::contextMenuItemTagLookUpInDictionary): Added argument for selected string. + +2011-03-29 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=57379 + Clean up WK1 key event handling logic + + No bugs knowingly fixed, but this makes the code more consistent. + + * WebView/WebHTMLView.mm: + (struct WebHTMLViewInterpretKeyEventsParameters): Renamed eventWasHandled to + eventInterpretationHadSideEffects, because "handled" doesn't really mean much. + (-[WebHTMLView _executeSavedEditingCommands]): Factored out from _interpretKeyEvent for use + from other functions. We need to execute saved commands when an input method asks for current + state, because providing stale state could confuse it. + (-[WebHTMLView _interpretKeyEvent:savingCommands:]): Heavily commented, and updated for other + changes. + (-[WebHTMLView characterIndexForPoint:]): Call _executeSavedEditingCommands, because otherwise, + the answer would be stale. + (-[WebHTMLView firstRectForCharacterRange:]): Ditto. + (-[WebHTMLView selectedRange]): Ditto. + (-[WebHTMLView markedRange]): Ditto. + (-[WebHTMLView attributedSubstringFromRange:]): Ditto. + (-[WebHTMLView hasMarkedText]): Ditto. + (-[WebHTMLView unmarkText]): Call _executeSavedEditingCommands, because otherwise, we'd be + operating on stale data. Also, updated for eventWasHandled renaming. + (-[WebHTMLView setMarkedText:selectedRange:]): Ditto. + (-[WebHTMLView doCommandBySelector:]): Removed special handling for noop:. I verified that + it's no longer needed for bug 14522, presumably due to WebCore level changes. It was also + fragile, because there is no guarantee about when noop: is sent (also, a custom key binding + could have a noop: as one of its commands, although that's hardly practical). + Added the same "from input method" logic that we have in insertText: - I don't know of any + IMs that call this method, but we clearly need to execute it as part of IM processing when + there is marked text. + (-[WebHTMLView insertText:]): Removed a confusing check for [text length]. Always set + eventInterpretationHadSideEffects to true, becasue there is no reason to try multiple times + if current selection isn't editable. This is different from doCommandBySelector:, where we + need to give super class a chance to handle the event if our processing fails. + Removed a nonsense "consumedByIM = true" assignment - we no longer need it now that the + return value of _interpretKeyEvent is computed differently. + +2011-03-28 Adele Peterson <adele@apple.com> + + Reviewed by Eric Seidel. + + Fix for <rdar://problem/9112694> REGRESSION (r79411): "Check grammar with spelling" context menu doesn't check as you type + https://bugs.webkit.org/show_bug.cgi?id=57173 + + * WebView/WebFrame.mm: + (-[WebFrame hasSpellingMarker:length:]): Call new selectionStartHasMarkerFor method instead of selectionStartHasSpellingMarkerFor. + (-[WebFrame hasGrammarMarker:length:]): Call new selectionStartHasMarkerFor method. + * WebView/WebFramePrivate.h: Add hasGrammarMarker so grammar marking can be tested. + +2011-03-28 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=57260 + Clean up text input code a little + + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::handleKeyboardEvent): + (WebEditorClient::handleInputMethodKeydown): + * WebView/WebHTMLViewInternal.h: + Renamed _interceptEditingKeyEvent:shouldSaveCommand:, becasue it doesn't really intercept + anything. It's just a version it interpretKeyEvents: that tells us whether it was handled, + and also possibly saves resulting commands for later execution. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _interpretKeyEvent:savingCommands:]): Changed to use early return. Changed + return value in case platformEvent is null to be less mysterious. Moved receivedNOOP from + WebHTMLViewPrivate to WebHTMLViewInterpretKeyEventsParameters, as this is just part of event + handling state, like the other booleans there. Don't call interpretKeyEvents: again simply + because the first call resulted in no saved commands, becasue it's confusing and apparently + useless (I couldn't find any broken behavior). + (-[WebHTMLView unmarkText]): Cleaned upo BOOL vs. bool constants. + (-[WebHTMLView setMarkedText:selectedRange:]): Ditto. + (-[WebHTMLView doCommandBySelector:]): Ditto. + (-[WebHTMLView insertText:]): Ditto. + + * WebView/WebViewInternal.h: There was no _interceptEditingKeyEvent:shouldSaveCommand: + method on WebView. + +2011-03-27 Jer Noble <jer.noble@apple.com> + + Reviewed by Maciej Stachowiak. + + Full Screen: disable keyboard access by default + https://bugs.webkit.org/show_bug.cgi?id=56684 + + Take into account whether keyboard access was requested when deciding whether full + screen mode is supported. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::supportsFullScreenForElement): + * WebView/WebView.mm: + (-[WebView _supportsFullScreenForElement:WebCore::withKeyboard:]): + * WebView/WebViewInternal.h: + +2011-03-26 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + Enable the Full Screen API by default in WebKit/mac and WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=56956 + + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Default the WebKitFullScreenEnabled preference to true. + +2011-03-25 Andy Estes <aestes@apple.com> + + Reviewed by Adele Peterson. + + REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js + https://bugs.webkit.org/show_bug.cgi?id=49016 + + Update objectContentType() implementation to handle the + shouldPreferPlugInsForImages flag. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::objectContentType): + +2011-03-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r81939. + http://trac.webkit.org/changeset/81939 + https://bugs.webkit.org/show_bug.cgi?id=57084 + + Rolling out 81939, as it's causing a number of app cache test + failures. (Requested by jernoble on #webkit). + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2011-03-23 Jer Noble <jer.noble@apple.com> + + Reviewed by Maciej Stachowiak. + + Application Cache should save audio/ and video/ mime types as flat files + https://bugs.webkit.org/show_bug.cgi?id=53784 + <rdar://problem/8932473> + + No new tests. + + Initialize the AppCache Total size quotas with the values for WebKitPreferences + upon startup. + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2011-03-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r81916 and r81917. + http://trac.webkit.org/changeset/81916 + http://trac.webkit.org/changeset/81917 + https://bugs.webkit.org/show_bug.cgi?id=57071 + + broke a test on platforms that do not have QuickTime installed + (Requested by estes on #webkit). + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::objectContentType): + +2011-03-24 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js + https://bugs.webkit.org/show_bug.cgi?id=49016 + + Update objectContentType() implementation to handle the + shouldPreferPlugInsForImages flag. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::objectContentType): + +2011-03-24 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Ensure that all compilation takes place within a dynamic global object scope + https://bugs.webkit.org/show_bug.cgi?id=57054 + + * WebView/WebScriptDebugDelegate.mm: + (-[WebScriptCallFrame evaluateWebScript:]): Updated for signature change. + +2011-03-24 Jia Pu <jpu@apple.com> + + Reviewed by Darin Adler. + + Dismissed reversion suggestion is incorrectly learned. + https://bugs.webkit.org/show_bug.cgi?id=57039 + + CorrectionPanel should always use [NSSpellChecker dismissCorrectionBubbleForView]. + [NSSpellChecker cancelCorrectionBubbleForView] is reserved for situation where correction panel + is dismissed explicitly by ESC key or clicking the dimiss button. Misusing these causes + incorrect automatic learning. + + * WebCoreSupport/CorrectionPanel.mm: + (CorrectionPanel::dismissInternal): + +2011-03-24 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/56993> ENABLE_PLUGIN_PROXY_FOR_VIDEO should be defined to 0 on Mac OS X + + Reviewed by Joseph Pecoraro. + + * Plugins/WebPluginContainerPrivate.h: Changed value of + ENABLE_PLUGIN_PROXY_FOR_VIDEO from 1 to 0. + +2011-03-23 Jia Pu <jpu@apple.com> + + Reviewed by Darin Adler. + + Hook up new AppKit autocorrection UI with WK2. + https://bugs.webkit.org/show_bug.cgi?id=56055 + <rdar://problem/8947463> + + Please see WebCore/ChangeLog for detail. + + * WebCoreSupport/CorrectionPanel.h: Added. + (CorrectionPanel::isShowing): + * WebCoreSupport/CorrectionPanel.mm: Added. + (correctionBubbleType): + (CorrectionPanel::CorrectionPanel): + (CorrectionPanel::~CorrectionPanel): + (CorrectionPanel::show): + (CorrectionPanel::dismiss): + (CorrectionPanel::dismissSoon): + (CorrectionPanel::dismissInternal): + (CorrectionPanel::recordAutocorrectionResponse): + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::WebEditorClient): + (WebEditorClient::showCorrectionPanel): + (WebEditorClient::dismissCorrectionPanel): + (WebEditorClient::dismissCorrectionPanelSoon): + (WebEditorClient::recordAutocorrectionResponse): + * WebView/WebView.mm: + (-[WebView handleCorrectionPanelResult:]): + * WebView/WebViewPrivate.h: + +2011-03-23 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + Services menu item to convert selected Simplified/Traditional Chinese Text is not working. + https://bugs.webkit.org/show_bug.cgi?id=56974 + <rdar://problem/8284642> + + This fixes a regression introduced by http://trac.webkit.org/changeset/61794 + where readSelectionFromPasteboard was accidentally removed. + This method and writeSelectionToPasteboard are needed to support Mac OS X + services. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _pasteAsPlainTextWithPasteboard:]): Added. + (-[WebHTMLView readSelectionFromPasteboard:]): Added. + +2011-03-23 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Change IconDatabase opening to allow for arbitrary filenames + https://bugs.webkit.org/show_bug.cgi?id=56977 + + * Misc/WebIconDatabase.mm: + (-[WebIconDatabase _startUpIconDatabase]): + +2011-03-22 Anton D'Auria <adauria@apple.com> + + Reviewed by Alexey Proskuryakov. + + Add +[WebApplicationCache getOriginsWithCache] + https://bugs.webkit.org/show_bug.cgi?id=56722 + + Call existing WebCore::ApplicationCacheStorage::getOriginsWithCache API. + + * WebCoreSupport/WebApplicationCache.h: + * WebCoreSupport/WebApplicationCache.mm: + (+[WebApplicationCache originsWithCache]): + +2011-03-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + OBJECT element with DivX source is always downloaded + https://bugs.webkit.org/show_bug.cgi?id=56879 + + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage getPluginInfoFromPLists]): + Always try to split every element in the "WebPluginExtensions" array, since the DivX plug-in + specifies multiple file extensions in a single element. + +2011-03-22 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8648311> and https://bugs.webkit.org/show_bug.cgi?id=56876 + WK2 Icon DB: Expand IconDatabaseClient interface and move it to the main thread + + Note that while the new client calls always come through on the main thread, our mechanisms to + route dispatches to the main thread are still valid and will still work. + + Update to the new IconDatabaseClient interface: + * WebCoreSupport/WebIconDatabaseClient.h: + * WebCoreSupport/WebIconDatabaseClient.mm: + (WebIconDatabaseClient::didRemoveAllIcons): + (WebIconDatabaseClient::didImportIconURLForPageURL): + (WebIconDatabaseClient::didImportIconDataForPageURL): + (WebIconDatabaseClient::didChangeIconForPageURL): + (WebIconDatabaseClient::didFinishURLImport): + +2011-03-22 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Have WebKit push acceleratedDrawing preferences to settings + https://bugs.webkit.org/show_bug.cgi?id=56792 + + * WebView/WebView.mm: + +2011-03-21 Nate Chapin <japhet@chromium.org> + + Reviewed by Brady Eidson. + + Expose a preference to use caching quirks for QuickLook, + and use it if the QuickLook framework is loaded. + + https://bugs.webkit.org/show_bug.cgi?id=38690 + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (useQuickLookQuirks): + (+[WebPreferences initialize]): + (-[WebPreferences useQuickLookResourceCachingQuirks]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2011-03-21 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + AX: showContextMenu not working in WK2 + https://bugs.webkit.org/show_bug.cgi?id=56734 + + Implement showContextMenu() so accessibility related code can call this + independent of whether WK1 or WK2 is running. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::showContextMenu): + +2011-03-21 Chang Shu <cshu@webkit.org> + + Reviewed by Alexey Proskuryakov. + + REGRESSION (r79953): Can't type in MS Outlook 2011 + https://bugs.webkit.org/show_bug.cgi?id=56665 + + r79953 removed the WebView level editablity which is persistent no matter whether + underlying document itself is changed and editability gets lost. The resolution is to + set this WebView editable value to WebCore. This avoids the callback from WebCore to + WebKit which was the main goal in r79953 to improve performance. + + * WebView/WebView.mm: + (-[WebView setEditable:]): + (-[WebView isEditable]): + +2011-03-19 Anton D'Auria <adauria@apple.com> + + Reviewed by Alexey Proskuryakov. + + ApplicationCacheGroup is not obsolete after being deleted via ApplicationCacheStorage::deleteEntriesForOrigin + https://bugs.webkit.org/show_bug.cgi?id=56415 + + Use new ApplicationCache API to delete all cache for an origin. + + * WebCoreSupport/WebApplicationCache.h: + * WebCoreSupport/WebApplicationCache.mm: + (+[WebApplicationCache deleteOrigin:]): + +2011-03-17 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=56425 + More groundwork for WebKit2 IconDatabase + + Update already-used function names: + * Misc/WebIconDatabase.mm: + (-[WebIconDatabase iconForURL:withSize:cache:]): + (-[WebIconDatabase iconURLForURL:]): + * WebView/WebView.mm: + (-[WebView _dispatchDidReceiveIconFromWebFrame:]): + +2011-03-18 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: implement inspector session storage. + https://bugs.webkit.org/show_bug.cgi?id=56643 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::saveSessionSetting): + (WebInspectorClient::loadSessionSetting): + (WebInspectorFrontendClient::saveSessionSetting): + (WebInspectorFrontendClient::loadSessionSetting): + (-[WebInspectorWindowController inspectorClient]): + +2011-03-17 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Fixed a leak seen on the buildbot. + + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::openInspectorFrontend): Smart pointers are smart. + +2011-03-16 Jeff Johnson <github@lapcatsoftware.com> + + Reviewed by Alexey Proskuryakov. + + Logic error in -[WebHTMLView close] + https://bugs.webkit.org/show_bug.cgi?id=56445 + + Page is always nil at this point, because [self _webView] is nil, + so the conditional code is never run. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView close]): + +2011-03-16 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + WK2: Need to propagate enhanced accessibility flag from UI -> web process + https://bugs.webkit.org/show_bug.cgi?id=56379 + + * WebView/WebFrame.mm: + (-[WebFrame accessibilityRoot]): + +2011-03-15 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + Make Structure creation require a JSGlobalData + https://bugs.webkit.org/show_bug.cgi?id=56438 + + Mechanical change to make all Structure creation use a JSGlobalData& + + * Plugins/Hosted/ProxyInstance.mm: + (WebKit::ProxyRuntimeMethod::createStructure): + * Plugins/Hosted/ProxyRuntimeObject.h: + (WebKit::ProxyRuntimeObject::createStructure): + +2011-03-15 Alexey Proskuryakov <ap@apple.com> + + Forgot to save a modification to this file when committing. + + * WebCoreSupport/WebKeyGenerator.mm: Changed "Apple Computer" to "Apple" in copyright header. + +2011-03-15 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (WebKit2): keygen element doesn't work + https://bugs.webkit.org/show_bug.cgi?id=56402 + <rdar://problem/9006545> + + * WebCoreSupport/WebKeyGenerator.h: + * WebCoreSupport/WebKeyGenerator.m: Removed. + * WebCoreSupport/WebKeyGenerator.mm: Copied from Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m. + (+[WebKeyGenerator sharedGenerator]): + (toWebCertificateParseResult): + WebCore no longer needs WebKeyGenerator. Safari still does need a part of it, so keeping + this misnamed and misplaced code for now. + + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::keygenMenuItem512): + (WebPlatformStrategies::keygenMenuItem1024): + (WebPlatformStrategies::keygenMenuItem2048): + (WebPlatformStrategies::keygenKeychainItemName): + Added strings used by keygen. + + * WebCoreSupport/WebSystemInterface.mm: (InitWebCoreSystemInterface): Initialize a WebCore + pointer to a function used by keygen. + + * WebView/WebFrameView.mm: (-[WebFrameView initWithFrame:]): WebKeyGenerator can be lazily + initialized now. + +2011-03-15 Beth Dakin <bdakin@apple.com> + + Reviewed by Simon Fraser. + + WebKit part of <rdar://problem/9075624> Overlay scrollbars slow down PLT by 6% + + New WebKitystemInterface function to force the scrollbars to flash + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-03-15 Ilya Sherman <isherman@chromium.org> + + Reviewed by Tony Chang. + + Autofilled form elements are assigned fixed background color but not text color + https://bugs.webkit.org/show_bug.cgi?id=48382 + + * DOM/WebDOMOperations.mm: + (-[DOMHTMLInputElement _setAutofilled:]): Added (wrapper). + * DOM/WebDOMOperationsPrivate.h: + +2011-03-15 Adam Roben <aroben@apple.com> + + Fix a leak in WebStorageTrackerClient::dispatchDidModifyOrigin + + Fixes <http://webkit.org/b/56385> SecurityOrigin leaks seen in + WebStorageTrackerClient::dispatchDidModifyOrigin + + Reviewed by Antti Koivisto. + + * Storage/WebStorageTrackerClient.mm: + (WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread): Adopt the reference passed + to us by dispatchDidModifyOrigin. + (WebStorageTrackerClient::dispatchDidModifyOrigin): Added a comment and removed an + unnecessary cast. + +2011-03-15 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Introduce WTF_USE_EXPORT_MACROS, which will allow us to put shared library import/export + info into the headers rather than in export symbol definition files, but disable it on + all platforms initially so we can deal with port build issues one port at a time. + + https://bugs.webkit.org/show_bug.cgi?id=27551 + + * WebKitPrefix.h: + +2011-03-14 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=56320 + Remove HistoryItem::icon() and the WebCore dependency on "IconDatabaseBase::defaultIcon()" + + * History/WebHistoryItem.mm: + (-[WebHistoryItem icon]): This far-future FIXME is now irrelevant. + +2011-03-13 Pratik Solanki <psolanki@apple.com> + + Reviewed by Brady Eidson. + + Make adjustMIMETypeIfNecessary use CFNetwork directly + https://bugs.webkit.org/show_bug.cgi?id=55912 + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Support for new WKSI functions. + +2011-03-12 Mark Rowe <mrowe@apple.com> + + Fix the 32-bit build. + + * Carbon/CarbonWindowAdapter.mm: + (-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]): Use a more appropriate format specifier. + (-[CarbonWindowAdapter _carbonWindowClass]): Ditto. + +2011-03-11 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson + + <rdar://problem/8648311> and https://bugs.webkit.org/show_bug.cgi?id=56216 + Rework disabled IconDatabase builds while allowing for a pluggable icon database implementation. + + * Misc/WebIconDatabase.mm: + (+[WebIconDatabase _checkIntegrityBeforeOpening]): Call these static methods on IconDatabase::, not iconDatabase(). + (-[WebIconDatabase _startUpIconDatabase]): Ditto. + (importToWebCoreFormat): + +2011-03-11 Anton D'Auria <adauria@apple.com> + + Reviewed and landed by Brady Eidson. + + https://bugs.webkit.org/show_bug.cgi?id=51878 + Add WebKit1 API to view and delete local storage + + * Storage/WebStorageManager.mm: Added. + (+[WebStorageManager sharedWebStorageManager]): + (-[WebStorageManager origins]): + (-[WebStorageManager deleteAllOrigins]): + (-[WebStorageManager deleteOrigin:]): + (-[WebStorageManager syncLocalStorage]): + (-[WebStorageManager syncFileSystemAndTrackerDatabase]): + (storageDirectoryPath): + (WebKitInitializeStorageIfNecessary): + * Storage/WebStorageManagerInternal.h: Added. + * Storage/WebStorageManagerPrivate.h: Added. + * Storage/WebStorageTrackerClient.h: Added. + * Storage/WebStorageTrackerClient.mm: Added. + (WebStorageTrackerClient::sharedWebStorageTrackerClient): + (WebStorageTrackerClient::WebStorageTrackerClient): + (WebStorageTrackerClient::~WebStorageTrackerClient): + (WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread): + (WebStorageTrackerClient::dispatchDidModifyOrigin): + * WebCoreSupport/WebSecurityOrigin.mm: + (-[WebSecurityOrigin protocol]): + (-[WebSecurityOrigin host]): + (-[WebSecurityOrigin databaseIdentifier]): + (-[WebSecurityOrigin domain]): + (-[WebSecurityOrigin _initWithWebCoreSecurityOrigin:]): + * WebCoreSupport/WebSecurityOriginPrivate.h: + * WebKit.exp: + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +2011-03-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/9117047> + Don't paint more than 60 times per second even when scrolling + + * WebView/WebClipView.mm: + (-[WebClipView _immediateScrollToPoint:]): + +2011-03-09 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Plumb through settings for accelerated drawing for canvas + https://bugs.webkit.org/show_bug.cgi?id=56039 + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + * WebView/WebPreferencesPrivate.h: + +2011-03-10 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Tony Chang. + + VisiblePosition's next and previous should take an enum instead of a boolean + https://bugs.webkit.org/show_bug.cgi?id=56135 + + SelectionController::isAll now takes EditingBoundaryCrossingRule instead of + StayInEditableContent. + + * WebView/WebView.mm: + (-[WebView _selectionIsAll]): + +2011-03-09 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben. + + Use the Cookie Storage from the Private Browsing Storage Session directly + https://bugs.webkit.org/show_bug.cgi?id=55986 + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-03-08 Darin Adler <darin@apple.com> + + Reviewed by Timothy Hatcher. + + Promote a method used outside WebKit from internal to private + https://bugs.webkit.org/show_bug.cgi?id=55949 + + * Misc/WebNSPasteboardExtras.mm: Removed an unused category declaration. + Minor tweak, not directly related to the rest of this patch. + + * WebView/WebFrame.mm: + (-[WebFrame _computePageRectsWithPrintScaleFactor:pageSize:]): Moved + this method from the internal category into the private category. + Streamlined the code a bit. + + * WebView/WebFrameInternal.h: Removed _computePageRects method. + * WebView/WebFramePrivate.h: Added _computePageRects method. + 2011-03-07 Ryosuke Niwa <rniwa@webkit.org> Reviewed by Darin Adler. diff --git a/Source/WebKit/mac/Configurations/Base.xcconfig b/Source/WebKit/mac/Configurations/Base.xcconfig index 0e84791..0cf0f7a 100644 --- a/Source/WebKit/mac/Configurations/Base.xcconfig +++ b/Source/WebKit/mac/Configurations/Base.xcconfig @@ -25,7 +25,6 @@ DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DEBUGGING_SYMBOLS = default; GCC_DYNAMIC_NO_PIC = NO; -GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(REAL_PLATFORM_NAME)); @@ -104,12 +103,23 @@ TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSI TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; TARGET_GCC_VERSION_macosx_1060 = GCC_42; -TARGET_GCC_VERSION_macosx_1070 = LLVM_GCC_42; +TARGET_GCC_VERSION_macosx_1070 = $(TARGET_GCC_VERSION_macosx_1070_$(CONFIGURATION)); +TARGET_GCC_VERSION_macosx_1070_Debug = LLVM_COMPILER; +TARGET_GCC_VERSION_macosx_1070_Release = LLVM_GCC_42; +TARGET_GCC_VERSION_macosx_1070_Production = LLVM_GCC_42; GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); GCC_VERSION_GCC_40 = 4.0; GCC_VERSION_GCC_42 = 4.2; GCC_VERSION_LLVM_GCC_42 = com.apple.compilers.llvmgcc42; +GCC_VERSION_LLVM_COMPILER = com.apple.compilers.llvm.clang.1_0; + +// FIXME: Disable C++ exceptions in the LLVM Compiler once it supports enabling Obj-C exceptions without C++ exceptions. +GCC_ENABLE_CPP_EXCEPTIONS = $(GCC_ENABLE_CPP_EXCEPTIONS_$(TARGET_GCC_VERSION)); +GCC_ENABLE_CPP_EXCEPTIONS_GCC_40 = NO; +GCC_ENABLE_CPP_EXCEPTIONS_GCC_42 = NO; +GCC_ENABLE_CPP_EXCEPTIONS_LLVM_GCC = NO; +GCC_ENABLE_CPP_EXCEPTIONS_LLVM_COMPILER = YES; // If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index b6a6045..5e8e50b 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 24; +MINOR_VERSION = 27; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/DOM/WebDOMOperations.mm b/Source/WebKit/mac/DOM/WebDOMOperations.mm index eee4919..979433d 100644 --- a/Source/WebKit/mac/DOM/WebDOMOperations.mm +++ b/Source/WebKit/mac/DOM/WebDOMOperations.mm @@ -197,6 +197,11 @@ using namespace JSC; @implementation DOMHTMLInputElement (WebDOMHTMLInputElementOperationsPrivate) +- (void)_setAutofilled:(BOOL)autofilled +{ + static_cast<HTMLInputElement*>(core((DOMElement *)self))->setAutofilled(autofilled); +} + - (void)_setValueForUser:(NSString *)value { static_cast<HTMLInputElement*>(core((DOMElement *)self))->setValueForUser(value); diff --git a/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h b/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h index dc1aaf8..b579a6f 100644 --- a/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h +++ b/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h @@ -39,6 +39,7 @@ @end @interface DOMHTMLInputElement (WebDOMHTMLInputElementOperationsPrivate) +- (void)_setAutofilled:(BOOL)autofilled; - (void)_setValueForUser:(NSString *)value; @end diff --git a/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm b/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm index a2f02e6..a6dd828 100644 --- a/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm +++ b/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm @@ -129,6 +129,12 @@ } } +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 1 +#else +#define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 0 +#endif + - (NSArray *)webView:(WebView *)wv contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems { // The defaultMenuItems here are ones supplied by the WebDocumentView protocol implementation. WebPDFView is @@ -141,16 +147,29 @@ // The Spotlight and Google items are implemented in WebView, and require that the // current document view conforms to WebDocumentText ASSERT([[[webFrame frameView] documentView] conformsToProtocol:@protocol(WebDocumentText)]); - [menuItems addObject:[self menuItemWithTag:WebMenuItemTagSearchInSpotlight target:nil representedObject:element]]; - [menuItems addObject:[self menuItemWithTag:WebMenuItemTagSearchWeb target:nil representedObject:element]]; - [menuItems addObject:[NSMenuItem separatorItem]]; // FIXME 4184640: The Look Up in Dictionary item is only implemented in WebHTMLView, and so is present but // dimmed for other cases where WebElementIsSelectedKey is present. It would probably // be better not to include it in the menu if the documentView isn't a WebHTMLView, but that could break // existing clients that have code that relies on it being present (unlikely for clients outside of Apple, // but Safari has such code). - [menuItems addObject:[self menuItemWithTag:WebMenuItemTagLookUpInDictionary target:nil representedObject:element]]; + +#if INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM + [menuItems addObject:[self menuItemWithTag:WebMenuItemTagSearchInSpotlight target:nil representedObject:element]]; +#else + NSMenuItem *lookupMenuItem = [self menuItemWithTag:WebMenuItemTagLookUpInDictionary target:nil representedObject:element]; + NSString *selectedString = [(id <WebDocumentText>)[[webFrame frameView] documentView] selectedString]; + [lookupMenuItem setTitle:[NSString stringWithFormat:UI_STRING_INTERNAL("Look Up “%@”", "Look Up context menu item with selected word"), selectedString]]; + [menuItems addObject:lookupMenuItem]; +#endif + + [menuItems addObject:[self menuItemWithTag:WebMenuItemTagSearchWeb target:nil representedObject:element]]; + +#if INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM + [menuItems addObject:[NSMenuItem separatorItem]]; + [menuItems addObject:[self menuItemWithTag:WebMenuItemTagLookUpInDictionary target:nil representedObject:element]]; +#endif + [menuItems addObject:[NSMenuItem separatorItem]]; [menuItems addObject:[self menuItemWithTag:WebMenuItemTagCopy target:nil representedObject:element]]; } else { diff --git a/Source/WebKit/mac/History/WebHistoryItem.mm b/Source/WebKit/mac/History/WebHistoryItem.mm index de56180..530b18a 100644 --- a/Source/WebKit/mac/History/WebHistoryItem.mm +++ b/Source/WebKit/mac/History/WebHistoryItem.mm @@ -185,12 +185,6 @@ void WKNotifyHistoryItemChanged(HistoryItem*) - (NSImage *)icon { return [[WebIconDatabase sharedIconDatabase] iconForURL:[self URLString] withSize:WebIconSmallSize]; - - // FIXME: Ideally, this code should simply be the following - - // return core(_private)->icon()->getNSImage(); - // Once radar - - // <rdar://problem/4906567> - NSImage returned from WebCore::Image may be incorrect size - // is resolved } - (NSTimeInterval)lastVisitedTimeInterval diff --git a/Source/WebKit/mac/Misc/WebIconDatabase.mm b/Source/WebKit/mac/Misc/WebIconDatabase.mm index 50bcd7e..f223f09 100644 --- a/Source/WebKit/mac/Misc/WebIconDatabase.mm +++ b/Source/WebKit/mac/Misc/WebIconDatabase.mm @@ -137,8 +137,8 @@ static WebIconDatabaseClient* defaultClient() // FIXME - <rdar://problem/4697934> - Move the handling of FileURLs to WebCore and implement in ObjC++ if ([URL _webkit_isFileURL]) return [self _iconForFileURL:URL withSize:size]; - - if (Image* image = iconDatabase().iconForPageURL(URL, IntSize(size))) + + if (Image* image = iconDatabase().synchronousIconForPageURL(URL, IntSize(size))) if (NSImage *icon = webGetNSImage(image, size)) return icon; return [self defaultIconForURL:URL withSize:size]; @@ -155,7 +155,7 @@ static WebIconDatabaseClient* defaultClient() return nil; ASSERT_MAIN_THREAD(); - return iconDatabase().iconURLForPageURL(URL); + return iconDatabase().synchronousIconURLForPageURL(URL); } - (NSImage *)defaultIconWithSize:(NSSize)size @@ -258,7 +258,7 @@ static WebIconDatabaseClient* defaultClient() + (void)_checkIntegrityBeforeOpening { - iconDatabase().checkIntegrityBeforeOpening(); + IconDatabase::checkIntegrityBeforeOpening(); } @end @@ -296,14 +296,14 @@ static WebIconDatabaseClient* defaultClient() NSString *legacyDB = [databaseDirectory stringByAppendingPathComponent:@"icon.db"]; NSFileManager *defaultManager = [NSFileManager defaultManager]; if ([defaultManager fileExistsAtPath:legacyDB isDirectory:&isDirectory] && !isDirectory) { - NSString *newDB = [databaseDirectory stringByAppendingPathComponent:iconDatabase().defaultDatabaseFilename()]; + NSString *newDB = [databaseDirectory stringByAppendingPathComponent:IconDatabase::defaultDatabaseFilename()]; if (![defaultManager fileExistsAtPath:newDB]) rename([legacyDB fileSystemRepresentation], [newDB fileSystemRepresentation]); } // Set the private browsing pref then open the WebCore icon database iconDatabase().setPrivateBrowsingEnabled([[WebPreferences standardPreferences] privateBrowsingEnabled]); - if (!iconDatabase().open(databaseDirectory)) + if (!iconDatabase().open(databaseDirectory, IconDatabase::defaultDatabaseFilename())) LOG_ERROR("Unable to open icon database"); // Register for important notifications @@ -656,7 +656,7 @@ bool importToWebCoreFormat() NSFileManager *fileManager = [NSFileManager defaultManager]; enumerator = [[fileManager contentsOfDirectoryAtPath:databaseDirectory error:NULL] objectEnumerator]; - NSString *databaseFilename = iconDatabase().defaultDatabaseFilename(); + NSString *databaseFilename = IconDatabase::defaultDatabaseFilename(); BOOL foundIconDB = NO; NSString *file; diff --git a/Source/WebKit/mac/Misc/WebNSControlExtras.m b/Source/WebKit/mac/Misc/WebNSControlExtras.m index b666131..dc91e23 100644 --- a/Source/WebKit/mac/Misc/WebNSControlExtras.m +++ b/Source/WebKit/mac/Misc/WebNSControlExtras.m @@ -44,7 +44,15 @@ NSWindow *window = [self window]; NSRect windowFrame = [window frame]; - windowFrame.size.height += heightDelta * [window userSpaceScaleFactor]; + + CGFloat userSpaceScaleFactor; +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + userSpaceScaleFactor = [window backingScaleFactor]; +#else + userSpaceScaleFactor = [window userSpaceScaleFactor]; +#endif + + windowFrame.size.height += heightDelta * userSpaceScaleFactor; [window setFrame:windowFrame display:NO]; } diff --git a/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm b/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm index 7caa47a..f5c7436 100644 --- a/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm +++ b/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm @@ -47,11 +47,6 @@ #import <wtf/RetainPtr.h> #import <wtf/StdLibExtras.h> -@interface NSFilePromiseDragSource : NSObject -- (id)initWithSource:(id)draggingSource; -- (void)setTypes:(NSArray *)types onPasteboard:(NSPasteboard *)pboard; -@end - using namespace WebCore; NSString *WebURLPboardType = @"public.url"; diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm index 8a413d4..f26b85d 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm @@ -187,9 +187,9 @@ public: ASSERT(inherits(&s_info)); } - static PassRefPtr<Structure> createStructure(JSValue prototype) + static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static const ClassInfo s_info; diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h index fc77890..a07c86c 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h @@ -41,9 +41,9 @@ public: ProxyInstance* getInternalProxyInstance() const; - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static const JSC::ClassInfo s_info; diff --git a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm index 05b084a..3fb86cb 100644 --- a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm +++ b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm @@ -38,6 +38,7 @@ #import <wtf/Assertions.h> #import <wtf/Threading.h> #import <wtf/Vector.h> +#import <wtf/text/CString.h> #import <WebKitSystemInterface.h> @@ -222,8 +223,15 @@ static NSString *pathByResolvingSymlinksAndAliases(NSString *thePath) MimeClassInfo mimeClassInfo; extensions = [[MIMEDictionary objectForKey:WebPluginExtensionsKey] _web_lowercaseStrings]; - for (NSUInteger i = 0; i < [extensions count]; ++i) - mimeClassInfo.extensions.append((NSString *)[extensions objectAtIndex:i]); + for (NSUInteger i = 0; i < [extensions count]; ++i) { + // The DivX plug-in lists multiple extensions in a comma separated string instead of using + // multiple array elements in the property list. Work around this here by splitting the + // extension string into components. + NSArray *extensionComponents = [[extensions objectAtIndex:i] componentsSeparatedByString:@","]; + + for (NSString *extension in extensionComponents) + mimeClassInfo.extensions.append(extension); + } if ([extensions count] == 0) extensions = [NSArray arrayWithObject:@""]; diff --git a/Source/WebKit/mac/Plugins/WebPluginContainerPrivate.h b/Source/WebKit/mac/Plugins/WebPluginContainerPrivate.h index af7251d..1b8de41 100644 --- a/Source/WebKit/mac/Plugins/WebPluginContainerPrivate.h +++ b/Source/WebKit/mac/Plugins/WebPluginContainerPrivate.h @@ -29,7 +29,7 @@ #import <Cocoa/Cocoa.h> #if !defined(ENABLE_PLUGIN_PROXY_FOR_VIDEO) -#define ENABLE_PLUGIN_PROXY_FOR_VIDEO 1 +#define ENABLE_PLUGIN_PROXY_FOR_VIDEO 0 #endif #if ENABLE_PLUGIN_PROXY_FOR_VIDEO diff --git a/Source/WebKit/mac/Storage/WebStorageManager.mm b/Source/WebKit/mac/Storage/WebStorageManager.mm new file mode 100644 index 0000000..23f699f --- /dev/null +++ b/Source/WebKit/mac/Storage/WebStorageManager.mm @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if ENABLE(DOM_STORAGE) + +#import "WebSecurityOriginInternal.h" +#import "WebStorageManagerPrivate.h" +#import "WebStorageManagerInternal.h" +#import "WebStorageTrackerClient.h" + +#import <WebCore/SecurityOrigin.h> +#import <WebCore/StorageTracker.h> + +using namespace WebCore; + +NSString * const WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey"; +NSString * const WebStorageDidModifyOriginNotification = @"WebStorageDidModifyOriginNotification"; + +static NSString *storageDirectoryPath(); + +@implementation WebStorageManager + ++ (WebStorageManager *)sharedWebStorageManager +{ + static WebStorageManager *sharedManager = [[WebStorageManager alloc] init]; + return sharedManager; +} + +- (NSArray *)origins +{ + Vector<RefPtr<SecurityOrigin> > coreOrigins; + + StorageTracker::tracker().origins(coreOrigins); + + NSMutableArray *webOrigins = [[NSMutableArray alloc] initWithCapacity:coreOrigins.size()]; + + for (size_t i = 0; i < coreOrigins.size(); ++i) { + WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:coreOrigins[i].get()]; + [webOrigins addObject:webOrigin]; + [webOrigin release]; + } + + return [webOrigins autorelease]; +} + +- (void)deleteAllOrigins +{ + StorageTracker::tracker().deleteAllOrigins(); +} + +- (void)deleteOrigin:(WebSecurityOrigin *)origin +{ + StorageTracker::tracker().deleteOrigin([origin _core]); +} + +- (void)syncLocalStorage +{ + StorageTracker::tracker().syncLocalStorage(); +} + +- (void)syncFileSystemAndTrackerDatabase +{ + StorageTracker::tracker().syncFileSystemAndTrackerDatabase(); +} + +static NSString *storageDirectoryPath() +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSString *storageDirectory = [defaults objectForKey:WebStorageDirectoryDefaultsKey]; + if (!storageDirectory || ![storageDirectory isKindOfClass:[NSString class]]) + storageDirectory = @"~/Library/WebKit/LocalStorage"; + + return [storageDirectory stringByStandardizingPath]; +} + +void WebKitInitializeStorageIfNecessary() +{ + static BOOL initialized = NO; + if (initialized) + return; + + StorageTracker::initializeTracker(storageDirectoryPath()); + + StorageTracker::tracker().setClient(WebStorageTrackerClient::sharedWebStorageTrackerClient()); + + initialized = YES; +} + +@end + +#endif diff --git a/Source/WebKit/mac/Storage/WebStorageManagerInternal.h b/Source/WebKit/mac/Storage/WebStorageManagerInternal.h new file mode 100644 index 0000000..d3d3604 --- /dev/null +++ b/Source/WebKit/mac/Storage/WebStorageManagerInternal.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if ENABLE(DOM_STORAGE) + +void WebKitInitializeStorageIfNecessary(); + +#endif diff --git a/Source/WebKit/mac/Storage/WebStorageManagerPrivate.h b/Source/WebKit/mac/Storage/WebStorageManagerPrivate.h new file mode 100644 index 0000000..34db3f6 --- /dev/null +++ b/Source/WebKit/mac/Storage/WebStorageManagerPrivate.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +extern NSString * const WebStorageDirectoryDefaultsKey; +extern NSString * const WebStorageDidModifyOriginNotification; + +@class WebSecurityOrigin; + +@interface WebStorageManager : NSObject + ++ (WebStorageManager *)sharedWebStorageManager; + +// Returns an array of WebSecurityOrigin objects that have LocalStorage. +- (NSArray *)origins; + +- (void)deleteAllOrigins; +- (void)deleteOrigin:(WebSecurityOrigin *)origin; + +- (void)syncLocalStorage; +- (void)syncFileSystemAndTrackerDatabase; + +@end + diff --git a/Source/WebKit/mac/Storage/WebStorageTrackerClient.h b/Source/WebKit/mac/Storage/WebStorageTrackerClient.h new file mode 100644 index 0000000..d3c190c --- /dev/null +++ b/Source/WebKit/mac/Storage/WebStorageTrackerClient.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if ENABLE(DOM_STORAGE) + +#import <WebCore/SecurityOrigin.h> +#import <WebCore/StorageTrackerClient.h> + +using namespace WebCore; + +class WebStorageTrackerClient : public WebCore::StorageTrackerClient { +public: + static WebStorageTrackerClient* sharedWebStorageTrackerClient(); + static void dispatchDidModifyOriginOnMainThread(void* context); + + virtual ~WebStorageTrackerClient(); + virtual void dispatchDidModifyOrigin(const String& originIdentifier); + virtual void dispatchDidModifyOrigin(PassRefPtr<SecurityOrigin>); +private: + WebStorageTrackerClient(); +}; + +#endif diff --git a/Source/WebKit/mac/Storage/WebStorageTrackerClient.mm b/Source/WebKit/mac/Storage/WebStorageTrackerClient.mm new file mode 100644 index 0000000..01bb981 --- /dev/null +++ b/Source/WebKit/mac/Storage/WebStorageTrackerClient.mm @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if ENABLE(DOM_STORAGE) + +#import "WebStorageTrackerClient.h" + +#import "WebSecurityOriginInternal.h" +#import "WebStorageManagerPrivate.h" +#import <WebCore/PlatformString.h> +#import <WebCore/SecurityOrigin.h> +#import <wtf/MainThread.h> +#import <wtf/RetainPtr.h> + +using namespace WebCore; + +WebStorageTrackerClient* WebStorageTrackerClient::sharedWebStorageTrackerClient() +{ + static WebStorageTrackerClient* sharedClient = new WebStorageTrackerClient(); + return sharedClient; +} + +WebStorageTrackerClient::WebStorageTrackerClient() +{ +} + +WebStorageTrackerClient::~WebStorageTrackerClient() +{ +} + +void WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread(void* context) +{ + ASSERT(isMainThread()); + // adoptRef is balanced by leakRef in dispatchDidModifyOrigin. + RefPtr<SecurityOrigin> origin = adoptRef(static_cast<SecurityOrigin*>(context)); + WebStorageTrackerClient::sharedWebStorageTrackerClient()->dispatchDidModifyOrigin(origin.get()); +} + +void WebStorageTrackerClient::dispatchDidModifyOrigin(PassRefPtr<SecurityOrigin> origin) +{ + RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin.get()]); + + [[NSNotificationCenter defaultCenter] postNotificationName:WebStorageDidModifyOriginNotification + object:webSecurityOrigin.get()]; +} + +void WebStorageTrackerClient::dispatchDidModifyOrigin(const String& originIdentifier) +{ + PassRefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); + + if (!isMainThread()) { + // leakRef is balanced by adoptRef in dispatchDidModifyOriginOnMainThread. + callOnMainThread(dispatchDidModifyOriginOnMainThread, origin.leakRef()); + return; + } + + dispatchDidModifyOrigin(origin); +} + +#endif diff --git a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h new file mode 100644 index 0000000..8adb79f --- /dev/null +++ b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CorrectionPanel_h +#define CorrectionPanel_h + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#import <AppKit/NSTextChecker.h> +#import <WebCore/CorrectionPanelInfo.h> +#import <wtf/RetainPtr.h> + +@class WebView; + +class CorrectionPanel { + WTF_MAKE_NONCOPYABLE(CorrectionPanel); +public: + CorrectionPanel(); + ~CorrectionPanel(); + void show(WebView*, WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings); + void dismiss(WebCore::ReasonForDismissingCorrectionPanel); + String dismissSoon(WebCore::ReasonForDismissingCorrectionPanel); + static void recordAutocorrectionResponse(WebView*, NSCorrectionResponse, const String& replacedString, const String& replacementString); + +private: + bool isShowing() const { return m_view; } + void dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally); + void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType); + + bool m_wasDismissedExternally; + WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissing; + RetainPtr<WebView> m_view; + RetainPtr<NSString> m_resultForSynchronousDismissal; + RetainPtr<NSCondition> m_resultCondition; +}; + +#endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + +#endif // CorrectionPanel_h diff --git a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm new file mode 100644 index 0000000..05f3f69 --- /dev/null +++ b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +#import "CorrectionPanel.h" + +#import "WebViewPrivate.h" + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +using namespace WebCore; + +static inline NSCorrectionBubbleType correctionBubbleType(CorrectionPanelInfo::PanelType panelType) +{ + switch (panelType) { + case CorrectionPanelInfo::PanelTypeCorrection: + return NSCorrectionBubbleTypeCorrection; + case CorrectionPanelInfo::PanelTypeReversion: + return NSCorrectionBubbleTypeReversion; + case CorrectionPanelInfo::PanelTypeSpellingSuggestions: + return NSCorrectionBubbleTypeGuesses; + } + ASSERT_NOT_REACHED(); + return NSCorrectionBubbleTypeCorrection; +} + +CorrectionPanel::CorrectionPanel() + : m_wasDismissedExternally(false) + , m_reasonForDismissing(ReasonForDismissingCorrectionPanelIgnored) + , m_resultCondition(AdoptNS, [[NSCondition alloc] init]) +{ +} + +CorrectionPanel::~CorrectionPanel() +{ + dismissInternal(ReasonForDismissingCorrectionPanelIgnored, false); +} + +void CorrectionPanel::show(WebView* view, CorrectionPanelInfo::PanelType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) +{ + dismissInternal(ReasonForDismissingCorrectionPanelIgnored, false); + + if (!view) + return; + + NSString* replacedStringAsNSString = replacedString; + NSString* replacementStringAsNSString = replacementString; + m_view = view; + NSCorrectionBubbleType bubbleType = correctionBubbleType(type); + + NSMutableArray* alternativeStrings = 0; + if (!alternativeReplacementStrings.isEmpty()) { + size_t size = alternativeReplacementStrings.size(); + alternativeStrings = [NSMutableArray arrayWithCapacity:size]; + for (size_t i = 0; i < size; ++i) + [alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]]; + } + + [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxOfReplacedString view:m_view.get() completionHandler:^(NSString* acceptedString) { + handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, bubbleType); + }]; +} + +void CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason) +{ + dismissInternal(reason, true); +} + +String CorrectionPanel::dismissSoon(ReasonForDismissingCorrectionPanel reason) +{ + if (!isShowing()) + return String(); + + dismissInternal(reason, true); + [m_resultCondition.get() lock]; + while (!m_resultForSynchronousDismissal) + [m_resultCondition.get() wait]; + [m_resultCondition.get() unlock]; + return m_resultForSynchronousDismissal.get(); +} + +void CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally) +{ + m_wasDismissedExternally = dismissingExternally; + if (!isShowing()) + return; + + m_reasonForDismissing = reason; + m_resultForSynchronousDismissal.clear(); + [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_view.get()]; + m_view.clear(); +} + +void CorrectionPanel::recordAutocorrectionResponse(WebView* view, NSCorrectionResponse response, const String& replacedString, const String& replacementString) +{ + [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view spellCheckerDocumentTag]]; +} + +void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType correctionBubbleType) +{ + NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker]; + NSInteger documentTag = [m_view.get() spellCheckerDocumentTag]; + + switch (correctionBubbleType) { + case NSCorrectionBubbleTypeCorrection: + if (acceptedReplacement) + [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; + else { + if (!m_wasDismissedExternally || m_reasonForDismissing == ReasonForDismissingCorrectionPanelCancelled) + [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; + else + [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; + } + break; + case NSCorrectionBubbleTypeReversion: + if (acceptedReplacement) + [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replaced forWord:acceptedReplacement language:nil inSpellDocumentWithTag:documentTag]; + break; + case NSCorrectionBubbleTypeGuesses: + if (acceptedReplacement) + [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; + break; + } + + if (!m_wasDismissedExternally) { + [m_view.get() handleCorrectionPanelResult:acceptedReplacement]; + return; + } + + [m_resultCondition.get() lock]; + if (acceptedReplacement) + m_resultForSynchronousDismissal.adoptNS([acceptedReplacement copy]); + [m_resultCondition.get() signal]; + [m_resultCondition.get() unlock]; +} + +#endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + diff --git a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h index 976ce18..3d6c91e 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h +++ b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h @@ -25,6 +25,8 @@ #import <Foundation/Foundation.h> +@class WebSecurityOrigin; + @interface WebApplicationCache: NSObject + (long long)maximumSize; @@ -34,5 +36,8 @@ + (void)setDefaultOriginQuota:(long long)size; + (void)deleteAllApplicationCaches; ++ (void)deleteCacheForOrigin:(WebSecurityOrigin *)origin; + ++ (NSArray *)originsWithCache; @end diff --git a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm index bf517c1..131bb9c 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm @@ -26,7 +26,12 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) #import "WebApplicationCache.h" + +#import "WebSecurityOriginInternal.h" +#import <WebCore/ApplicationCache.h> #import <WebCore/ApplicationCacheStorage.h> +#import <WebCore/SecurityOrigin.h> +#import <wtf/RetainPtr.h> using namespace WebCore; @@ -58,6 +63,27 @@ using namespace WebCore; cacheStorage().deleteAllEntries(); } ++ (void)deleteCacheForOrigin:(WebSecurityOrigin *)origin +{ + ApplicationCache::deleteCacheForOrigin([origin _core]); +} + ++ (NSArray *)originsWithCache +{ + HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> coreOrigins; + cacheStorage().getOriginsWithCache(coreOrigins); + + NSMutableArray *webOrigins = [[[NSMutableArray alloc] initWithCapacity:coreOrigins.size()] autorelease]; + + HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator end = coreOrigins.end(); + for (HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator it = coreOrigins.begin(); it != end; ++it) { + RetainPtr<WebSecurityOrigin> webOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:(*it).get()]); + [webOrigins addObject:webOrigin.get()]; + } + + return webOrigins; +} + @end #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h index 3129fae..004d49b 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -164,7 +164,7 @@ public: #endif #if ENABLE(FULLSCREEN_API) - virtual bool supportsFullScreenForElement(const WebCore::Element*); + virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard); virtual void enterFullScreenForElement(WebCore::Element*); virtual void exitFullScreenForElement(WebCore::Element*); #endif @@ -180,7 +180,7 @@ public: virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; #if ENABLE(CONTEXT_MENUS) - virtual void showContextMenu() { } + virtual void showContextMenu(); #endif private: WebView *m_webView; diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 99b817b..6bf116b 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -51,14 +51,18 @@ #import <WebCore/BlockExceptions.h> #import <WebCore/Console.h> #import <WebCore/Cursor.h> +#import <WebCore/ContextMenu.h> +#import <WebCore/ContextMenuController.h> #import <WebCore/Element.h> #import <WebCore/FileChooser.h> #import <WebCore/FloatRect.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoadRequest.h> +#import <WebCore/FrameView.h> #import <WebCore/HTMLNames.h> #import <WebCore/HitTestResult.h> #import <WebCore/Icon.h> +#import <WebCore/IntPoint.h> #import <WebCore/IntRect.h> #import <WebCore/NavigationAction.h> #import <WebCore/Page.h> @@ -174,9 +178,16 @@ FloatRect WebChromeClient::pageRect() float WebChromeClient::scaleFactor() { - if (NSWindow *window = [m_webView window]) - return [window userSpaceScaleFactor]; + NSWindow *window = [m_webView window]; +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + if (window) + return [window backingScaleFactor]; + return [[NSScreen mainScreen] backingScaleFactor]; +#else + if (window) + return [window userSpaceScaleFactor]; return [[NSScreen mainScreen] userSpaceScaleFactor]; +#endif } void WebChromeClient::focus() @@ -876,6 +887,35 @@ PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebC return adoptRef(new SearchPopupMenuMac(client)); } +#if ENABLE(CONTEXT_MENUS) +void WebChromeClient::showContextMenu() +{ + Page* page = [m_webView page]; + if (!page) + return; + + ContextMenuController* controller = page->contextMenuController(); + Node* node = controller->hitTestResult().innerNonSharedNode(); + if (!node) + return; + Frame* frame = node->document()->frame(); + if (!frame) + return; + FrameView* frameView = frame->view(); + if (!frameView) + return; + NSView* view = frameView->documentView(); + + IntPoint point = frameView->contentsToWindow(controller->hitTestResult().point()); + NSPoint nsScreenPoint = [view convertPoint:point toView:nil]; + // Show the contextual menu for this event. + NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1]; + NSMenu* nsMenu = [view menuForEvent:event]; + if (nsMenu) + [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view]; +} +#endif + #if USE(ACCELERATED_COMPOSITING) void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) @@ -938,12 +978,12 @@ void WebChromeClient::exitFullscreenForNode(Node*) #if ENABLE(FULLSCREEN_API) -bool WebChromeClient::supportsFullScreenForElement(const Element* element) +bool WebChromeClient::supportsFullScreenForElement(const Element* element, bool withKeyboard) { - SEL selector = @selector(webView:supportsFullScreenForElement:); + SEL selector = @selector(webView:supportsFullScreenForElement:withKeyboard:); if ([[m_webView UIDelegate] respondsToSelector:selector]) - return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element))); - return [m_webView _supportsFullScreenForElement:const_cast<WebCore::Element*>(element)]; + return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element)), withKeyboard); + return [m_webView _supportsFullScreenForElement:const_cast<WebCore::Element*>(element) withKeyboard:withKeyboard]; } void WebChromeClient::enterFullScreenForElement(Element* element) diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h index 1fa132a..412cb45 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -27,11 +27,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#import <WebCore/Editor.h> +#import "CorrectionPanel.h" #import <WebCore/EditorClient.h> #import <WebCore/TextCheckerClient.h> -#import <wtf/RetainPtr.h> #import <wtf/Forward.h> +#import <wtf/RetainPtr.h> #import <wtf/Vector.h> @class WebView; @@ -140,10 +140,10 @@ public: virtual void setInputMethodState(bool enabled); virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&); #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) - virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, const WTF::Vector<WTF::String>& alternativeReplacementStrings, WebCore::Editor*); + virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings); virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel); - virtual bool isShowingCorrectionPanel(); - virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const WTF::String& replacedString, const WTF::String& replacementString); + virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel); + virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const String& replacedString, const String& replacementString); #endif private: void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo); @@ -154,8 +154,6 @@ private: bool m_haveUndoRedoOperations; #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) - BOOL m_correctionPanelIsShown; - BOOL m_correctionPanelIsDismissedExternally; - WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissingCorrectionPanel; + CorrectionPanel m_correctionPanel; #endif }; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index 69dd574..c205ef6 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -74,7 +74,6 @@ #endif using namespace WebCore; -using namespace WTF; using namespace HTMLNames; @@ -202,9 +201,6 @@ WebEditorClient::WebEditorClient(WebView *webView) : m_webView(webView) , m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease]) , m_haveUndoRedoOperations(false) -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) - , m_correctionPanelIsShown(false) -#endif { } @@ -625,7 +621,7 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) { Frame* frame = event->target()->toNode()->document()->frame(); WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView]; - if ([webHTMLView _interceptEditingKeyEvent:event shouldSaveCommand:NO]) + if ([webHTMLView _interpretKeyEvent:event savingCommands:NO]) event->setDefaultHandled(); } @@ -633,7 +629,7 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event) { Frame* frame = event->target()->toNode()->document()->frame(); WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView]; - if ([webHTMLView _interceptEditingKeyEvent:event shouldSaveCommand:YES]) + if ([webHTMLView _interpretKeyEvent:event savingCommands:YES]) event->setDefaultHandled(); } @@ -891,73 +887,25 @@ void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammar } #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) -void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings, Editor* editor) { - dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored); - - // Need to explicitly use these local NSString objects, because the C++ references may be invalidated by the time the block below is executed. - NSString *replacedStringAsNSString = replacedString; - NSString *replacementStringAsNSString = replacementString; - - m_correctionPanelIsShown = YES; - m_correctionPanelIsDismissedExternally = NO; - m_reasonForDismissingCorrectionPanel = ReasonForDismissingCorrectionPanelIgnored; - - NSCorrectionBubbleType bubbleType = correctionBubbleType(panelType); - NSMutableArray *alternativeStrings = nil; - if (!alternativeReplacementStrings.isEmpty()) { - size_t size = alternativeReplacementStrings.size(); - alternativeStrings = [NSMutableArray arrayWithCapacity:size]; - for (size_t i = 0; i < size; ++i) - [alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]]; - } - NSSpellChecker *spellChecker = [NSSpellChecker sharedSpellChecker]; - [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxOfReplacedString view:m_webView completionHandler:^(NSString *acceptedString) { - switch (bubbleType) { - case NSCorrectionBubbleTypeCorrection: - if (acceptedString) - [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()]; - else { - if (!m_correctionPanelIsDismissedExternally || m_reasonForDismissingCorrectionPanel == ReasonForDismissingCorrectionPanelCancelled) - [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()]; - else - [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()]; - } - break; - case NSCorrectionBubbleTypeReversion: - if (acceptedString) - [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replacedStringAsNSString forWord:acceptedString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()]; - break; - case NSCorrectionBubbleTypeGuesses: - if (acceptedString) - [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]]; - break; - } - editor->handleCorrectionPanelResult(String(acceptedString)); - }]; +void WebEditorClient::showCorrectionPanel(CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) +{ + m_correctionPanel.show(m_webView, panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings); } void WebEditorClient::dismissCorrectionPanel(ReasonForDismissingCorrectionPanel reasonForDismissing) { - if (isShowingCorrectionPanel()) { - m_correctionPanelIsDismissedExternally = YES; - m_reasonForDismissingCorrectionPanel = reasonForDismissing; - if (reasonForDismissing == ReasonForDismissingCorrectionPanelAccepted) - [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_webView]; - else - [[NSSpellChecker sharedSpellChecker] cancelCorrectionBubbleForView:m_webView]; - m_correctionPanelIsShown = NO; - } + m_correctionPanel.dismiss(reasonForDismissing); } -bool WebEditorClient::isShowingCorrectionPanel() +String WebEditorClient::dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel reasonForDismissing) { - return m_correctionPanelIsShown; + return m_correctionPanel.dismissSoon(reasonForDismissing); } void WebEditorClient::recordAutocorrectionResponse(EditorClient::AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString) { - NSCorrectionResponse spellCheckerResponse = responseType == EditorClient::AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited; - [[NSSpellChecker sharedSpellChecker] recordResponse:spellCheckerResponse toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]]; + NSCorrectionResponse response = responseType == EditorClient::AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited; + CorrectionPanel::recordAutocorrectionResponse(m_webView, response, replacedString, replacementString); } #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index c484729..4fe5664 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -216,7 +216,7 @@ private: virtual void showMediaPlayerProxyPlugin(WebCore::Widget*); #endif - virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WTF::String& mimeType); + virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages); virtual WTF::String overrideMediaType() const; virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index a558d83..92c2b03 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1454,7 +1454,7 @@ void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long identif [kit(oldPage) _removeObjectForIdentifier:identifier]; } -ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType) +ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages) { BEGIN_BLOCK_OBJC_EXCEPTIONS; @@ -1491,18 +1491,25 @@ ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const if (type.isEmpty()) return ObjectContentFrame; // Go ahead and hope that we can display the content. - if (MIMETypeRegistry::isSupportedImageMIMEType(type)) - return ObjectContentImage; - WebBasePluginPackage *package = [getWebView(m_webFrame.get()) _pluginForMIMEType:type]; + ObjectContentType plugInType = ObjectContentNone; if (package) { #if ENABLE(NETSCAPE_PLUGIN_API) if ([package isKindOfClass:[WebNetscapePluginPackage class]]) - return ObjectContentNetscapePlugin; + plugInType = ObjectContentNetscapePlugin; + else #endif - ASSERT([package isKindOfClass:[WebPluginPackage class]]); - return ObjectContentOtherPlugin; + { + ASSERT([package isKindOfClass:[WebPluginPackage class]]); + plugInType = ObjectContentOtherPlugin; + } } + + if (MIMETypeRegistry::isSupportedImageMIMEType(type)) + return shouldPreferPlugInsForImages && plugInType != ObjectContentNone ? plugInType : ObjectContentImage; + + if (plugInType != ObjectContentNone) + return plugInType; if ([m_webFrame->_private->webFrameView _viewClassForMIMEType:type]) return ObjectContentFrame; diff --git a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h index 3f9df13..a557ab5 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h @@ -32,6 +32,9 @@ class WebIconDatabaseClient : public WebCore::IconDatabaseClient { public: virtual bool performImport(); - virtual void dispatchDidRemoveAllIcons(); - virtual void dispatchDidAddIconForPageURL(const WTF::String& pageURL); + virtual void didRemoveAllIcons(); + virtual void didImportIconURLForPageURL(const String&); + virtual void didImportIconDataForPageURL(const String&); + virtual void didChangeIconForPageURL(const String&); + virtual void didFinishURLImport(); }; diff --git a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm index 3651dea..8214d02 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm @@ -41,14 +41,14 @@ bool WebIconDatabaseClient::performImport() return result; } -void WebIconDatabaseClient::dispatchDidRemoveAllIcons() +void WebIconDatabaseClient::didRemoveAllIcons() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [[WebIconDatabase sharedIconDatabase] _sendDidRemoveAllIconsNotification]; [pool drain]; } -void WebIconDatabaseClient::dispatchDidAddIconForPageURL(const WTF::String& pageURL) +void WebIconDatabaseClient::didImportIconURLForPageURL(const String& pageURL) { // This is a quick notification that is likely to fire in a rapidly iterating loop // Therefore we let WebCore handle autorelease by draining its pool "from time to time" @@ -56,4 +56,19 @@ void WebIconDatabaseClient::dispatchDidAddIconForPageURL(const WTF::String& page [[WebIconDatabase sharedIconDatabase] _sendNotificationForURL:pageURL]; } +void WebIconDatabaseClient::didImportIconDataForPageURL(const String& pageURL) +{ + // WebKit1 only has a single "icon did change" notification. + didImportIconURLForPageURL(pageURL); +} +void WebIconDatabaseClient::didChangeIconForPageURL(const String& pageURL) +{ + // WebKit1 only has a single "icon did change" notification. + didImportIconURLForPageURL(pageURL); +} + +void WebIconDatabaseClient::didFinishURLImport() +{ +} + #endif // ENABLE(ICONDATABASE) diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h index 108c2cc..7d09109 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h @@ -31,7 +31,9 @@ #import <WebCore/PlatformString.h> #import <wtf/Forward.h> +#import <wtf/HashMap.h> #import <wtf/RetainPtr.h> +#import <wtf/text/StringHash.h> #ifdef __OBJC__ @class WebInspectorWindowController; @@ -67,12 +69,17 @@ public: void releaseFrontendPage(); + void saveSessionSetting(const String& key, const String& value); + void loadSessionSetting(const String& key, String* value); + private: WTF::PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings(); WebView *m_webView; RetainPtr<WebNodeHighlighter> m_highlighter; WebCore::Page* m_frontendPage; + + WTF::HashMap<WTF::String, WTF::String> m_sessionSettings; }; @@ -95,6 +102,9 @@ public: virtual void setAttachedWindowHeight(unsigned height); virtual void inspectedURLChanged(const WTF::String& newURL); + virtual void saveSessionSetting(const String& key, const String& value); + virtual void loadSessionSetting(const String& key, String* value); + private: void updateWindowTitle() const; diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index d5a1d95..9b0c893 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -65,6 +65,7 @@ using namespace WebCore; - (BOOL)attached; - (void)setFrontendClient:(WebInspectorFrontendClient*)frontendClient; - (void)setInspectorClient:(WebInspectorClient*)inspectorClient; +- (WebInspectorClient*)inspectorClient; - (void)setAttachedWindowHeight:(unsigned)height; - (void)destroyInspectorView:(bool)notifyInspectorController; @end @@ -102,10 +103,10 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon [windowController.get() setInspectorClient:this]; m_frontendPage = core([windowController.get() webView]); - WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings()); - m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient); - - [[m_webView inspector] setFrontend:[[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient]]; + OwnPtr<WebInspectorFrontendClient> frontendClient = adoptPtr(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings())); + RetainPtr<WebInspectorFrontend> webInspectorFrontend(AdoptNS, [[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient.get()]); + [[m_webView inspector] setFrontend:webInspectorFrontend.get()]; + m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release()); } void WebInspectorClient::highlight(Node* node) @@ -201,6 +202,20 @@ void WebInspectorFrontendClient::inspectedURLChanged(const String& newURL) updateWindowTitle(); } +void WebInspectorFrontendClient::saveSessionSetting(const String& key, const String& value) +{ + WebInspectorClient* client = [m_windowController.get() inspectorClient]; + if (client) + client->saveSessionSetting(key, value); +} + +void WebInspectorFrontendClient::loadSessionSetting(const String& key, String* value) +{ + WebInspectorClient* client = [m_windowController.get() inspectorClient]; + if (client) + client->loadSessionSetting(key, value); +} + void WebInspectorFrontendClient::updateWindowTitle() const { NSString *title = [NSString stringWithFormat:UI_STRING_INTERNAL("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_inspectedURL]; @@ -422,6 +437,11 @@ void WebInspectorFrontendClient::updateWindowTitle() const _inspectorClient = inspectorClient; } +- (WebInspectorClient*)inspectorClient +{ + return _inspectorClient; +} + - (void)setAttachedWindowHeight:(unsigned)height { if (!_attachedToInspectedWebView) diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h index ed2ff77..7728699 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h +++ b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h @@ -1,29 +1,26 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. */ typedef enum { @@ -34,14 +31,11 @@ typedef enum { #ifdef __OBJC__ -#import <WebCore/WebCoreKeyGenerator.h> +@interface WebKeyGenerator : NSObject -@interface WebKeyGenerator : WebCoreKeyGenerator -{ - NSArray *strengthMenuItemTitles; -} -+ (void)createSharedGenerator; ++ (WebKeyGenerator *)sharedGenerator; - (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data; + @end #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m deleted file mode 100644 index ea1526f..0000000 --- a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <WebKit/WebKeyGenerator.h> - -#import "WebLocalizableStringsInternal.h" -#import <WebKitSystemInterface.h> -#import <wtf/Assertions.h> - -@implementation WebKeyGenerator - -+ (void)createSharedGenerator -{ - if (![self sharedGenerator]) { - [[[self alloc] init] release]; - } - ASSERT([[self sharedGenerator] isKindOfClass:self]); -} - -- (void)dealloc -{ - [strengthMenuItemTitles release]; - [super dealloc]; -} - -- (NSArray *)strengthMenuItemTitles -{ - if (!strengthMenuItemTitles) { - strengthMenuItemTitles = [[NSArray alloc] initWithObjects: - UI_STRING_INTERNAL("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu"), - UI_STRING_INTERNAL("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu"), - UI_STRING_INTERNAL("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu"), nil]; - } - return strengthMenuItemTitles; -} - -- (NSString *)signedPublicKeyAndChallengeStringWithStrengthIndex:(unsigned)index challenge:(NSString *)challenge pageURL:(NSURL *)pageURL -{ - // This switch statement must always be synced with the UI strings returned by strengthMenuItemTitles. - UInt32 keySize; - switch (index) { - case 0: - keySize = 2048; - break; - case 1: - keySize = 1024; - break; - case 2: - keySize = 512; - break; - default: - return nil; - } - - NSString *keyDescription = [NSString stringWithFormat:UI_STRING_INTERNAL("Key from %@", "name of keychain key generated by the KEYGEN tag"), [pageURL host]]; - return [(NSString *)WKSignedPublicKeyAndChallengeString(keySize, (CFStringRef)challenge, (CFStringRef)keyDescription) autorelease]; -} - -static inline WebCertificateParseResult toWebCertificateParseResult(WKCertificateParseResult result) -{ - switch (result) { - case WKCertificateParseResultSucceeded: - return WebCertificateParseResultSucceeded; - case WKCertificateParseResultFailed: - return WebCertificateParseResultFailed; - case WKCertificateParseResultPKCS7: - return WebCertificateParseResultPKCS7; - } - - ASSERT_NOT_REACHED(); - return WebCertificateParseResultFailed; -} - -- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data -{ - return toWebCertificateParseResult(WKAddCertificatesToKeychainFromData([data bytes], [data length])); -} - -@end diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm new file mode 100644 index 0000000..3e535ea --- /dev/null +++ b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2005, 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebKit/WebKeyGenerator.h> + +#import <WebKitSystemInterface.h> +#import <wtf/Assertions.h> + +@implementation WebKeyGenerator + ++ (WebKeyGenerator *)sharedGenerator +{ + static WebKeyGenerator *sharedGenerator = [[WebKeyGenerator alloc] init]; + return sharedGenerator; +} + +static inline WebCertificateParseResult toWebCertificateParseResult(WKCertificateParseResult result) +{ + // FIXME: WebKeyGenerator is not used in WebKit, and this code should be moved to Safari. + + switch (result) { + case WKCertificateParseResultSucceeded: + return WebCertificateParseResultSucceeded; + case WKCertificateParseResultFailed: + return WebCertificateParseResultFailed; + case WKCertificateParseResultPKCS7: + return WebCertificateParseResultPKCS7; + } + + ASSERT_NOT_REACHED(); + return WebCertificateParseResultFailed; +} + +- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data +{ + return toWebCertificateParseResult(WKAddCertificatesToKeychainFromData([data bytes], [data length])); +} + +@end diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index 30cadcf..29bdb8a 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -80,7 +80,7 @@ private: virtual WTF::String contextMenuItemTagIgnoreSpelling(); virtual WTF::String contextMenuItemTagLearnSpelling(); virtual WTF::String contextMenuItemTagSearchWeb(); - virtual WTF::String contextMenuItemTagLookUpInDictionary(); + virtual WTF::String contextMenuItemTagLookUpInDictionary(const WTF::String& selectedString); virtual WTF::String contextMenuItemTagOpenLink(); virtual WTF::String contextMenuItemTagIgnoreGrammar(); virtual WTF::String contextMenuItemTagSpellingMenu(); @@ -153,6 +153,10 @@ private: virtual WTF::String crashedPluginText(); virtual WTF::String multipleFileUploadText(unsigned numberOfFiles); virtual WTF::String unknownFileSizeText(); + virtual WTF::String keygenMenuItem512(); + virtual WTF::String keygenMenuItem1024(); + virtual WTF::String keygenMenuItem2048(); + virtual WTF::String keygenKeychainItemName(const WTF::String& host); virtual WTF::String imageTitle(const WTF::String& filename, const WebCore::IntSize& size); virtual WTF::String mediaElementLoadingStateText(); virtual WTF::String mediaElementLiveBroadcastStateText(); diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index 94fc572..59ba436 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -274,9 +274,13 @@ String WebPlatformStrategies::contextMenuItemTagSearchWeb() return UI_STRING_INTERNAL("Search in Google", "Search in Google context menu item"); } -String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary() +String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary(const String& selectedString) { +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) return UI_STRING_INTERNAL("Look Up in Dictionary", "Look Up in Dictionary context menu item"); +#else + return [NSString stringWithFormat:UI_STRING_INTERNAL("Look Up “%@”", "Look Up context menu item with selected word"), (NSString *)selectedString]; +#endif } String WebPlatformStrategies::contextMenuItemTagOpenLink() @@ -666,6 +670,26 @@ String WebPlatformStrategies::unknownFileSizeText() return UI_STRING_INTERNAL("Unknown", "Unknown filesize FTP directory listing item"); } +String WebPlatformStrategies::keygenMenuItem512() +{ + return UI_STRING_INTERNAL("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu"); +} + +String WebPlatformStrategies::keygenMenuItem1024() +{ + return UI_STRING_INTERNAL("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu"); +} + +String WebPlatformStrategies::keygenMenuItem2048() +{ + return UI_STRING_INTERNAL("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu"); +} + +String WebPlatformStrategies::keygenKeychainItemName(const WTF::String& host) +{ + return [NSString stringWithFormat:UI_STRING_INTERNAL("Key from %@", "Name of keychain key generated by the KEYGEN tag"), (NSString *)host]; +} + String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size) { #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm index 385d869..131a1ac 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm @@ -46,23 +46,28 @@ using namespace WebCore; RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL([url absoluteURL])); origin->ref(); - _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin.get()); + _private = reinterpret_cast<WebSecurityOriginPrivate *>(origin.get()); return self; } -- (NSString*)protocol +- (NSString *)protocol { return reinterpret_cast<SecurityOrigin*>(_private)->protocol(); } -- (NSString*)host +- (NSString *)host { return reinterpret_cast<SecurityOrigin*>(_private)->host(); } +- (NSString *)databaseIdentifier +{ + return reinterpret_cast<SecurityOrigin*>(_private)->databaseIdentifier(); +} + // Deprecated. Use host instead. This needs to stay here until we ship a new Safari. -- (NSString*)domain +- (NSString *)domain { return [self host]; } @@ -111,7 +116,7 @@ using namespace WebCore; return nil; origin->ref(); - _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin); + _private = reinterpret_cast<WebSecurityOriginPrivate *>(origin); return self; } diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h index 2973d92..a784aba 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h +++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h @@ -37,8 +37,10 @@ - (id)initWithURL:(NSURL *)url; -- (NSString*)protocol; -- (NSString*)host; +- (NSString *)protocol; +- (NSString *)host; + +- (NSString *)databaseIdentifier; // Returns zero if the port is the default port for the protocol, non-zero otherwise. - (unsigned short)port; diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 6504f17..1b212a7 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -63,6 +63,7 @@ void InitWebCoreSystemInterface(void) INIT(GetHTTPPipeliningPriority); INIT(GetMIMETypeForExtension); INIT(GetNSURLResponseLastModifiedDate); + INIT(SignedPublicKeyAndChallengeString); INIT(GetPreferredExtensionForMIMEType); INIT(GetWheelEventDeltas); INIT(HitTestMediaUIPart); @@ -128,6 +129,7 @@ void InitWebCoreSystemInterface(void) INIT(MakeScrollbarPainter); INIT(ScrollbarPainterSetDelegate); INIT(ScrollbarPainterPaint); + INIT(ScrollbarPainterForceFlashScrollers); INIT(ScrollbarThickness); INIT(ScrollbarMinimumThumbLength); INIT(ScrollbarMinimumTotalLengthNeededForThumb); @@ -168,11 +170,17 @@ void InitWebCoreSystemInterface(void) INIT(UnregisterUniqueIdForElement); INIT(CreatePrivateStorageSession); INIT(CopyRequestWithStorageSession); - INIT(CreatePrivateInMemoryHTTPCookieStorage); + INIT(CopyHTTPCookieStorage); INIT(GetHTTPCookieAcceptPolicy); INIT(HTTPCookiesForURL); INIT(SetHTTPCookiesForURL); INIT(DeleteHTTPCookie); + INIT(GetCFURLResponseMIMEType); + INIT(GetCFURLResponseURL); + INIT(GetCFURLResponseHTTPResponse); + INIT(CopyCFURLResponseSuggestedFilename); + INIT(SetCFURLResponseMIMEType); + didInit = true; } diff --git a/Source/WebKit/mac/WebKit.exp b/Source/WebKit/mac/WebKit.exp index 7c20307..ec8f74b 100644 --- a/Source/WebKit/mac/WebKit.exp +++ b/Source/WebKit/mac/WebKit.exp @@ -6,6 +6,7 @@ .objc_class_name_WebCoreStatistics .objc_class_name_WebDataSource .objc_class_name_WebDatabaseManager +.objc_class_name_WebStorageManager .objc_class_name_WebDefaultPolicyDelegate .objc_class_name_WebDeviceOrientation .objc_class_name_WebDeviceOrientationProviderMock @@ -114,6 +115,8 @@ _WebReportError _WebScriptErrorDescriptionKey _WebScriptErrorDomain _WebScriptErrorLineNumberKey +_WebStorageDirectoryDefaultsKey +_WebStorageDidModifyOriginNotification _WebURLNamePboardType _WebURLPboardType _WebViewDidBeginEditingNotification diff --git a/Source/WebKit/mac/WebKitPrefix.h b/Source/WebKit/mac/WebKitPrefix.h index fe0f214..6d57815 100644 --- a/Source/WebKit/mac/WebKitPrefix.h +++ b/Source/WebKit/mac/WebKitPrefix.h @@ -79,12 +79,6 @@ typedef float CGFloat; #define WTF_USE_JSC 1 #define WTF_USE_V8 0 -#ifdef __cplusplus -#include <wtf/FastMalloc.h> -#endif - -#include <wtf/DisallowCType.h> - /* Work around bug with C++ library that screws up Objective-C++ when exception support is disabled. */ #undef try #undef catch @@ -92,3 +86,11 @@ typedef float CGFloat; #define JS_EXPORTDATA #define JS_EXPORTCLASS #define WEBKIT_EXPORTDATA +#define WTF_EXPORT_PRIVATE +#define JS_EXPORT_PRIVATE + +#ifdef __cplusplus +#include <wtf/FastMalloc.h> +#endif + +#include <wtf/DisallowCType.h> diff --git a/Source/WebKit/mac/WebView/WebClipView.mm b/Source/WebKit/mac/WebView/WebClipView.mm index ced5d8d..280695e 100644 --- a/Source/WebKit/mac/WebView/WebClipView.mm +++ b/Source/WebKit/mac/WebView/WebClipView.mm @@ -51,6 +51,13 @@ using namespace WebCore; - (void)_immediateScrollToPoint:(NSPoint)newOrigin; @end +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) +@interface NSWindow (WebNSWindowDetails) +- (void)_disableDelayedWindowDisplay; +- (void)_enableDelayedWindowDisplay; +@end +#endif + @implementation WebClipView - (id)initWithFrame:(NSRect)frame @@ -96,7 +103,17 @@ using namespace WebCore; - (void)_immediateScrollToPoint:(NSPoint)newOrigin { _isScrolling = YES; + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + [[self window] _disableDelayedWindowDisplay]; +#endif + [super _immediateScrollToPoint:newOrigin]; + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + [[self window] _enableDelayedWindowDisplay]; +#endif + _isScrolling = NO; } #endif diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index e792539..584b09e 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -579,51 +579,14 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) } if (contentsOnly) - _private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect)); + view->paintContents(&context, enclosingIntRect(rect)); else - _private->coreFrame->view()->paint(&context, enclosingIntRect(rect)); + view->paint(&context, enclosingIntRect(rect)); if (shouldFlatten) view->setPaintBehavior(oldBehavior); } -// Used by pagination code called from AppKit when a standalone web page is printed. -- (NSArray*)_computePageRectsWithPrintScaleFactor:(float)printScaleFactor pageSize:(NSSize)pageSize -{ - NSMutableArray* pages = [NSMutableArray arrayWithCapacity:5]; - if (printScaleFactor <= 0) { - LOG_ERROR("printScaleFactor has bad value %.2f", printScaleFactor); - return pages; - } - - if (!_private->coreFrame || !_private->coreFrame->document() || !_private->coreFrame->view()) return pages; - RenderView* root = toRenderView(_private->coreFrame->document()->renderer()); - if (!root) return pages; - - FrameView* view = _private->coreFrame->view(); - if (!view) - return pages; - - NSView* documentView = view->documentView(); - if (!documentView) - return pages; - - float docWidth = root->docWidth(); - float docHeight = root->docHeight(); - - float printWidth = root->style()->isHorizontalWritingMode() ? docWidth / printScaleFactor : pageSize.width; - float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : docHeight / printScaleFactor; - - PrintContext printContext(_private->coreFrame); - printContext.computePageRectsWithPageSize(FloatSize(printWidth, printHeight), true); - - const Vector<IntRect>& pageRects = printContext.pageRects(); - const size_t pageCount = pageRects.size(); - for (size_t pageNumber = 0; pageNumber < pageCount; ++pageNumber) - [pages addObject: [NSValue valueWithRect: NSRect(pageRects[pageNumber])]]; - return pages; -} - - (BOOL)_getVisibleRect:(NSRect*)rect { ASSERT_ARG(rect, rect); @@ -1347,10 +1310,18 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (BOOL)hasSpellingMarker:(int)from length:(int)length { - Frame* coreFrame = _private->coreFrame; + Frame* coreFrame = core(self); + if (!coreFrame) + return NO; + return coreFrame->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length); +} + +- (BOOL)hasGrammarMarker:(int)from length:(int)length +{ + Frame* coreFrame = core(self); if (!coreFrame) return NO; - return coreFrame->editor()->selectionStartHasSpellingMarkerFor(from, length); + return coreFrame->editor()->selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length); } - (id)accessibilityRoot @@ -1358,8 +1329,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) #if HAVE(ACCESSIBILITY) if (!AXObjectCache::accessibilityEnabled()) { AXObjectCache::enableAccessibility(); - if ([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue]) - AXObjectCache::enableEnhancedUserInterfaceAccessibility(); + AXObjectCache::setEnhancedUserInterfaceAccessibility([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue]); } if (!_private->coreFrame || !_private->coreFrame->document()) @@ -1387,6 +1357,41 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) coreFrame->loader()->setOpener(0); } +// Used by pagination code called from AppKit when a standalone web page is printed. +- (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printScaleFactor pageSize:(NSSize)pageSize +{ + if (printScaleFactor <= 0) { + LOG_ERROR("printScaleFactor has bad value %.2f", printScaleFactor); + return [NSArray array]; + } + + if (!_private->coreFrame) + return [NSArray array]; + if (!_private->coreFrame->document()) + return [NSArray array]; + if (!_private->coreFrame->view()) + return [NSArray array]; + if (!_private->coreFrame->view()->documentView()) + return [NSArray array]; + + RenderView* root = toRenderView(_private->coreFrame->document()->renderer()); + if (!root) + return [NSArray array]; + + float printWidth = root->style()->isHorizontalWritingMode() ? root->docWidth() / printScaleFactor : pageSize.width; + float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : root->docHeight() / printScaleFactor; + + PrintContext printContext(_private->coreFrame); + printContext.computePageRectsWithPageSize(FloatSize(printWidth, printHeight), true); + const Vector<IntRect>& pageRects = printContext.pageRects(); + + size_t size = pageRects.size(); + NSMutableArray *pages = [NSMutableArray arrayWithCapacity:size]; + for (size_t i = 0; i < size; ++i) + [pages addObject:[NSValue valueWithRect:NSRect(pageRects[i])]]; + return pages; +} + @end @implementation WebFrame diff --git a/Source/WebKit/mac/WebView/WebFrameInternal.h b/Source/WebKit/mac/WebView/WebFrameInternal.h index 7e8016a..c13b721 100644 --- a/Source/WebKit/mac/WebView/WebFrameInternal.h +++ b/Source/WebKit/mac/WebView/WebFrameInternal.h @@ -125,7 +125,6 @@ WebView *getWebView(WebFrame *webFrame); - (BOOL)_needsLayout; - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly; - (BOOL)_getVisibleRect:(NSRect*)rect; -- (NSArray*)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize; - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string; - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture; diff --git a/Source/WebKit/mac/WebView/WebFramePrivate.h b/Source/WebKit/mac/WebView/WebFramePrivate.h index 75b57c7..82b3c4a 100644 --- a/Source/WebKit/mac/WebView/WebFramePrivate.h +++ b/Source/WebKit/mac/WebView/WebFramePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -69,8 +69,9 @@ typedef enum { } WebFrameLoadType; @interface WebFrame (WebPrivate) + - (BOOL)_isDescendantOfFrame:(WebFrame *)frame; -- (void)_setShouldCreateRenderers:(BOOL)f; +- (void)_setShouldCreateRenderers:(BOOL)shouldCreateRenderers; - (NSColor *)_bodyBackgroundColor; - (BOOL)_isFrameSet; - (BOOL)_firstLayoutDone; @@ -142,11 +143,15 @@ typedef enum { // Returns whether there is a spelling marker in the specified range of the focused node. - (BOOL)hasSpellingMarker:(int)location length:(int)length; +- (BOOL)hasGrammarMarker:(int)from length:(int)length; + // The top of the accessibility tree. - (id)accessibilityRoot; // Clears frame opener. This is executed between layout tests runs - (void)_clearOpener; +// Printing. +- (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize; @end diff --git a/Source/WebKit/mac/WebView/WebFrameView.mm b/Source/WebKit/mac/WebView/WebFrameView.mm index 801c1f4..c42738c 100644 --- a/Source/WebKit/mac/WebView/WebFrameView.mm +++ b/Source/WebKit/mac/WebView/WebFrameView.mm @@ -308,7 +308,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl WebCore::notifyHistoryItemChanged = WKNotifyHistoryItemChanged; [WebViewFactory createSharedFactory]; - [WebKeyGenerator createSharedGenerator]; // FIXME: Remove the NSAppKitVersionNumberWithDeferredWindowDisplaySupport check once // once AppKit's Deferred Window Display support is available. diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.h b/Source/WebKit/mac/WebView/WebFullScreenController.h index f867dc2..0f55bd0 100644 --- a/Source/WebKit/mac/WebView/WebFullScreenController.h +++ b/Source/WebKit/mac/WebView/WebFullScreenController.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.mm b/Source/WebKit/mac/WebView/WebFullScreenController.mm index 5b8b496..3cc8355 100644 --- a/Source/WebKit/mac/WebView/WebFullScreenController.mm +++ b/Source/WebKit/mac/WebView/WebFullScreenController.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/Source/WebKit/mac/WebView/WebHTMLRepresentation.h b/Source/WebKit/mac/WebView/WebHTMLRepresentation.h index 68f9bde..b714bf6 100644 --- a/Source/WebKit/mac/WebView/WebHTMLRepresentation.h +++ b/Source/WebKit/mac/WebView/WebHTMLRepresentation.h @@ -57,6 +57,7 @@ + (NSArray *)supportedMIMETypes; + (NSArray *)supportedNonImageMIMETypes; + (NSArray *)supportedImageMIMETypes; ++ (NSArray *)unsupportedTextMIMETypes; - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset; diff --git a/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm b/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm index fad0a4a..03edd5d 100644 --- a/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -113,6 +113,12 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) return staticSupportedImageMIMETypes.get(); } ++ (NSArray *)unsupportedTextMIMETypes +{ + DEFINE_STATIC_LOCAL(RetainPtr<NSArray>, staticUnsupportedTextMIMETypes, (stringArray(MIMETypeRegistry::getUnsupportedTextMIMETypes()))); + return staticUnsupportedTextMIMETypes.get(); +} + - (id)init { self = [super init]; diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index 00f65bd..e611e2b 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -383,6 +383,7 @@ static CachedResourceClient* promisedDataClient() - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard inContext:(DOMRange *)context allowPlainText:(BOOL)allowPlainText; - (NSString *)_plainTextFromPasteboard:(NSPasteboard *)pasteboard; - (void)_pasteWithPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText; +- (void)_pasteAsPlainTextWithPasteboard:(NSPasteboard *)pasteboard; - (void)_removeMouseMovedObserverUnconditionally; - (void)_removeSuperviewObservers; - (void)_removeWindowObservers; @@ -461,11 +462,9 @@ static CachedResourceClient* promisedDataClient() struct WebHTMLViewInterpretKeyEventsParameters { KeyboardEvent* event; - BOOL eventWasHandled; - BOOL shouldSaveCommand; - // The Input Method may consume an event and not tell us, in - // which case we should not bubble the event up the DOM - BOOL consumedByIM; + bool eventInterpretationHadSideEffects; + bool shouldSaveCommands; + bool consumedByIM; }; @interface WebHTMLViewPrivate : NSObject { @@ -522,7 +521,6 @@ struct WebHTMLViewInterpretKeyEventsParameters { BOOL transparentBackground; WebHTMLViewInterpretKeyEventsParameters* interpretKeyEventsParameters; - BOOL receivedNOOP; WebDataSource *dataSource; WebCore::CachedImage* promisedDragTIFFDataSource; @@ -914,6 +912,32 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) [webView release]; } +- (void)_pasteAsPlainTextWithPasteboard:(NSPasteboard *)pasteboard +{ + WebView *webView = [[self _webView] retain]; + [webView _setInsertionPasteboard:pasteboard]; + + NSString *text = [self _plainTextFromPasteboard:pasteboard]; + if ([self _shouldReplaceSelectionWithText:text givenAction:WebViewInsertActionPasted]) + [[self _frame] _replaceSelectionWithText:text selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard]]; + + [webView _setInsertionPasteboard:nil]; + [webView release]; +} + +// This method is needed to support Mac OS X services. +- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pasteboard +{ + Frame* coreFrame = core([self _frame]); + if (!coreFrame) + return NO; + if (coreFrame->selection()->isContentRichlyEditable()) + [self _pasteWithPasteboard:pasteboard allowPlainText:YES]; + else + [self _pasteAsPlainTextWithPasteboard:pasteboard]; + return YES; +} + - (void)_removeMouseMovedObserverUnconditionally { if (!_private || !_private->observingMouseMovedNotifications) @@ -1169,21 +1193,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) + (NSArray *)unsupportedTextMIMETypes { - return [NSArray arrayWithObjects: - @"text/calendar", // iCal - @"text/x-calendar", - @"text/x-vcalendar", - @"text/vcalendar", - @"text/vcard", // vCard - @"text/x-vcard", - @"text/directory", - @"text/ldif", // Netscape Address Book - @"text/qif", // Quicken - @"text/x-qif", - @"text/x-csv", // CSV (for Address Book and Microsoft Outlook) - @"text/x-vcf", // vCard type used in Sun affinity app - @"text/rtf", // Rich Text Format - nil]; + return [WebHTMLRepresentation unsupportedTextMIMETypes]; } + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent @@ -1985,10 +1995,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) [self removeAllToolTips]; [_private clear]; - - Page* page = core([self _webView]); - if (page) - page->dragController()->setDraggingImageURL(KURL()); } - (BOOL)_hasHTMLDocument @@ -2608,6 +2614,7 @@ WEBCORE_COMMAND(yankAndSelect) [NSPasteboard _web_setFindPasteboardString:[self selectedString] withOwner:self]; } +// This method is needed to support Mac OS X services. - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types { [pasteboard declareTypes:types owner:[self _topHTMLView]]; @@ -3036,7 +3043,12 @@ WEBCORE_COMMAND(yankAndSelect) // We may have created the layer hosting view while outside the window. Update the scale factor // now that we have a window to get it from. if (_private->layerHostingView) { - CGFloat scaleFactor = [[self window] userSpaceScaleFactor]; + CGFloat scaleFactor; +#if !defined(BUILDING_ON_SNOW_LEOPARD) + scaleFactor = [[self window] backingScaleFactor]; +#else + scaleFactor = [[self window] userSpaceScaleFactor]; +#endif [[_private->layerHostingView layer] setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)]; } #endif @@ -5416,59 +5428,96 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [self _updateMouseoverWithFakeEvent]; } -- (BOOL)_interceptEditingKeyEvent:(KeyboardEvent*)event shouldSaveCommand:(BOOL)shouldSave +- (void)_executeSavedEditingCommands +{ + WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters; + if (!parameters || parameters->event->keypressCommands().isEmpty()) + return; + + // Avoid an infinite loop that would occur if executing a command appended it to event->keypressCommands() again. + bool wasSavingCommands = parameters->shouldSaveCommands; + parameters->shouldSaveCommands = false; + + const Vector<KeypressCommand>& commands = parameters->event->keypressCommands(); + + for (size_t i = 0; i < commands.size(); ++i) { + if (commands[i].commandName == "insertText:") + [self insertText:commands[i].text]; + else + [self doCommandBySelector:NSSelectorFromString(commands[i].commandName)]; + } + parameters->event->keypressCommands().clear(); + parameters->shouldSaveCommands = wasSavingCommands; +} + +- (BOOL)_interpretKeyEvent:(KeyboardEvent*)event savingCommands:(BOOL)savingCommands { - // Ask AppKit to process the key event -- it will call back with either insertText or doCommandBySelector. + ASSERT(core([self _frame]) == event->target()->toNode()->document()->frame()); + ASSERT(!savingCommands || event->keypressCommands().isEmpty()); // Save commands once for each event. + WebHTMLViewInterpretKeyEventsParameters parameters; - parameters.eventWasHandled = false; - parameters.shouldSaveCommand = shouldSave; + parameters.eventInterpretationHadSideEffects = false; + parameters.shouldSaveCommands = savingCommands; // If we're intercepting the initial IM call we assume that the IM has consumed the event, // and only change this assumption if one of the NSTextInput/Responder callbacks is used. // We assume the IM will *not* consume hotkey sequences - parameters.consumedByIM = !event->metaKey() && shouldSave; + parameters.consumedByIM = savingCommands && !event->metaKey(); - if (const PlatformKeyboardEvent* platformEvent = event->keyEvent()) { - NSEvent *macEvent = platformEvent->macEvent(); - if ([macEvent type] == NSKeyDown && [_private->completionController filterKeyDown:macEvent]) - return true; - - if ([macEvent type] == NSFlagsChanged) - return false; - - parameters.event = event; - _private->interpretKeyEventsParameters = ¶meters; - _private->receivedNOOP = NO; - const Vector<KeypressCommand>& commands = event->keypressCommands(); - bool hasKeypressCommand = !commands.isEmpty(); - - // FIXME: interpretKeyEvents doesn't match application key equivalents (such as Cmd+A), - // and sends noop: for those. As a result, we don't handle those from within WebCore, - // but send a full sequence of DOM events, including an unneeded keypress. - if (parameters.shouldSaveCommand || !hasKeypressCommand) - [self interpretKeyEvents:[NSArray arrayWithObject:macEvent]]; - else { - size_t size = commands.size(); - // Are there commands that would just cause text insertion if executed via Editor? - // WebKit doesn't have enough information about mode to decide how they should be treated, so we leave it upon WebCore - // to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated - // (e.g. Tab that inserts a Tab character, or Enter). - bool haveTextInsertionCommands = false; - for (size_t i = 0; i < size; ++i) { - if ([self coreCommandBySelector:NSSelectorFromString(commands[i].commandName)].isTextInsertion()) - haveTextInsertionCommands = true; - } - if (!haveTextInsertionCommands || platformEvent->type() == PlatformKeyboardEvent::Char) { - for (size_t i = 0; i < size; ++i) { - if (commands[i].commandName == "insertText:") - [self insertText:commands[i].text]; - else - [self doCommandBySelector:NSSelectorFromString(commands[i].commandName)]; - } - } + const PlatformKeyboardEvent* platformEvent = event->keyEvent(); + if (!platformEvent) + return NO; + + NSEvent *macEvent = platformEvent->macEvent(); + if ([macEvent type] == NSKeyDown && [_private->completionController filterKeyDown:macEvent]) + return YES; + + if ([macEvent type] == NSFlagsChanged) + return NO; + + parameters.event = event; + _private->interpretKeyEventsParameters = ¶meters; + const Vector<KeypressCommand>& commands = event->keypressCommands(); + + if (savingCommands) { + // AppKit will respond with a series of NSTextInput protocol method calls. There are three groups that we heuristically differentiate: + // 1. Key Bindings. Only doCommandBySelector: and insertText: calls will be made, which we save in the event for execution + // after DOM dispatch. This is safe, because neither returns a result, so there is no branching on AppKit side. + // 2. Plain text input. Here as well, we need to dispatch DOM events prior to inserting text, so we save the insertText: command. + // 3. Input method processing. An IM can make any NSTextInput calls, and can base its decisions on results it gets, so we must + // execute the calls immediately. DOM events like keydown are tweaked to have keyCode of 229, and canceling them has no effect. + // Unfortunately, there is no real difference between plain text input and IM processing - for example, AppKit queries hasMarkedText + // when typing with U.S. keyboard, and inserts marked text for dead keys. + [self interpretKeyEvents:[NSArray arrayWithObject:macEvent]]; + } else { + // Are there commands that could just cause text insertion if executed via Editor? + // WebKit doesn't have enough information about mode to decide how they should be treated, so we leave it upon WebCore + // to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated + // (e.g. Tab that inserts a Tab character, or Enter). + bool haveTextInsertionCommands = false; + for (size_t i = 0; i < commands.size(); ++i) { + if ([self coreCommandBySelector:NSSelectorFromString(commands[i].commandName)].isTextInsertion()) + haveTextInsertionCommands = true; } - _private->interpretKeyEventsParameters = 0; + // If there are no text insertion commands, default keydown handler is the right time to execute the commands. + // Keypress (Char event) handler is the latest opportunity to execute. + if (!haveTextInsertionCommands || platformEvent->type() == PlatformKeyboardEvent::Char) + [self _executeSavedEditingCommands]; } - return (!_private->receivedNOOP && parameters.eventWasHandled) || parameters.consumedByIM; + _private->interpretKeyEventsParameters = 0; + + // An input method may make several actions per keypress. For example, pressing Return with Korean IM both confirms it and sends a newline. + // IM-like actions are handled immediately (so parameters.eventInterpretationHadSideEffects is true), but there are saved commands that + // should be handled like normal text input after DOM event dispatch. + if (!event->keypressCommands().isEmpty()) + return NO; + + // An input method may consume an event and not tell us (e.g. when displaying a candidate window), + // in which case we should not bubble the event up the DOM. + if (parameters.consumedByIM) + return YES; + + // If we have already executed all commands, don't do it again. + return parameters.eventInterpretationHadSideEffects; } - (WebCore::CachedImage*)promisedDragTIFFDataSource @@ -5551,7 +5600,20 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) #if !defined(BUILDING_ON_LEOPARD) // If we aren't in the window yet, we'll use the screen's scale factor now, and reset the scale // via -viewDidMoveToWindow. - CGFloat scaleFactor = [self window] ? [[self window] userSpaceScaleFactor] : [[NSScreen mainScreen] userSpaceScaleFactor]; + NSWindow *window = [self window]; + CGFloat scaleFactor; +#if !defined(BUILDING_ON_SNOW_LEOPARD) + if (window) + scaleFactor = [window backingScaleFactor]; + else + scaleFactor = [[NSScreen mainScreen] backingScaleFactor]; +#else + if (window) + scaleFactor = [window userSpaceScaleFactor]; + else + scaleFactor = [[NSScreen mainScreen] userSpaceScaleFactor]; +#endif + [viewLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)]; #endif @@ -5684,6 +5746,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSUInteger)characterIndexForPoint:(NSPoint)thePoint { + [self _executeSavedEditingCommands]; + NSWindow *window = [self window]; WebFrame *frame = [self _frame]; @@ -5703,7 +5767,9 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) } - (NSRect)firstRectForCharacterRange:(NSRange)theRange -{ +{ + [self _executeSavedEditingCommands]; + WebFrame *frame = [self _frame]; // Just to match NSTextView's behavior. Regression tests cannot detect this; @@ -5734,6 +5800,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSRange)selectedRange { + [self _executeSavedEditingCommands]; + if (!isTextInput(core([self _frame]))) { LOG(TextInput, "selectedRange -> (NSNotFound, 0)"); return NSMakeRange(NSNotFound, 0); @@ -5746,6 +5814,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSRange)markedRange { + [self _executeSavedEditingCommands]; + WebFrame *webFrame = [self _frame]; Frame* coreFrame = core(webFrame); if (!coreFrame) @@ -5758,6 +5828,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSAttributedString *)attributedSubstringFromRange:(NSRange)nsRange { + [self _executeSavedEditingCommands]; + WebFrame *frame = [self _frame]; Frame* coreFrame = core(frame); if (!isTextInput(coreFrame) || isInPasswordField(coreFrame)) { @@ -5799,6 +5871,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (BOOL)hasMarkedText { + [self _executeSavedEditingCommands]; + Frame* coreFrame = core([self _frame]); BOOL result = coreFrame && coreFrame->editor()->hasComposition(); LOG(TextInput, "hasMarkedText -> %u", result); @@ -5807,6 +5881,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (void)unmarkText { + [self _executeSavedEditingCommands]; + LOG(TextInput, "unmarkText"); // Use pointer to get parameters passed to us by the caller of interpretKeyEvents. @@ -5814,8 +5890,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) _private->interpretKeyEventsParameters = 0; if (parameters) { - parameters->eventWasHandled = YES; - parameters->consumedByIM = NO; + parameters->eventInterpretationHadSideEffects = true; + parameters->consumedByIM = false; } if (Frame* coreFrame = core([self _frame])) @@ -5844,6 +5920,8 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange { + [self _executeSavedEditingCommands]; + BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; // Otherwise, NSString LOG(TextInput, "setMarkedText:\"%@\" selectedRange:(%u, %u)", isAttributedString ? [string string] : string, newSelRange.location, newSelRange.length); @@ -5853,8 +5931,8 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde _private->interpretKeyEventsParameters = 0; if (parameters) { - parameters->eventWasHandled = YES; - parameters->consumedByIM = NO; + parameters->eventInterpretationHadSideEffects = true; + parameters->consumedByIM = false; } Frame* coreFrame = core([self _frame]); @@ -5869,7 +5947,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde if (isAttributedString) { unsigned markedTextLength = [(NSString *)string length]; - NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:NULL inRange:NSMakeRange(0, markedTextLength)]; + NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:0 inRange:NSMakeRange(0, markedTextLength)]; LOG(TextInput, " ReplacementRange: %@", rangeString); // The AppKit adds a 'secret' property to the string that contains the replacement range. // The replacement range is the range of the the text that should be replaced with the new string. @@ -5891,17 +5969,16 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde // The same call to interpretKeyEvents can do more than one command. WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters; if (parameters) - parameters->consumedByIM = NO; - - if (selector == @selector(noop:)) { - _private->receivedNOOP = YES; - return; - } + parameters->consumedByIM = false; KeyboardEvent* event = parameters ? parameters->event : 0; - bool shouldSaveCommand = parameters && parameters->shouldSaveCommand; + bool shouldSaveCommand = parameters && parameters->shouldSaveCommands; + + // As in insertText:, we assume that the call comes from an input method if there is marked text. + RefPtr<Frame> coreFrame = core([self _frame]); + bool isFromInputMethod = coreFrame && coreFrame->editor()->hasComposition(); - if (event && shouldSaveCommand) + if (event && shouldSaveCommand && !isFromInputMethod) event->keypressCommands().append(KeypressCommand(NSStringFromSelector(selector))); else { // Make sure that only direct calls to doCommandBySelector: see the parameters by setting to 0. @@ -5933,10 +6010,8 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde } if (parameters) - parameters->eventWasHandled = eventWasHandled; + parameters->eventInterpretationHadSideEffects |= eventWasHandled; - // Restore the parameters so that other calls to doCommandBySelector: see them, - // and other commands can participate in setting the "eventWasHandled" flag. _private->interpretKeyEventsParameters = parameters; } } @@ -5948,9 +6023,8 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde LOG(TextInput, "insertText:\"%@\"", isAttributedString ? [string string] : string); WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters; - _private->interpretKeyEventsParameters = 0; if (parameters) - parameters->consumedByIM = NO; + parameters->consumedByIM = false; // We don't support inserting an attributed string but input methods don't appear to require this. RefPtr<Frame> coreFrame = core([self _frame]); @@ -5960,57 +6034,48 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde text = [string string]; // We deal with the NSTextInputReplacementRangeAttributeName attribute from NSAttributedString here // simply because it is used by at least one Input Method -- it corresonds to the kEventParamTextInputSendReplaceRange - // event in TSM. This behaviour matches that of -[WebHTMLView setMarkedText:selectedRange:] when it receives an + // event in TSM. This behavior matches that of -[WebHTMLView setMarkedText:selectedRange:] when it receives an // NSAttributedString - NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:NULL inRange:NSMakeRange(0, [text length])]; + NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:0 inRange:NSMakeRange(0, [text length])]; LOG(TextInput, " ReplacementRange: %@", rangeString); if (rangeString) { [[self _frame] _selectNSRange:NSRangeFromString(rangeString)]; - isFromInputMethod = YES; + isFromInputMethod = true; } } else text = string; - bool eventHandled = false; - if ([text length]) { - KeyboardEvent* event = parameters ? parameters->event : 0; - - // insertText can be called from an input method or from normal key event processing - // If its from normal key event processing, we may need to save the action to perform it later. - // If its from an input method, then we should go ahead and insert the text now. - // We assume it's from the input method if we have marked text. - // FIXME: In theory, this could be wrong for some input methods, so we should try to find - // another way to determine if the call is from the input method - bool shouldSaveCommand = parameters && parameters->shouldSaveCommand; - if (event && shouldSaveCommand && !isFromInputMethod) { - event->keypressCommands().append(KeypressCommand("insertText:", text)); - _private->interpretKeyEventsParameters = parameters; - return; - } - - String eventText = text; - eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore - if (coreFrame && coreFrame->editor()->canEdit()) { - if (!coreFrame->editor()->hasComposition()) - eventHandled = coreFrame->editor()->insertText(eventText, event); - else { - eventHandled = true; - coreFrame->editor()->confirmComposition(eventText); - } - } - } - - if (!parameters) + KeyboardEvent* event = parameters ? parameters->event : 0; + + // insertText can be called for several reasons: + // - If it's from normal key event processing (including key bindings), we may need to save the action to perform it later. + // - If it's from an input method, then we should go ahead and insert the text now. We assume it's from the input method if we have marked text. + // FIXME: In theory, this could be wrong for some input methods, so we should try to find another way to determine if the call is from the input method. + // - If it's sent outside of keyboard event processing (e.g. from Character Viewer, or when confirming an inline input area with a mouse), + // then we also execute it immediately, as there will be no other chance. + bool shouldSaveCommand = parameters && parameters->shouldSaveCommands; + if (event && shouldSaveCommand && !isFromInputMethod) { + event->keypressCommands().append(KeypressCommand("insertText:", text)); return; - - if (isFromInputMethod) { - // Allow doCommandBySelector: to be called after insertText: by resetting interpretKeyEventsParameters - _private->interpretKeyEventsParameters = parameters; - parameters->consumedByIM = YES; + } + + if (!coreFrame || !coreFrame->editor()->canEdit()) return; + + bool eventHandled = false; + String eventText = text; + eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore + if (!coreFrame->editor()->hasComposition()) { + // An insertText: might be handled by other responders in the chain if we don't handle it. + // One example is space bar that results in scrolling down the page. + eventHandled = coreFrame->editor()->insertText(eventText, event); + } else { + eventHandled = true; + coreFrame->editor()->confirmComposition(eventText); } - parameters->eventWasHandled = eventHandled; + if (parameters) + parameters->eventInterpretationHadSideEffects |= eventHandled; } - (void)_updateSelectionForInputManager diff --git a/Source/WebKit/mac/WebView/WebHTMLViewInternal.h b/Source/WebKit/mac/WebView/WebHTMLViewInternal.h index 07a782a..d38fded 100644 --- a/Source/WebKit/mac/WebView/WebHTMLViewInternal.h +++ b/Source/WebKit/mac/WebView/WebHTMLViewInternal.h @@ -49,7 +49,7 @@ namespace WebCore { - (WebFrame *)_frame; - (void)_lookUpInDictionaryFromMenu:(id)sender; - (void)_hoverFeedbackSuspendedChanged; -- (BOOL)_interceptEditingKeyEvent:(WebCore::KeyboardEvent *)event shouldSaveCommand:(BOOL)shouldSave; +- (BOOL)_interpretKeyEvent:(WebCore::KeyboardEvent *)event savingCommands:(BOOL)savingCommands; - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard; - (NSEvent *)_mouseDownEvent; #ifndef BUILDING_ON_TIGER diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index b6ae03f..a2f176a 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -89,6 +89,7 @@ #define WebKitJavaScriptCanAccessClipboardPreferenceKey @"WebKitJavaScriptCanAccessClipboard" #define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled" #define WebKitAcceleratedDrawingEnabledPreferenceKey @"WebKitAcceleratedDrawingEnabled" +#define WebKitCanvasUsesAcceleratedDrawingPreferenceKey @"WebKitCanvasUsesAcceleratedDrawing" #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled" #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders" #define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter" @@ -104,6 +105,7 @@ #define WebKitAsynchronousSpellCheckingEnabledPreferenceKey @"WebKitAsynchronousSpellCheckingEnabled" #define WebKitMemoryInfoEnabledPreferenceKey @"WebKitMemoryInfoEnabled" #define WebKitHyperlinkAuditingEnabledPreferenceKey @"WebKitHyperlinkAuditingEnabled" +#define WebKitUseQuickLookResourceCachingQuirksPreferenceKey @"WebKitUseQuickLookResourceCachingQuirks" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index 3fd41f6..a5f24e0 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -136,6 +136,22 @@ static WebCacheModel cacheModelForMainBundle(void) return cacheModel; } +static bool useQuickLookQuirks(void) +{ + NSArray* frameworks = [NSBundle allFrameworks]; + + if (!frameworks) + return false; + + for (unsigned int i = 0; i < [frameworks count]; i++) { + NSBundle* bundle = [frameworks objectAtIndex: i]; + const char* bundleID = [[bundle bundleIdentifier] UTF8String]; + if (bundleID && !strcasecmp(bundleID, "com.apple.QuickLookUIFramework")) + return true; + } + return false; +} + @interface WebPreferencesPrivate : NSObject { @public @@ -359,6 +375,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey, + [NSNumber numberWithBool:YES], WebKitCanvasUsesAcceleratedDrawingPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey, [NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey, @@ -367,11 +384,12 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitFrameFlatteningEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitSpatialNavigationEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitDNSPrefetchingEnabledPreferenceKey, - [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey, + [NSNumber numberWithBool:YES], WebKitFullScreenEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitAsynchronousSpellCheckingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitHyperlinkAuditingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey, + [NSNumber numberWithBool:useQuickLookQuirks()], WebKitUseQuickLookResourceCachingQuirksPreferenceKey, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, nil]; @@ -1245,6 +1263,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitAcceleratedDrawingEnabledPreferenceKey]; } +- (BOOL)canvasUsesAcceleratedDrawing +{ + return [self _boolValueForKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey]; +} + +- (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey]; +} + - (BOOL)acceleratedCompositingEnabled { return [self _boolValueForKey:WebKitAcceleratedCompositingEnabledPreferenceKey]; @@ -1385,6 +1413,11 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey]; } +- (BOOL)useQuickLookResourceCachingQuirks +{ + return [self _boolValueForKey:WebKitUseQuickLookResourceCachingQuirksPreferenceKey]; +} + - (void)didRemoveFromWebView { ASSERT(_private->numWebViews); diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 40d4b5b..7e1f6a2 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -179,6 +179,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)acceleratedDrawingEnabled; - (void)setAcceleratedDrawingEnabled:(BOOL)enabled; +- (BOOL)canvasUsesAcceleratedDrawing; +- (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled; + - (BOOL)acceleratedCompositingEnabled; - (void)setAcceleratedCompositingEnabled:(BOOL)enabled; @@ -233,4 +236,6 @@ extern NSString *WebPreferencesRemovedNotification; - (void)setUsePreHTML5ParserQuirks:(BOOL)flag; - (BOOL)usePreHTML5ParserQuirks; +- (BOOL)useQuickLookResourceCachingQuirks; + @end diff --git a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm index 270266b..738c4df 100644 --- a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm +++ b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm @@ -239,7 +239,7 @@ NSString * const WebScriptErrorLineNumberKey = @"WebScriptErrorLineNumber"; if (self == _private->debugger->globalCallFrame() && !globalObject->globalData().dynamicGlobalObject) { JSGlobalObject* globalObject = _private->debugger->globalObject(); - DynamicGlobalObjectScope globalObjectScope(globalObject->globalExec(), globalObject); + DynamicGlobalObjectScope globalObjectScope(globalObject->globalData(), globalObject); JSValue exception; JSValue result = evaluateInGlobalCallFrame(stringToUString(script), exception, globalObject); diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 2f45ca4..3d42be0 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -97,6 +97,7 @@ #import "WebPreferencesPrivate.h" #import "WebScriptDebugDelegate.h" #import "WebScriptWorldInternal.h" +#import "WebStorageManagerInternal.h" #import "WebSystemInterface.h" #import "WebTextCompletionController.h" #import "WebTextIterator.h" @@ -687,6 +688,10 @@ static NSString *leakMailQuirksUserScriptPath() #if ENABLE(DATABASE) WebKitInitializeDatabasesIfNecessary(); #endif + +#if ENABLE(DOM_STORAGE) + WebKitInitializeStorageIfNecessary(); +#endif WebKitInitializeApplicationCachePathIfNecessary(); patchMailRemoveAttributesMethod(); @@ -1491,6 +1496,8 @@ static bool fastDocumentTeardownEnabled() // Until we fix that, I will comment out the test (CFM) settings->setAcceleratedCompositingEnabled((coreVideoHas7228836Fix() || [preferences webGLEnabled] || [preferences accelerated2dCanvasEnabled]) && [preferences acceleratedCompositingEnabled]); + settings->setAcceleratedDrawingEnabled([preferences acceleratedDrawingEnabled]); + settings->setCanvasUsesAcceleratedDrawing([preferences canvasUsesAcceleratedDrawing]); settings->setShowDebugBorders([preferences showDebugBorders]); settings->setShowRepaintCounter([preferences showRepaintCounter]); settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]); @@ -1511,7 +1518,10 @@ static bool fastDocumentTeardownEnabled() settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]); settings->setHyperlinkAuditingEnabled([preferences hyperlinkAuditingEnabled]); settings->setUsePreHTML5ParserQuirks([self _needsPreHTML5ParserQuirks]); + settings->setUseQuickLookResourceCachingQuirks([preferences useQuickLookResourceCachingQuirks]); settings->setCrossOriginCheckInGetMatchedCSSRulesDisabled([self _needsUnrestrictedGetMatchedCSSRules]); + settings->setInteractiveFormValidationEnabled([self interactiveFormValidationEnabled]); + settings->setValidationMessageTimerMagnification([self validationMessageTimerMagnification]); // Application Cache Preferences are stored on the global cache storage manager, not in Settings. [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]]; @@ -2396,6 +2406,26 @@ static inline IMP getMethod(id o, SEL s) return NO; } +- (BOOL)interactiveFormValidationEnabled +{ + return _private->interactiveFormValidationEnabled; +} + +- (void)setInteractiveFormValidationEnabled:(BOOL)enabled +{ + _private->interactiveFormValidationEnabled = enabled; +} + +- (int)validationMessageTimerMagnification +{ + return _private->validationMessageTimerMagnification; +} + +- (void)setValidationMessageTimerMagnification:(int)newValue +{ + _private->validationMessageTimerMagnification = newValue; +} + - (BOOL)_isSoftwareRenderable { #if USE(ACCELERATED_COMPOSITING) @@ -5000,12 +5030,12 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (void)setEditable:(BOOL)flag { - if ([self isEditable] != flag) { - if (!_private->tabKeyCyclesThroughElementsChanged && _private->page) + if ([self isEditable] != flag && _private->page) { + _private->page->setEditable(flag); + if (!_private->tabKeyCyclesThroughElementsChanged) _private->page->setTabKeyCyclesThroughElements(!flag); Frame* mainFrame = [self _mainCoreFrame]; if (mainFrame) { - mainFrame->document()->setDesignMode(flag ? WebCore::Document::on : WebCore::Document::off); if (flag) { mainFrame->editor()->applyEditingStyleToBodyElement(); // If the WebView is made editable and the selection is empty, set it to something. @@ -5018,10 +5048,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isEditable { - Frame* mainFrame = [self _mainCoreFrame]; - if (mainFrame) - return mainFrame->document()->inDesignMode(); - return false; + return _private->page && _private->page->isEditable(); } - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style @@ -5306,6 +5333,16 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu #endif +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +- (void)handleCorrectionPanelResult:(NSString*)result +{ + WebFrame *webFrame = [self _selectedOrMainFrame]; + Frame* coreFrame = core(webFrame); + if (coreFrame) + coreFrame->editor()->handleCorrectionPanelResult(result); +} +#endif + @end @implementation WebView (WebViewUndoableEditing) @@ -5415,7 +5452,7 @@ FOR_EACH_RESPONDER_SELECTOR(FORWARD) Frame* coreFrame = core([self _selectedOrMainFrame]); if (!coreFrame) return NO; - return coreFrame->selection()->isAll(MayLeaveEditableContent); + return coreFrame->selection()->isAll(CanCrossEditingBoundary); } @end @@ -5859,7 +5896,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num) WebFrameLoadDelegateImplementationCache* cache = &_private->frameLoadDelegateImplementations; if (cache->didReceiveIconForFrameFunc) { - Image* image = iconDatabase().iconForPageURL(core(webFrame)->document()->url().string(), IntSize(16, 16)); + Image* image = iconDatabase().synchronousIconForPageURL(core(webFrame)->document()->url().string(), IntSize(16, 16)); if (NSImage *icon = webGetNSImage(image, NSMakeSize(16, 16))) CallFrameLoadDelegate(cache->didReceiveIconForFrameFunc, self, @selector(webView:didReceiveIcon:forFrame:), icon, webFrame); } @@ -6120,8 +6157,11 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi #endif #if ENABLE(FULLSCREEN_API) -- (BOOL)_supportsFullScreenForElement:(const WebCore::Element*)element +- (BOOL)_supportsFullScreenForElement:(const WebCore::Element*)element withKeyboard:(BOOL)withKeyboard { + if (withKeyboard) + return NO; + if (![[WebPreferences standardPreferences] fullScreenEnabled]) return NO; diff --git a/Source/WebKit/mac/WebView/WebViewData.h b/Source/WebKit/mac/WebView/WebViewData.h index e8b9188..a6a5a07 100644 --- a/Source/WebKit/mac/WebView/WebViewData.h +++ b/Source/WebKit/mac/WebView/WebViewData.h @@ -186,5 +186,8 @@ extern int pluginDatabaseClientCount; id<WebDeviceOrientationProvider> m_deviceOrientationProvider; RefPtr<WebCore::HistoryItem> _globalHistoryItem; + + BOOL interactiveFormValidationEnabled; + int validationMessageTimerMagnification; } @end diff --git a/Source/WebKit/mac/WebView/WebViewData.mm b/Source/WebKit/mac/WebView/WebViewData.mm index df7563e..e74c7a1 100644 --- a/Source/WebKit/mac/WebView/WebViewData.mm +++ b/Source/WebKit/mac/WebView/WebViewData.mm @@ -65,6 +65,10 @@ int pluginDatabaseClientCount = 0; zoomMultiplier = 1; zoomsTextOnly = NO; + interactiveFormValidationEnabled = NO; + // The default value should be synchronized with WebCore/page/Settings.cpp. + validationMessageTimerMagnification = 50; + #if ENABLE(DASHBOARD_SUPPORT) dashboardBehaviorAllowWheelScrolling = YES; #endif diff --git a/Source/WebKit/mac/WebView/WebViewInternal.h b/Source/WebKit/mac/WebView/WebViewInternal.h index 9517104..65cb4d8 100644 --- a/Source/WebKit/mac/WebView/WebViewInternal.h +++ b/Source/WebKit/mac/WebView/WebViewInternal.h @@ -57,7 +57,6 @@ namespace WebCore { #ifdef __cplusplus @interface WebView (WebViewEditingExtras) -- (BOOL)_interceptEditingKeyEvent:(WebCore::KeyboardEvent*)event shouldSaveCommand:(BOOL)shouldSave; - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag; @end @@ -190,7 +189,7 @@ namespace WebCore { #endif #if ENABLE(FULLSCREEN_API) && defined(__cplusplus) -- (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element; +- (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element withKeyboard:(BOOL)withKeyboard; - (void)_enterFullScreenForElement:(WebCore::Element*)element; - (void)_exitFullScreenForElement:(WebCore::Element*)element; - (void)_fullScreenRendererChanged:(WebCore::RenderBox*)renderer; diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index a4ea809..7d7537e 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -487,6 +487,12 @@ Could be worth adding to the API. - (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag; - (BOOL)_isUsingAcceleratedCompositing; +// For DumpRenderTree +- (BOOL)interactiveFormValidationEnabled; +- (void)setInteractiveFormValidationEnabled:(BOOL)enabled; +- (int)validationMessageTimerMagnification; +- (void)setValidationMessageTimerMagnification:(int)newValue; + // Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content. - (BOOL)_isSoftwareRenderable; // When drawing into a bitmap context, we normally flatten compositing layers (and distort 3D transforms). @@ -644,7 +650,9 @@ Could be worth adding to the API. - (void)setAutomaticSpellingCorrectionEnabled:(BOOL)flag; - (void)toggleAutomaticSpellingCorrection:(id)sender; #endif - +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +- (void)handleCorrectionPanelResult:(NSString*)result; +#endif @end @interface WebView (WebViewEditingInMail) |