diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit/mac | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit/mac')
41 files changed, 1217 insertions, 1419 deletions
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index afaa1e3..5139734 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,665 @@ +2011-04-19 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + WebPreferences in WebKit1 should have CanvasUsesAcceleratedDrawing set to NO by default + https://bugs.webkit.org/show_bug.cgi?id=58936 + + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + +2011-04-19 Vsevolod Vlasov <vsevik@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Rename lengthReceived to encodedDataLength/dataLength + https://bugs.webkit.org/show_bug.cgi?id=58883 + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidReceiveContentLength): + +2011-04-18 Jia Pu <jpu@apple.com> + + Reviewed by Mark Rowe. + + WebKit needs to stop importing <AppKit/NSTextChecker.h> + https://bugs.webkit.org/show_bug.cgi?id=58798 + <rdar://problem/9294938> + + Use public header <AppKit/NSSpellChecker.h> instead. + + * WebCoreSupport/CorrectionPanel.h: + * WebCoreSupport/CorrectionPanel.mm: + (correctionIndicatorType): + (CorrectionPanel::show): + (CorrectionPanel::dismissInternal): + (CorrectionPanel::handleAcceptedReplacement): + * WebCoreSupport/WebEditorClient.mm: + * WebView/WebView.mm: + +2011-04-17 Cameron Zwarich <zwarich@apple.com> + + Reviewed by Timothy Hatcher. + + Stop using -[NSString initWithContentsOfFile:] + https://bugs.webkit.org/show_bug.cgi?id=58763 + + -[NSString initWithContentsOfFile:] was deprecated in 10.4, so we should stop using it. + + * WebView/WebView.mm: + (leakMailQuirksUserScriptContents): + (leakOutlookQuirksUserScriptContents): + +2011-04-17 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/58463> Switch HTTP pipelining from user default to private setting + <rdar://problem/9268729> + + Reviewed by Dan Bernstein. + + This replaces support for the WebKitEnableHTTPPipelining user + default with methods on the WebCore::ResourceRequest class in + WebCore, the WebView class in WebKit1, and the WebContext class + in WebKit2. It also removes support for the + WebKitForceHTTPPipeliningPriorityHigh user default which was not + needed. + + * WebView/WebView.mm: + (+[WebView(WebPrivate) _HTTPPipeliningEnabled]): Added. + (+[WebView(WebPrivate) _setHTTPPipeliningEnabled:]): Added. + * WebView/WebViewPrivate.h: + (+[WebView(WebPrivate) _HTTPPipeliningEnabled]): Added declaration. + (+[WebView(WebPrivate) _setHTTPPipeliningEnabled:]): Added declaration. + +2011-04-17 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Dan Bernstein. + + Assign to self in WebInspectorWindowController constructors + https://bugs.webkit.org/show_bug.cgi?id=58749 + + * WebCoreSupport/WebInspectorClient.mm: + (-[WebInspectorWindowController init]): + (-[WebInspectorWindowController initWithInspectedWebView:]): + +2011-04-17 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Move WebNodeHighlighter into its own file + https://bugs.webkit.org/show_bug.cgi?id=58746 + + Extract this class into its own file alongside the + other WebNodeHighlight files. In doing so do some + cleanup on WebInspectorClient removing some methods + that were never called. + + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::WebInspectorClient): style fix. + * WebInspector/WebNodeHighlighter.h: Added. + * WebInspector/WebNodeHighlighter.mm: Added. + (-[WebNodeHighlighter initWithInspectedWebView:]): call super init. + (-[WebNodeHighlighter dealloc]): + (-[WebNodeHighlighter highlightNode:]): + (-[WebNodeHighlighter hideHighlight]): + (-[WebNodeHighlighter didAttachWebNodeHighlight:]): + (-[WebNodeHighlighter willDetachWebNodeHighlight:]): + +2011-04-15 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + [Mac] WebKit needs to convert the bounding box of autocorrected word to view coordinate. + https://bugs.webkit.org/show_bug.cgi?id=58717 + + Convert the bounding box from window coordinate to view coordinate, which is expected by NSCorrectionPanel. + + * WebCoreSupport/CorrectionPanel.mm: + (CorrectionPanel::show): + +2011-04-15 Shishir Agrawal <shishir@chromium.org> + + Reviewed by James Robinson. + + Add a flag to guard Page Visibility API changes. + https://bugs.webkit.org/show_bug.cgi?id=58464 + + * Configurations/FeatureDefines.xcconfig: + +2011-04-15 Oliver Hunt <oliver@apple.com> + + GC allocate Structure + https://bugs.webkit.org/show_bug.cgi?id=58483 + + Rolling r83894 r83827 r83810 r83809 r83808 back in with + a workaround for the gcc bug seen by the gtk bots + + * Plugins/Hosted/NetscapePluginInstanceProxy.h: + * Plugins/Hosted/ProxyInstance.mm: + (WebKit::ProxyRuntimeMethod::createStructure): + * Plugins/Hosted/ProxyRuntimeObject.h: + (WebKit::ProxyRuntimeObject::createStructure): + +2011-04-14 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + WebKit2: Password field input does not switch to ASCII-compatible source + https://bugs.webkit.org/show_bug.cgi?id=58583 + <rdar://problem/9059651> + + Now that WebCore doesn't set secure input mode, WebKit has to. Happily, it already has the + necessary logic, needed to return a nil text input context when in password fields. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView close]): If the view is still enforcing secure event mode, stop. + (-[WebHTMLView windowDidBecomeKey:]): Call _updateSecureInputState. + (-[WebHTMLView windowDidResignKey:]): Ditto. + (-[WebHTMLView becomeFirstResponder]): Call _updateSecureInputState. It's a bit tricky + because the first responder is still different an this point, so set a boolean variable to + let _updateSecureInputState know what's going on. + (-[WebHTMLView resignFirstResponder]): Disable secure event mode if it's on. + (-[WebHTMLView _updateSecureInputState]): Update HIToolbox secure event input state and + allowed input sources accorsing to current selection. + (-[WebHTMLView _updateSelectionForInputManager]): Call _updateSecureInputState. + +2011-04-15 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Make mac WebKit1 use the default localization strategy + https://bugs.webkit.org/show_bug.cgi?id=58628 + + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + Remove the localization strategy code. The equivalent is now + in WebCore/platform/DefaultLocalizationStrategy.cpp. + +2011-04-15 Anna Cavender <annacc@chromium.org> + + Reviewed by Eric Carlson. + + Renaming TRACK feature define to VIDEO_TRACK + https://bugs.webkit.org/show_bug.cgi?id=53556 + + * Configurations/FeatureDefines.xcconfig: + +2011-04-14 Pratik Solanki <psolanki@apple.com> + + Reviewed by David Kilzer. + + Set minimum priority for fast lane connections + https://bugs.webkit.org/show_bug.cgi?id=58353 + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Support for new WKSI method WKSetHTTPPipeliningMinimumFastLanePriority. + +2011-04-13 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + WebKit2 doesn't keep overlay scrollers shown while scroll gesture held + <rdar://problem/9260518> + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + Initialize new WKSI functions. + +2011-04-13 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/58172> Fix -Wcast-align warning in WebBasePluginPackage.mm + + Reviewed by Anders Carlsson. + + Fixes the following warning with -Wcast-align enabled: + + Source/WebKit/mac/Plugins/WebBasePluginPackage.mm:402:21:{402:21-402:93}{402:39-402:93}: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'struct fat_arch *' increases required alignment from 1 to 4 [-Werror,-Wcast-align,3] + archs = (struct fat_arch*)((uint8_t*)rawData.data() + sizeof(struct fat_header)); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage isNativeLibraryData:]): Added + COMPILE_ASSERT() to make sure our pointer math is valid. + Removed cast to (uint8_t*) and divide sizeof(struct fat_header) + by sizeof(uint32_t) to fix the pointer math. Replaced C-style + casts with reinterpret_cast. + +2011-04-12 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + Infinite recursion in WebHTMLView executeSavedKeypressCommands. + https://bugs.webkit.org/show_bug.cgi?id=58382 + <rdar://problem/9239370> + + Execution of some editing commands could trigger a call to selectedRange that + internally calls executeSavedKeypressCommands creating an infinite recursion. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _executeSavedKeypressCommands]): Added a flag to avoid recursion. + (-[WebHTMLView _interpretKeyEvent:savingCommands:]): Added flag initialization. + +2011-04-12 Alice Liu <alice.liu@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=58292 + Provide new setting to allow site icon loading despite disabling automatic image loading in general. + + * WebView/WebPreferenceKeysPrivate.h: Add preference key. + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Initialize to false. + (-[WebPreferences setLoadsSiteIconsIgnoringImageLoadingPreference:]): Added. + (-[WebPreferences loadsSiteIconsIgnoringImageLoadingPreference]): Added. + * WebView/WebPreferencesPrivate.h: Add setter/getter definitions. + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): Add to settings that get propagated upon changes. + +2011-04-11 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Maciej Stachowiak. + + WebKit2: Safari doesn't respect cmd-arrows (and variations) as custom keyboard shortcuts + https://bugs.webkit.org/show_bug.cgi?id=58175 + <rdar://problem/9060555> + + * WebView/WebFrameView.mm: (-[WebFrameView keyDown:]): Added a comment explaining how this + should be changed to match WebKit2. + +2011-04-06 Timothy Hatcher <timothy@apple.com> + + Fix a bug where the context menu does not show in PDF documents if there is no + UI delegate or the UI delegate does not respond to the context menu selector. + + https://webkit.org/b/57958 + + Reviewed by Darin Adler. + + * WebView/WebView.mm: + (-[WebView _menuForElement:defaultItems:]): CallUIDelegate returns nil + if UIDelegate is nil or doesn't respond to the selector. So check that + here to distinguish between using defaultMenuItems or the delegate + really returning nil to say "no context menu". + +2011-04-11 Jer Noble <jer.noble@apple.com> + + Unreviewed; roll out unintentional change to WebFullScreenController.mm. + + * WebView/WebFullScreenController.mm: + (-[WebFullScreenController enterFullscreen:]): + +2011-04-08 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + A few heap-related renames and file moves. + + WeakGCPtr<T> => Weak<T> + Global<T> => Strong<T> + collector/ => heap/ + collector/* => heap/* + runtime/WeakGCPtr.h => heap/Weak.h + + (Eventually, even more files should move into the heap directory. Like + Heap.h and Heap.cpp, for example.) + + * Plugins/Hosted/NetscapePluginInstanceProxy.h: + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::idForObject): + (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::forget): + (WebKit::NetscapePluginInstanceProxy::evaluate): + * WebView/WebScriptDebugger.h: + +2011-04-08 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + WebKit2: Safari doesn't respect cmd-arrows (and variations) as custom keyboard shortcuts + https://bugs.webkit.org/show_bug.cgi?id=58175 + <rdar://problem/9060555> + + * WebView/WebFrameView.mm: (-[WebFrameView keyDown:]): Added a comment explaining how this + should be changed to match WebKit2. + +2011-04-08 Alpha Lam <hclam@chromium.org> + + Unreviewed, rolling out r83335. + http://trac.webkit.org/changeset/83335 + https://bugs.webkit.org/show_bug.cgi?id=53556 + + GTK and QT bots are broken + + * Configurations/FeatureDefines.xcconfig: + +2011-04-07 Anna Cavender <annacc@chromium.org> + + Reviewed by Eric Carlson. + + Setup ENABLE(TRACK) feature define + https://bugs.webkit.org/show_bug.cgi?id=53556 + + * Configurations/FeatureDefines.xcconfig: + +2011-04-08 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Darin Adler. + + -[WebView setPreferences:] can take a lot of time if loading lots of webviews at once + https://bugs.webkit.org/show_bug.cgi?id=58128 + <rdar://problem/9244553> + + The root of the problem here was an O(N^2) issue - each WebView, + upon having its preferences initialized, would broadcast a + notification that was listened to by all other WebViews sharing + its preferences. + + To maintain the API contract, I split the notification into two, + one that is for public API consumption, and the other which is for + internal use only. Changes that don't need to be picked up by + other WebViews broadcast the public notification only. And we + avoid WebView broadcasting a notification just to get itself to + update. + + * Misc/WebIconDatabase.mm: + (-[WebIconDatabase _startUpIconDatabase]): + (-[WebIconDatabase _shutDownIconDatabase]): + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView viewWillMoveToWindow:]): + (-[WebBaseNetscapePluginView viewWillMoveToSuperview:]): + (-[WebBaseNetscapePluginView viewDidMoveToWindow]): + (-[WebBaseNetscapePluginView viewWillMoveToHostWindow:]): + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences _setStringValue:forKey:]): + (-[WebPreferences _setIntegerValue:forKey:]): + (-[WebPreferences _setFloatValue:forKey:]): + (-[WebPreferences _setBoolValue:forKey:]): + (-[WebPreferences _setLongLongValue:forKey:]): + (-[WebPreferences _setUnsignedLongLongValue:forKey:]): + (-[WebPreferences _postPreferencesChangedNotification]): + (-[WebPreferences _postPreferencesChangedAPINotification]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + (-[WebView _preferencesChangedNotification:]): + (-[WebView _preferencesChanged:]): + (-[WebView setUsesPageCache:]): + (+[WebView initialize]): + (-[WebView setPreferences:]): + (-[WebView _keyboardUIMode]): + * WebView/WebViewInternal.h: + +2011-04-07 Andrew Scherkus <scherkus@chromium.org> + + Revert ENABLE_TRACK patch due to compile failures. + + * Configurations/FeatureDefines.xcconfig: + +2011-04-07 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson. + + REGRESSION (WebKit2): Reverse conversion doesn't work in Kotoeri + https://bugs.webkit.org/show_bug.cgi?id=58066 + <rdar://problem/8965302> + + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation attributedStringFrom:startOffset:to:endOffset:]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView attributedSubstringFromRange:]): + (-[WebHTMLView attributedString]): + (-[WebHTMLView selectedAttributedString]): + Updated for editingAttributedStringFromRange: now taking a WebCore::Range instead of DOMRange. + +2011-04-07 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r64712): Microsoft Outlook 2011: original message contents + not included when replying to an email. + https://bugs.webkit.org/show_bug.cgi?id=57794 + + Outlook populates a reply message by creating an empty WebView and + using DOM API to populate the WebView's empty document with content + from the original message. It expects the initial empty document to + simply be "<html></html>", and it proceeds to dynamically create and + append a BODY node and add the original message content as a child of + that node. Outlook then takes the innerHTML of the frame's first body + element and copies it into a *new* document that is displayed and + edited in the reply message window. + + Due to implementing the HTML5 tree building algorithm in r64712, + initial empty documents went from being "<html></html>" to being + "<html><head></head><body></body></html>". Outlook still dynamically + creates a BODY node to parent the original message content, but this + BODY node duplicates the one created by the tree builder. When Outlook + then takes the innerHTML of the first body element to populate the + reply message window it gets the empty body element created by the + parser, not the one it created with the original message content. + + Fix this by injecting a user script into the initial empty document + that removes the HEAD and BODY nodes created by the parser. This + ensures that the BODY created by Outlook is the only BODY in the + document. + + * Misc/OutlookQuirksUserScript.js: Added. + * WebView/WebView.mm: + (leakMailQuirksUserScriptContents): + (-[WebView _injectMailQuirksScript]): + (needsOutlookQuirksScript): + (leakOutlookQuirksUserScriptContents): + (-[WebView _injectOutlookQuirksScript]): + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +2011-04-06 Dai Mikurube <dmikurube@chromium.org> + + Reviewed by David Levin. + + Add QUOTA build flag for unified quota API + https://bugs.webkit.org/show_bug.cgi?id=57918 + + * Configurations/FeatureDefines.xcconfig: Added QUOTA build flag + +2011-04-06 Robert Sesek <rsesek@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Move code duplicated between the WebKit/mac and WebKit2 down to WebCore because Chromium will need it too + https://bugs.webkit.org/show_bug.cgi?id=54969 + + * WebView/WebFrame.mm: + (-[WebFrame _convertToNSRange:]): Moved duplicated code to WebCore + (-[WebFrame _characterRangeAtPoint:]): Moved duplicated code to WebCore + +2011-04-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + Move attributedStringFromRange down to WebCore + https://bugs.webkit.org/show_bug.cgi?id=57905 + + * Misc/WebNSAttributedStringExtras.h: Removed. + * Misc/WebNSAttributedStringExtras.mm: Removed. + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation attributedStringFrom:startOffset:to:endOffset:]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView _writeSelectionWithPasteboardTypes:toPasteboard:cachedAttributedString:]): + (-[WebHTMLView attributedSubstringFromRange:]): + (-[WebHTMLView attributedString]): + (-[WebHTMLView selectedAttributedString]): + * WebView/WebPDFView.mm: + (-[WebPDFView writeSelectionWithPasteboardTypes:toPasteboard:]): + +2011-04-04 MORITA Hajime <morrita@google.com> + + Reviewed by Ryosuke Niwa. + + [Refactoring] SpellCheckingResult should be replaced with TextCheckingResult + https://bugs.webkit.org/show_bug.cgi?id=56085 + + Removed NSTextCheckingResult to SpellCheckingResult convertion, and extracted + NSTextCheckingResult to TextCheckingResult convertio from checkTextOfParagraph method. + for requestCheckingOfString method. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (toCoreTextCheckingResults): + (WebEditorClient::checkTextOfParagraph): + (-[WebEditorSpellCheckResponder initWithSender:WebCore::sequence:types:WebCore::results:]): + (-[WebEditorSpellCheckResponder perform]): + (WebEditorClient::requestCheckingOfString): + * WebView/WebFrame.mm: + (-[WebFrame markersForSelectionStartAsText]): + * WebView/WebFramePrivate.h: + +2011-04-05 Anders Carlsson <andersca@apple.com> + + Didn't mean to land this. + + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView getVariable:value:]): + +2011-04-04 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/57384> CFNetwork and WebCore load priorities should match + + Reviewed by Alexey Proskuryakov. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Added initialization for + wkSetHTTPPipeliningMaximumPriority(). + +2011-04-04 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + REGRESSION (WebKit2): Caps-Lock indicator sometimes doesn't appear in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51230 + <rdar://problem/8780989> + + * WebView/WebHTMLView.mm: (-[WebHTMLView flagsChanged:]): Moved Caps Lock handling from + WebKits to WebCore, because WebKit shouldn't be smart. + +2011-04-01 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + REGRESSION: Assertion failure when executing a complex custom key binding + https://bugs.webkit.org/show_bug.cgi?id=57681 + + * WebView/WebHTMLView.mm: (-[WebHTMLView hasMarkedText]): There is no need to execute saved + commands when they can't possibly change the result. + +2011-04-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Shockwave plug-in doesn't accept mouse events + https://bugs.webkit.org/show_bug.cgi?id=57653 + <rdar://problem/8483273> + + Fix an unrelated bug found by the added test. + + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView convertFromX:andY:space:toX:andY:space:]): + Make sure to always set destX and destY. + +2011-04-01 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + Make WebKit2 text input handling more like WebKit1 + https://bugs.webkit.org/show_bug.cgi?id=57649 + + * WebView/WebFrameInternal.h: Expose _convertToDOMRange for use in WebHTMLView. + * WebView/WebHTMLView.mm: + (-[WebHTMLView _executeSavedKeypressCommands]): Renamed, since these are not editor commands. + (-[WebHTMLView _interpretKeyEvent:savingCommands:]): Updated for the renamed _executeSavedKeypressCommands. + (-[WebHTMLView characterIndexForPoint:]): Ditto. + (-[WebHTMLView firstRectForCharacterRange:]): Ditto. + (-[WebHTMLView selectedRange]): Ditto. + (-[WebHTMLView markedRange]): Ditto. + (-[WebHTMLView attributedSubstringFromRange:]): Ditto. + (-[WebHTMLView hasMarkedText]): Ditto. + (-[WebHTMLView unmarkText]): Ditto. + (-[WebHTMLView setMarkedText:selectedRange:]): Ditto. Changed the comment about the argument + type into an assertion. Removed resetting interpretKeyEventsParameters to 0, as we shouldn't + be able to call text input protocol methods from here (and we didn't even reset it back on + return). Changed to retrieve all data before starting to apply actions to better match WK2 code. + (-[WebHTMLView insertText:]): Ditto. + +2011-04-01 Timothy Hatcher <timothy@apple.com> + + Make momentum scroll event latching work in WebKit2 on Mac. + + <rdar://problem/8751861> + + Reviewed by Darin Adler. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Remove IsLatchingWheelEvent, add GetNSEventMomentumPhase. + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView scrollWheel:]): Use WKGetNSEventMomentumPhase to set isLatchingEvent. + +2011-03-31 Darin Adler <darin@apple.com> + + Reviewed by Anders Carlsson. + + Assertion failure in -[WebHTMLView _handleStyleKeyEquivalent:] + https://bugs.webkit.org/show_bug.cgi?id=26667 + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _handleStyleKeyEquivalent:]): Handle the case where WebView is + nil rather than asserting that it is non-nil. One case where WebView will be nil + is when the frame is closed, but in any case where it is nil, the correct thing + to do is to not try to handle the style key. + +2011-03-31 Alexey Proskuryakov <ap@apple.com> + + Patch by John Harvey, reviewed and tweaked by me. + + <rdar://problem/8644403> Should notify TSM that plug-ins would show a bottom input window for marked text. + + * Plugins/Hosted/WebTextInputWindowController.m: + (-[WebTextInputPanel _interpretKeyEvent:string:]): + +2011-03-31 Evan Martin <evan@chromium.org> + + Reviewed by Eric Seidel. + + <title> should support dir attribute + https://bugs.webkit.org/show_bug.cgi?id=50961 + + Update to new FrameLoaderClient interface. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidReceiveTitle): + (WebFrameLoaderClient::setTitle): + +2011-03-30 Dominic Cooney <dominicc@google.com> + + Reviewed by Dimitri Glazkov. + + Adds layoutTestController.shadowRoot accessor to Mac DRT. + https://bugs.webkit.org/show_bug.cgi?id=57415 + + * DOM/WebDOMOperations.mm: + (-[DOMElement _shadowRoot:]): + * DOM/WebDOMOperationsPrivate.h: + +2011-03-30 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + WebHTMLView shouldn't resend noop: commands + https://bugs.webkit.org/show_bug.cgi?id=57504 + <rdar://problem/9209390> + + * WebView/WebHTMLView.mm: (-[WebHTMLView _executeSavedEditingCommands]): Filter out NOOPs, + which we get e.g. when handling Cmd-key combos. + 2011-03-30 Alexey Proskuryakov <ap@apple.com> Reviewed by Darin Adler. diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 0c1d13c..73d3a47 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -23,8 +23,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // The contents of this file must be kept in sync with FeatureDefines.xcconfig in JavaScriptCore, -// WebCore and WebKit. Also the default values of the ENABLE_FEATURE_NAME macros in build-webkit -// should match the values below, but they do not need to be in the same order. +// WebCore, WebKit and WebKit2. Also the default values of the ENABLE_FEATURE_NAME macros in +// build-webkit should match the values below, but they do not need to be in the same order. // Keep this list of features (not enabled/disabled state) in sync with FeatureDefines.vsprops // and FeatureDefinesCairo.vsprops in WebKitLibraries/win/tools/vsprops. @@ -91,8 +91,11 @@ ENABLE_MATHML = ENABLE_MATHML; ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; +ENABLE_PAGE_VISIBILITY_API = ; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_QUOTA = ; + ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); @@ -109,6 +112,7 @@ ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; +ENABLE_VIDEO_TRACK = ; ENABLE_MEDIA_STATISTICS = ; @@ -127,4 +131,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_WEBGL) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_WEBGL) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_QUOTA) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index 5e8e50b..025f4a3 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 = 27; +MINOR_VERSION = 30; 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 979433d..20e9ace 100644 --- a/Source/WebKit/mac/DOM/WebDOMOperations.mm +++ b/Source/WebKit/mac/DOM/WebDOMOperations.mm @@ -39,6 +39,7 @@ #import "WebKitNSStringExtras.h" #import <JavaScriptCore/APICast.h> #import <WebCore/Document.h> +#import <WebCore/Element.h> #import <WebCore/HTMLInputElement.h> #import <WebCore/HTMLParserIdioms.h> #import <WebCore/JSElement.h> @@ -73,6 +74,13 @@ using namespace JSC; return WebCore::markerTextForListItem(core(self)); } +- (JSValueRef)_shadowRoot:(JSContextRef)context +{ + JSLock lock(SilenceAssertionsOnly); + ExecState* execState = toJS(context); + return toRef(execState, toJS(execState, core(self)->shadowRoot())); +} + @end @implementation DOMNode (WebDOMNodeOperations) diff --git a/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h b/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h index b579a6f..cd5ff20 100644 --- a/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h +++ b/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h @@ -32,6 +32,7 @@ @interface DOMElement (WebDOMElementOperationsPrivate) + (DOMElement *)_DOMElementFromJSContext:(JSContextRef)context value:(JSValueRef)value; - (NSString *)_markerTextForListItem; +- (JSValueRef)_shadowRoot:(JSContextRef)context; @end @interface DOMDocument (WebDOMDocumentOperationsPrivate) diff --git a/Source/WebKit/mac/Misc/OutlookQuirksUserScript.js b/Source/WebKit/mac/Misc/OutlookQuirksUserScript.js new file mode 100644 index 0000000..65f6107 --- /dev/null +++ b/Source/WebKit/mac/Misc/OutlookQuirksUserScript.js @@ -0,0 +1,37 @@ +/* + * 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. + */ +(function() { + // This should only apply to the initial empty document, which should look like: + // <html><head></head><body></body></html> + if (document.documentElement.outerHTML != "<html><head></head><body></body></html>") + return; + + // Outlook expects the initial empty document to only contain the document + // element. It will explicitly insert a BODY node. + document.documentElement.removeChild(document.head); + document.documentElement.removeChild(document.body); +})(); + +
\ No newline at end of file diff --git a/Source/WebKit/mac/Misc/WebIconDatabase.mm b/Source/WebKit/mac/Misc/WebIconDatabase.mm index f223f09..e9aa8ec 100644 --- a/Source/WebKit/mac/Misc/WebIconDatabase.mm +++ b/Source/WebKit/mac/Misc/WebIconDatabase.mm @@ -35,7 +35,7 @@ #import "WebNSFileManagerExtras.h" #import "WebNSNotificationCenterExtras.h" #import "WebNSURLExtras.h" -#import "WebPreferences.h" +#import "WebPreferencesPrivate.h" #import "WebTypesInternal.h" #import <WebCore/IconDatabase.h> #import <WebCore/Image.h> @@ -313,7 +313,7 @@ static WebIconDatabaseClient* defaultClient() object:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_resetCachedWebPreferences:) - name:WebPreferencesChangedNotification + name:WebPreferencesChangedInternalNotification object:nil]; } @@ -324,7 +324,7 @@ static WebIconDatabaseClient* defaultClient() name:NSApplicationWillTerminateNotification object:NSApp]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:WebPreferencesChangedNotification + name:WebPreferencesChangedInternalNotification object:nil]; } diff --git a/Source/WebKit/mac/Misc/WebNSAttributedStringExtras.mm b/Source/WebKit/mac/Misc/WebNSAttributedStringExtras.mm deleted file mode 100644 index 2469da8..0000000 --- a/Source/WebKit/mac/Misc/WebNSAttributedStringExtras.mm +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2005, 2007, 2008 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. - * 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 "WebNSAttributedStringExtras.h" - -#import "DOMRangeInternal.h" -#import "WebDataSourcePrivate.h" -#import "WebFrame.h" -#import "WebFrameInternal.h" -#import "WebTypesInternal.h" -#import <WebCore/BlockExceptions.h> -#import <WebCore/ColorMac.h> -#import <WebCore/CSSHelper.h> -#import <WebCore/Document.h> -#import <WebCore/Element.h> -#import <WebCore/Frame.h> -#import <WebCore/FrameLoader.h> -#import <WebCore/HTMLNames.h> -#import <WebCore/Image.h> -#import <WebCore/InlineTextBox.h> -#import <WebCore/Range.h> -#import <WebCore/RenderImage.h> -#import <WebCore/RenderListItem.h> -#import <WebCore/RenderObject.h> -#import <WebCore/RenderStyle.h> -#import <WebCore/RenderText.h> -#import <WebCore/SimpleFontData.h> -#import <WebCore/Text.h> -#import <WebCore/TextIterator.h> - -using namespace WebCore; -using namespace HTMLNames; - -struct ListItemInfo { - unsigned start; - unsigned end; -}; - -static NSFileWrapper *fileWrapperForElement(Element* e) -{ - NSFileWrapper *wrapper = nil; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - - const AtomicString& attr = e->getAttribute(srcAttr); - if (!attr.isEmpty()) { - NSURL *URL = e->document()->completeURL(attr); - wrapper = [[kit(e->document()->frame()) _dataSource] _fileWrapperForURL:URL]; - } - if (!wrapper) { - RenderImage* renderer = toRenderImage(e->renderer()); - if (renderer->cachedImage() && !renderer->cachedImage()->errorOccurred()) { - wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:(NSData *)(renderer->cachedImage()->image()->getTIFFRepresentation())]; - [wrapper setPreferredFilename:@"image.tiff"]; - [wrapper autorelease]; - } - } - - return wrapper; - - END_BLOCK_OBJC_EXCEPTIONS; - - return nil; -} - -@implementation NSAttributedString (WebKitExtras) - -- (NSAttributedString *)_web_attributedStringByStrippingAttachmentCharacters -{ - // This code was originally copied from NSTextView - NSRange attachmentRange; - NSString *originalString = [self string]; - static NSString *attachmentCharString = nil; - - if (!attachmentCharString) { - unichar chars[2]; - if (!attachmentCharString) { - chars[0] = NSAttachmentCharacter; - chars[1] = 0; - attachmentCharString = [[NSString alloc] initWithCharacters:chars length:1]; - } - } - - attachmentRange = [originalString rangeOfString:attachmentCharString]; - if (attachmentRange.location != NSNotFound && attachmentRange.length > 0) { - NSMutableAttributedString *newAttributedString = [[self mutableCopyWithZone:NULL] autorelease]; - - while (attachmentRange.location != NSNotFound && attachmentRange.length > 0) { - [newAttributedString replaceCharactersInRange:attachmentRange withString:@""]; - attachmentRange = [[newAttributedString string] rangeOfString:attachmentCharString]; - } - return newAttributedString; - } - - return self; -} - -+ (NSAttributedString *)_web_attributedStringFromRange:(Range*)range -{ - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init]; - NSUInteger stringLength = 0; - RetainPtr<NSMutableDictionary> attrs(AdoptNS, [[NSMutableDictionary alloc] init]); - - for (TextIterator it(range); !it.atEnd(); it.advance()) { - RefPtr<Range> currentTextRange = it.range(); - ExceptionCode ec = 0; - Node* startContainer = currentTextRange->startContainer(ec); - Node* endContainer = currentTextRange->endContainer(ec); - int startOffset = currentTextRange->startOffset(ec); - int endOffset = currentTextRange->endOffset(ec); - - if (startContainer == endContainer && (startOffset == endOffset - 1)) { - Node* node = startContainer->childNode(startOffset); - if (node && node->hasTagName(imgTag)) { - NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<Element*>(node)); - NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper]; - [string appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]]; - [attachment release]; - } - } - - int currentTextLength = it.length(); - if (!currentTextLength) - continue; - - RenderObject* renderer = startContainer->renderer(); - ASSERT(renderer); - if (!renderer) - continue; - RenderStyle* style = renderer->style(); - NSFont *font = style->font().primaryFont()->getNSFont(); - [attrs.get() setObject:font forKey:NSFontAttributeName]; - if (style->visitedDependentColor(CSSPropertyColor).alpha()) - [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; - else - [attrs.get() removeObjectForKey:NSForegroundColorAttributeName]; - if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) - [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; - else - [attrs.get() removeObjectForKey:NSBackgroundColorAttributeName]; - - RetainPtr<NSString> substring(AdoptNS, [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(it.characters()) length:currentTextLength freeWhenDone:NO]); - [string replaceCharactersInRange:NSMakeRange(stringLength, 0) withString:substring.get()]; - [string setAttributes:attrs.get() range:NSMakeRange(stringLength, currentTextLength)]; - stringLength += currentTextLength; - } - - return [string autorelease]; -} - -@end diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h index 7828460..bf36fbd 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h @@ -28,7 +28,8 @@ #ifndef NetscapePluginInstanceProxy_h #define NetscapePluginInstanceProxy_h -#include <JavaScriptCore/Global.h> +#include <JavaScriptCore/JSGlobalData.h> +#include <JavaScriptCore/Strong.h> #include <WebCore/Timer.h> #include <WebKit/npapi.h> #include <wtf/Deque.h> @@ -327,7 +328,7 @@ private: JSC::JSObject* get(uint32_t) const; private: - HashMap<uint32_t, JSC::Global<JSC::JSObject> > m_idToJSObjectMap; + HashMap<uint32_t, JSC::Strong<JSC::JSObject> > m_idToJSObjectMap; // The pair consists of object ID and a reference count. One reference belongs to remote plug-in, // and the proxy will add transient references for arguments that are being sent out. HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> > m_jsObjectToIDMap; diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index ed646d3..63b0899 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -148,7 +148,7 @@ uint32_t NetscapePluginInstanceProxy::LocalObjectMap::idForObject(JSGlobalData& objectID = ++m_objectIDCounter; } while (!m_objectIDCounter || m_objectIDCounter == static_cast<uint32_t>(-1) || m_idToJSObjectMap.contains(objectID)); - m_idToJSObjectMap.set(objectID, Global<JSObject>(globalData, object)); + m_idToJSObjectMap.set(objectID, Strong<JSObject>(globalData, object)); m_jsObjectToIDMap.set(object, make_pair<uint32_t, uint32_t>(objectID, 1)); return objectID; @@ -188,7 +188,7 @@ bool NetscapePluginInstanceProxy::LocalObjectMap::forget(uint32_t objectID) return true; } - HashMap<uint32_t, JSC::Global<JSC::JSObject> >::iterator iter = m_idToJSObjectMap.find(objectID); + HashMap<uint32_t, JSC::Strong<JSC::JSObject> >::iterator iter = m_idToJSObjectMap.find(objectID); if (iter == m_idToJSObjectMap.end()) { LOG_ERROR("NetscapePluginInstanceProxy::LocalObjectMap::forget: local object %u doesn't exist.", objectID); return true; @@ -866,7 +866,7 @@ bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& scri JSLock lock(SilenceAssertionsOnly); - Global<JSGlobalObject> globalObject(*pluginWorld()->globalData(), frame->script()->globalObject(pluginWorld())); + Strong<JSGlobalObject> globalObject(*pluginWorld()->globalData(), frame->script()->globalObject(pluginWorld())); ExecState* exec = globalObject->globalExec(); bool oldAllowPopups = frame->script()->allowPopupsFromPlugin(); diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm index f26b85d..1f96c53 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm @@ -187,7 +187,7 @@ public: ASSERT(inherits(&s_info)); } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h index a07c86c..da6de88 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h @@ -41,7 +41,7 @@ public: ProxyInstance* getInternalProxyInstance() const; - static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/WebKit/mac/Plugins/Hosted/WebTextInputWindowController.m b/Source/WebKit/mac/Plugins/Hosted/WebTextInputWindowController.m index c168e6e..8b59d34 100644 --- a/Source/WebKit/mac/Plugins/Hosted/WebTextInputWindowController.m +++ b/Source/WebKit/mac/Plugins/Hosted/WebTextInputWindowController.m @@ -92,7 +92,14 @@ BOOL hadMarkedText = [_inputTextView hasMarkedText]; *string = nil; - + + // Let TSM know that a bottom input window would be created for marked text. + EventRef carbonEvent = (EventRef)[event eventRef]; + if (carbonEvent) { + Boolean ignorePAH = true; + SetEventParameter(carbonEvent, 'iPAH', typeBoolean, sizeof(ignorePAH), &ignorePAH); + } + if (![[_inputTextView inputContext] handleEvent:event]) return NO; diff --git a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index 59a80c9..f1eecde 100644 --- a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -619,9 +619,9 @@ String WebHaltablePlugin::pluginName() const // View will have no associated windows. [self stop]; - // Stop observing WebPreferencesChangedNotification -- we only need to observe this when installed in the view hierarchy. + // Stop observing WebPreferencesChangedInternalNotification -- we only need to observe this when installed in the view hierarchy. // When not in the view hierarchy, -viewWillMoveToWindow: and -viewDidMoveToWindow will start/stop the plugin as needed. - [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedInternalNotification object:nil]; } } } @@ -634,9 +634,9 @@ String WebHaltablePlugin::pluginName() const // There is no need to start the plug-in when moving into a superview. -viewDidMoveToWindow takes care of that. [self stop]; - // Stop observing WebPreferencesChangedNotification -- we only need to observe this when installed in the view hierarchy. + // Stop observing WebPreferencesChangedInternalNotification -- we only need to observe this when installed in the view hierarchy. // When not in the view hierarchy, -viewWillMoveToWindow: and -viewDidMoveToWindow will start/stop the plugin as needed. - [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedInternalNotification object:nil]; } } @@ -645,11 +645,11 @@ String WebHaltablePlugin::pluginName() const [self resetTrackingRect]; if ([self window]) { - // While in the view hierarchy, observe WebPreferencesChangedNotification so that we can start/stop depending + // While in the view hierarchy, observe WebPreferencesChangedInternalNotification so that we can start/stop depending // on whether plugins are enabled. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(preferencesHaveChanged:) - name:WebPreferencesChangedNotification + name:WebPreferencesChangedInternalNotification object:nil]; _isPrivateBrowsingEnabled = [[[self webView] preferences] privateBrowsingEnabled]; @@ -677,8 +677,8 @@ String WebHaltablePlugin::pluginName() const // View will have no associated windows. [self stop]; - // Remove WebPreferencesChangedNotification observer -- we will observe once again when we move back into the window - [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedNotification object:nil]; + // Remove WebPreferencesChangedInternalNotification observer -- we will observe once again when we move back into the window + [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedInternalNotification object:nil]; } } @@ -857,8 +857,13 @@ String WebHaltablePlugin::pluginName() const toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace { // Nothing to do - if (sourceSpace == destSpace) - return TRUE; + if (sourceSpace == destSpace) { + if (destX) + *destX = sourceX; + if (destY) + *destY = sourceY; + return YES; + } NSPoint sourcePoint = NSMakePoint(sourceX, sourceY); diff --git a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm index 3fb86cb..128834e 100644 --- a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm +++ b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm @@ -403,8 +403,9 @@ static inline void swapIntsInHeader(uint32_t* rawData, size_t length) if (magic == FAT_CIGAM) swapIntsInHeader(rawData.data(), rawData.size()); - archs = (struct fat_arch*)((uint8_t*)rawData.data() + sizeof(struct fat_header)); - numArchs = ((struct fat_header *)rawData.data())->nfat_arch; + COMPILE_ASSERT(sizeof(struct fat_header) % sizeof(uint32_t) == 0, struct_fat_header_must_be_integral_size_of_uint32_t); + archs = reinterpret_cast<struct fat_arch*>(rawData.data() + sizeof(struct fat_header) / sizeof(uint32_t)); + numArchs = reinterpret_cast<struct fat_header*>(rawData.data())->nfat_arch; unsigned maxArchs = (sizeInBytes - sizeof(struct fat_header)) / sizeof(struct fat_arch); if (numArchs > maxArchs) diff --git a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h index 8adb79f..15b2c67 100644 --- a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h +++ b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h @@ -27,8 +27,8 @@ #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 <AppKit/NSSpellChecker.h> +#import <WebCore/SpellingCorrectionController.h> #import <wtf/RetainPtr.h> @class WebView; @@ -46,7 +46,7 @@ public: private: bool isShowing() const { return m_view; } void dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally); - void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType); + void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType); bool m_wasDismissedExternally; WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissing; diff --git a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm index 05f3f69..ce52b74 100644 --- a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm +++ b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm @@ -29,18 +29,18 @@ #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) using namespace WebCore; -static inline NSCorrectionBubbleType correctionBubbleType(CorrectionPanelInfo::PanelType panelType) +static inline NSCorrectionIndicatorType correctionIndicatorType(CorrectionPanelInfo::PanelType panelType) { switch (panelType) { case CorrectionPanelInfo::PanelTypeCorrection: - return NSCorrectionBubbleTypeCorrection; + return NSCorrectionIndicatorTypeDefault; case CorrectionPanelInfo::PanelTypeReversion: - return NSCorrectionBubbleTypeReversion; + return NSCorrectionIndicatorTypeReversion; case CorrectionPanelInfo::PanelTypeSpellingSuggestions: - return NSCorrectionBubbleTypeGuesses; + return NSCorrectionIndicatorTypeGuesses; } ASSERT_NOT_REACHED(); - return NSCorrectionBubbleTypeCorrection; + return NSCorrectionIndicatorTypeDefault; } CorrectionPanel::CorrectionPanel() @@ -65,7 +65,7 @@ void CorrectionPanel::show(WebView* view, CorrectionPanelInfo::PanelType type, c NSString* replacedStringAsNSString = replacedString; NSString* replacementStringAsNSString = replacementString; m_view = view; - NSCorrectionBubbleType bubbleType = correctionBubbleType(type); + NSCorrectionIndicatorType indicatorType = correctionIndicatorType(type); NSMutableArray* alternativeStrings = 0; if (!alternativeReplacementStrings.isEmpty()) { @@ -75,8 +75,8 @@ void CorrectionPanel::show(WebView* view, CorrectionPanelInfo::PanelType type, c [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); + [[NSSpellChecker sharedSpellChecker] showCorrectionIndicatorOfType:indicatorType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:[view convertRect:boundingBoxOfReplacedString fromView:nil] view:m_view.get() completionHandler:^(NSString* acceptedString) { + handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, indicatorType); }]; } @@ -106,7 +106,7 @@ void CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, m_reasonForDismissing = reason; m_resultForSynchronousDismissal.clear(); - [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_view.get()]; + [[NSSpellChecker sharedSpellChecker] dismissCorrectionIndicatorForView:m_view.get()]; m_view.clear(); } @@ -115,13 +115,13 @@ void CorrectionPanel::recordAutocorrectionResponse(WebView* view, NSCorrectionRe [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view spellCheckerDocumentTag]]; } -void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType correctionBubbleType) +void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType correctionIndicatorType) { NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker]; NSInteger documentTag = [m_view.get() spellCheckerDocumentTag]; - switch (correctionBubbleType) { - case NSCorrectionBubbleTypeCorrection: + switch (correctionIndicatorType) { + case NSCorrectionIndicatorTypeDefault: if (acceptedReplacement) [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; else { @@ -131,11 +131,11 @@ void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, N [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; } break; - case NSCorrectionBubbleTypeReversion: + case NSCorrectionIndicatorTypeReversion: if (acceptedReplacement) [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replaced forWord:acceptedReplacement language:nil inSpellDocumentWithTag:documentTag]; break; - case NSCorrectionBubbleTypeGuesses: + case NSCorrectionIndicatorTypeGuesses: if (acceptedReplacement) [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag]; break; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h index 412cb45..0e52102 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -130,7 +130,7 @@ public: virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); - virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, WTF::Vector<WebCore::TextCheckingResult>& results); + virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, WTF::Vector<WebCore::TextCheckingResult>& results); virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&); virtual void updateSpellingUIWithMisspelledWord(const WTF::String&); virtual void showSpellingUI(bool show); @@ -138,7 +138,7 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&); + virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, 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 String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings); virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel); diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index c205ef6..2300be1 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -69,28 +69,15 @@ #import <runtime/InitializeThreading.h> #import <wtf/PassRefPtr.h> #import <wtf/Threading.h> -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) -#import <AppKit/NSTextChecker.h> -#endif using namespace WebCore; using namespace HTMLNames; #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) -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; -} +@interface NSSpellChecker (WebNSSpellCheckerDetails) +- (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography; +@end #endif @interface NSAttributedString (WebNSAttributedStringDetails) @@ -790,12 +777,11 @@ void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector #endif } -void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) -{ #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]; - NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString range:NSMakeRange(0, [textString length]) types:(checkingTypes|NSTextCheckingTypeOrthography) options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL]; - [textString release]; +static Vector<TextCheckingResult> core(NSArray *incomingResults, TextCheckingTypeMask checkingTypes) +{ + Vector<TextCheckingResult> results; + for (NSTextCheckingResult *incomingResult in incomingResults) { NSRange resultRange = [incomingResult range]; NSTextCheckingType resultType = [incomingResult resultType]; @@ -867,6 +853,18 @@ void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, uint64 results.append(result); } } + + return results; +} +#endif + +void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) +{ +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]; + NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString range:NSMakeRange(0, [textString length]) types:(checkingTypes|NSTextCheckingTypeOrthography) options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL]; + [textString release]; + results = core(incomingResults, checkingTypes); #endif } @@ -965,58 +963,35 @@ void WebEditorClient::setInputMethodState(bool) { WebCore::SpellChecker* _sender; int _sequence; + TextCheckingTypeMask _types; RetainPtr<NSArray> _results; } -- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence results:(NSArray*)results; +- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence types:(WebCore::TextCheckingTypeMask)types results:(NSArray*)results; - (void)perform; -- (WTF::Vector<WebCore::SpellCheckingResult>) _coreResults; @end @implementation WebEditorSpellCheckResponder -- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence results:(NSArray*)results +- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence types:(WebCore::TextCheckingTypeMask)types results:(NSArray*)results { self = [super init]; if (!self) return nil; _sender = sender; _sequence = sequence; + _types = types; _results = results; return self; } - (void)perform { - _sender->didCheck(_sequence, [self _coreResults]); -} - -static SpellCheckingResult toCoreSpellingResult(NSTextCheckingResult* result) -{ - NSTextCheckingType type = [result resultType]; - NSRange range = [result range]; - DocumentMarker::MarkerType coreType; - if (type & NSTextCheckingTypeSpelling) - coreType = DocumentMarker::Spelling; - else if (type & NSTextCheckingTypeGrammar) - coreType = DocumentMarker::Grammar; - else - coreType = DocumentMarker::AllMarkers; - - return SpellCheckingResult(coreType, range.location, range.length); -} - -- (WTF::Vector<WebCore::SpellCheckingResult>)_coreResults -{ - WTF::Vector<WebCore::SpellCheckingResult> coreResults; - coreResults.reserveCapacity([_results.get() count]); - for (NSTextCheckingResult* result in _results.get()) - coreResults.append(toCoreSpellingResult(result)); - return coreResults; + _sender->didCheck(_sequence, core(_results.get(), _types)); } @end #endif -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, int sequence, const String& text) +void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, int sequence, WebCore::TextCheckingTypeMask checkingTypes, const String& text) { #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) NSRange range = NSMakeRange(0, text.length()); @@ -1024,7 +999,7 @@ void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, int [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:text range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) { [currentLoop performSelector:@selector(perform) - target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence results:results] autorelease] + target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence types:checkingTypes results:results] autorelease] argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; }]; #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index 4fe5664..c415c10 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -83,7 +83,7 @@ private: virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&); #endif virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); - virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); + virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength); virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); @@ -101,7 +101,7 @@ private: virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); - virtual void dispatchDidReceiveTitle(const WTF::String& title); + virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&); virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); @@ -196,7 +196,7 @@ private: virtual void prepareForDataSourceReplacement(); virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); - virtual void setTitle(const WTF::String& title, const WebCore::KURL&); + virtual void setTitle(const WebCore::StringWithDirection&, const WebCore::KURL&); virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement*, const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 92c2b03..1b5766a 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -491,13 +491,13 @@ NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader* loa return response; } -void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int lengthReceived) +void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int dataLength) { WebView *webView = getWebView(m_webFrame.get()); WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView); if (implementations->didReceiveContentLengthFunc) { if (id resource = [webView _objectForIdentifier:identifier]) - CallResourceLoadDelegate(implementations->didReceiveContentLengthFunc, webView, @selector(webView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)lengthReceived, dataSource(loader)); + CallResourceLoadDelegate(implementations->didReceiveContentLengthFunc, webView, @selector(webView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)dataLength, dataSource(loader)); } } @@ -624,12 +624,13 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() CallFrameLoadDelegate(implementations->didStartProvisionalLoadForFrameFunc, webView, @selector(webView:didStartProvisionalLoadForFrame:), m_webFrame.get()); } -void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) +void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& title) { WebView *webView = getWebView(m_webFrame.get()); WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); if (implementations->didReceiveTitleForFrameFunc) - CallFrameLoadDelegate(implementations->didReceiveTitleForFrameFunc, webView, @selector(webView:didReceiveTitle:forFrame:), (NSString *)title, m_webFrame.get()); + // FIXME: use direction of title. + CallFrameLoadDelegate(implementations->didReceiveTitleForFrameFunc, webView, @selector(webView:didReceiveTitle:forFrame:), (NSString *)title.string(), m_webFrame.get()); } void WebFrameLoaderClient::dispatchDidChangeIcons() @@ -893,7 +894,7 @@ void WebFrameLoaderClient::updateGlobalHistory() WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view); if (implementations->navigatedFunc) { WebNavigationData *data = [[WebNavigationData alloc] initWithURLString:loader->urlForHistory() - title:loader->title() + title:loader->title().string() originalRequest:loader->originalRequestCopy().nsURLRequest() response:loader->response().nsURLResponse() hasSubstituteData:loader->substituteData().isValid() @@ -907,7 +908,7 @@ void WebFrameLoaderClient::updateGlobalHistory() } [[WebHistory optionalSharedHistory] _visitedURL:loader->urlForHistory() - withTitle:loader->title() + withTitle:loader->title().string() method:loader->originalRequestCopy().httpMethod() wasFailure:loader->urlForHistoryReflectsFailure() increaseVisitCount:!loader->clientRedirectSourceForHistory()]; // Do not increase visit count due to navigations that were not initiated by the user directly, avoiding growth from programmatic reloads. @@ -1179,7 +1180,7 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const Reso return loader.release(); } -void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) +void WebFrameLoaderClient::setTitle(const StringWithDirection& title, const KURL& url) { WebView* view = getWebView(m_webFrame.get()); @@ -1188,7 +1189,8 @@ void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) if (!implementations->setTitleFunc) return; - CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title, (NSString *)url); + // FIXME: use direction of title. + CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title.string(), (NSString *)url); return; } @@ -1196,7 +1198,7 @@ void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) nsURL = [nsURL _webkit_canonicalize]; if(!nsURL) return; - NSString *titleNSString = title; + NSString *titleNSString = title.string(); [[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString]; } @@ -1285,7 +1287,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() // like the ones that Safari uses for bookmarks it is the only way the DocumentLoader // will get the proper title. if (DocumentLoader* documentLoader = [dataSource _documentLoader]) - documentLoader->setTitle([dataSource pageTitle]); + documentLoader->setTitle(StringWithDirection([dataSource pageTitle], LTR)); } if (HTMLFrameOwnerElement* owner = coreFrame->ownerElement()) diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 9b0c893..e701495 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -36,7 +36,7 @@ #import "WebInspectorPrivate.h" #import "WebInspectorFrontend.h" #import "WebLocalizableStringsInternal.h" -#import "WebNodeHighlight.h" +#import "WebNodeHighlighter.h" #import "WebUIDelegate.h" #import "WebViewInternal.h" #import <WebCore/InspectorController.h> @@ -70,25 +70,13 @@ using namespace WebCore; - (void)destroyInspectorView:(bool)notifyInspectorController; @end -// MARK: - - -@interface WebNodeHighlighter : NSObject { -@private - WebView *_inspectedWebView; - WebNodeHighlight *_currentHighlight; -} -- (id)initWithInspectedWebView:(WebView *)webView; -- (void)highlightNode:(DOMNode *)node; -- (void)hideHighlight; -@end // MARK: - - WebInspectorClient::WebInspectorClient(WebView *webView) -: m_webView(webView) -, m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView]) -, m_frontendPage(0) + : m_webView(webView) + , m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView]) + , m_frontendPage(0) { } @@ -228,7 +216,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const @implementation WebInspectorWindowController - (id)init { - if (![super initWithWindow:nil]) + if (!(self = [super initWithWindow:nil])) return nil; // Keep preferences separate from the rest of the client, making sure we are using expected preference values. @@ -272,10 +260,10 @@ void WebInspectorFrontendClient::updateWindowTitle() const - (id)initWithInspectedWebView:(WebView *)webView { - if (![self init]) + if (!(self = [self init])) return nil; - // Don't retain to avoid a circular reference + // Don't retain to avoid a circular reference. _inspectedWebView = webView; return self; } @@ -482,19 +470,6 @@ void WebInspectorFrontendClient::updateWindowTitle() const } // MARK: - -// MARK: WebNodeHighlight delegate - -- (void)didAttachWebNodeHighlight:(WebNodeHighlight *)highlight -{ - [_inspectedWebView setCurrentNodeHighlight:highlight]; -} - -- (void)willDetachWebNodeHighlight:(WebNodeHighlight *)highlight -{ - [_inspectedWebView setCurrentNodeHighlight:nil]; -} - -// MARK: - // MARK: UI delegate - (NSUInteger)webView:(WebView *)sender dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo @@ -548,60 +523,3 @@ void WebInspectorFrontendClient::updateWindowTitle() const } @end - - -// MARK: - - -@implementation WebNodeHighlighter -- (id)initWithInspectedWebView:(WebView *)webView -{ - // Don't retain to avoid a circular reference - _inspectedWebView = webView; - return self; -} - -- (void)dealloc -{ - ASSERT(!_currentHighlight); - [super dealloc]; -} - -// MARK: - - -- (void)highlightNode:(DOMNode *)node -{ - // The scrollview's content view stays around between page navigations, so target it - NSView *view = [[[[[_inspectedWebView mainFrame] frameView] documentView] enclosingScrollView] contentView]; - if (![view window]) - return; // skip the highlight if we have no window (e.g. hidden tab) - - if (!_currentHighlight) { - _currentHighlight = [[WebNodeHighlight alloc] initWithTargetView:view inspectorController:[_inspectedWebView page]->inspectorController()]; - [_currentHighlight setDelegate:self]; - [_currentHighlight attach]; - } else - [[_currentHighlight highlightView] setNeedsDisplay:YES]; -} - -- (void)hideHighlight -{ - [_currentHighlight detach]; - [_currentHighlight setDelegate:nil]; - [_currentHighlight release]; - _currentHighlight = nil; -} - -// MARK: - -// MARK: WebNodeHighlight delegate - -- (void)didAttachWebNodeHighlight:(WebNodeHighlight *)highlight -{ - [_inspectedWebView setCurrentNodeHighlight:highlight]; -} - -- (void)willDetachWebNodeHighlight:(WebNodeHighlight *)highlight -{ - [_inspectedWebView setCurrentNodeHighlight:nil]; -} - -@end diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index 29bdb8a..87471f6 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -29,10 +29,9 @@ #include <WebCore/CookiesStrategy.h> #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> -#include <WebCore/LocalizationStrategy.h> #include <WebCore/VisitedLinkStrategy.h> -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy { public: static void initialize(); @@ -42,7 +41,6 @@ private: // WebCore::PlatformStrategies virtual WebCore::CookiesStrategy* createCookiesStrategy(); virtual WebCore::PluginStrategy* createPluginStrategy(); - virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy(); // WebCore::CookiesStrategy @@ -52,125 +50,6 @@ private: virtual void refreshPlugins(); virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&); - // WebCore::LocalizationStrategy - virtual WTF::String inputElementAltText(); - virtual WTF::String resetButtonDefaultLabel(); - virtual WTF::String searchableIndexIntroduction(); - virtual WTF::String submitButtonDefaultLabel(); - virtual WTF::String fileButtonChooseFileLabel(); - virtual WTF::String fileButtonNoFileSelectedLabel(); - virtual WTF::String copyImageUnknownFileLabel(); - virtual WTF::String defaultDetailsSummaryText(); -#if ENABLE(CONTEXT_MENUS) - virtual WTF::String contextMenuItemTagOpenLinkInNewWindow(); - virtual WTF::String contextMenuItemTagDownloadLinkToDisk(); - virtual WTF::String contextMenuItemTagCopyLinkToClipboard(); - virtual WTF::String contextMenuItemTagOpenImageInNewWindow(); - virtual WTF::String contextMenuItemTagDownloadImageToDisk(); - virtual WTF::String contextMenuItemTagCopyImageToClipboard(); - virtual WTF::String contextMenuItemTagOpenFrameInNewWindow(); - virtual WTF::String contextMenuItemTagCopy(); - virtual WTF::String contextMenuItemTagGoBack(); - virtual WTF::String contextMenuItemTagGoForward(); - virtual WTF::String contextMenuItemTagStop(); - virtual WTF::String contextMenuItemTagReload(); - virtual WTF::String contextMenuItemTagCut(); - virtual WTF::String contextMenuItemTagPaste(); - virtual WTF::String contextMenuItemTagNoGuessesFound(); - virtual WTF::String contextMenuItemTagIgnoreSpelling(); - virtual WTF::String contextMenuItemTagLearnSpelling(); - virtual WTF::String contextMenuItemTagSearchWeb(); - virtual WTF::String contextMenuItemTagLookUpInDictionary(const WTF::String& selectedString); - virtual WTF::String contextMenuItemTagOpenLink(); - virtual WTF::String contextMenuItemTagIgnoreGrammar(); - virtual WTF::String contextMenuItemTagSpellingMenu(); - virtual WTF::String contextMenuItemTagShowSpellingPanel(bool show); - virtual WTF::String contextMenuItemTagCheckSpelling(); - virtual WTF::String contextMenuItemTagCheckSpellingWhileTyping(); - virtual WTF::String contextMenuItemTagCheckGrammarWithSpelling(); - virtual WTF::String contextMenuItemTagFontMenu(); - virtual WTF::String contextMenuItemTagBold(); - virtual WTF::String contextMenuItemTagItalic(); - virtual WTF::String contextMenuItemTagUnderline(); - virtual WTF::String contextMenuItemTagOutline(); - virtual WTF::String contextMenuItemTagWritingDirectionMenu(); - virtual WTF::String contextMenuItemTagTextDirectionMenu(); - virtual WTF::String contextMenuItemTagDefaultDirection(); - virtual WTF::String contextMenuItemTagLeftToRight(); - virtual WTF::String contextMenuItemTagRightToLeft(); - virtual WTF::String contextMenuItemTagSearchInSpotlight(); - virtual WTF::String contextMenuItemTagShowFonts(); - virtual WTF::String contextMenuItemTagStyles(); - virtual WTF::String contextMenuItemTagShowColors(); - virtual WTF::String contextMenuItemTagSpeechMenu(); - virtual WTF::String contextMenuItemTagStartSpeaking(); - virtual WTF::String contextMenuItemTagStopSpeaking(); - virtual WTF::String contextMenuItemTagCorrectSpellingAutomatically(); - virtual WTF::String contextMenuItemTagSubstitutionsMenu(); - virtual WTF::String contextMenuItemTagShowSubstitutions(bool show); - virtual WTF::String contextMenuItemTagSmartCopyPaste(); - virtual WTF::String contextMenuItemTagSmartQuotes(); - virtual WTF::String contextMenuItemTagSmartDashes(); - virtual WTF::String contextMenuItemTagSmartLinks(); - virtual WTF::String contextMenuItemTagTextReplacement(); - virtual WTF::String contextMenuItemTagTransformationsMenu(); - virtual WTF::String contextMenuItemTagMakeUpperCase(); - virtual WTF::String contextMenuItemTagMakeLowerCase(); - virtual WTF::String contextMenuItemTagCapitalize(); - virtual WTF::String contextMenuItemTagChangeBack(const WTF::String& replacedString); - virtual WTF::String contextMenuItemTagInspectElement(); - virtual WTF::String contextMenuItemTagOpenVideoInNewWindow(); - virtual WTF::String contextMenuItemTagOpenAudioInNewWindow(); - virtual WTF::String contextMenuItemTagCopyVideoLinkToClipboard(); - virtual WTF::String contextMenuItemTagCopyAudioLinkToClipboard(); - virtual WTF::String contextMenuItemTagToggleMediaControls(); - virtual WTF::String contextMenuItemTagToggleMediaLoop(); - virtual WTF::String contextMenuItemTagEnterVideoFullscreen(); - virtual WTF::String contextMenuItemTagMediaPlay(); - virtual WTF::String contextMenuItemTagMediaPause(); - virtual WTF::String contextMenuItemTagMediaMute(); -#endif // ENABLE(CONTEXT_MENUS) - virtual WTF::String searchMenuNoRecentSearchesText(); - virtual WTF::String searchMenuRecentSearchesText(); - virtual WTF::String searchMenuClearRecentSearchesText(); - virtual WTF::String AXWebAreaText(); - virtual WTF::String AXLinkText(); - virtual WTF::String AXListMarkerText(); - virtual WTF::String AXImageMapText(); - virtual WTF::String AXHeadingText(); - virtual WTF::String AXDefinitionListTermText(); - virtual WTF::String AXDefinitionListDefinitionText(); - virtual WTF::String AXARIAContentGroupText(const WTF::String& ariaType); - virtual WTF::String AXButtonActionVerb(); - virtual WTF::String AXRadioButtonActionVerb(); - virtual WTF::String AXTextFieldActionVerb(); - virtual WTF::String AXCheckedCheckBoxActionVerb(); - virtual WTF::String AXUncheckedCheckBoxActionVerb(); - virtual WTF::String AXMenuListActionVerb(); - virtual WTF::String AXMenuListPopupActionVerb(); - virtual WTF::String AXLinkActionVerb(); - virtual WTF::String missingPluginText(); - 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(); - virtual WTF::String localizedMediaControlElementString(const WTF::String&); - virtual WTF::String localizedMediaControlElementHelpText(const WTF::String&); - virtual WTF::String localizedMediaTimeDescription(float); - virtual WTF::String validationMessageValueMissingText(); - virtual WTF::String validationMessageTypeMismatchText(); - virtual WTF::String validationMessagePatternMismatchText(); - virtual WTF::String validationMessageTooLongText(); - virtual WTF::String validationMessageRangeUnderflowText(); - virtual WTF::String validationMessageRangeOverflowText(); - virtual WTF::String validationMessageStepMismatchText(); - // WebCore::VisitedLinkStrategy virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash); virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash); diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index 59ba436..f8e1a7a 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -25,14 +25,11 @@ #import "WebPlatformStrategies.h" -#import "WebLocalizableStringsInternal.h" #import "WebPluginDatabase.h" #import "WebPluginPackage.h" #import <WebCore/BlockExceptions.h> -#import <WebCore/IntSize.h> #import <WebCore/Page.h> #import <WebCore/PageGroup.h> -#import <wtf/StdLibExtras.h> using namespace WebCore; @@ -56,11 +53,6 @@ PluginStrategy* WebPlatformStrategies::createPluginStrategy() return this; } -LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy() -{ - return this; -} - VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() { return this; @@ -89,775 +81,6 @@ void WebPlatformStrategies::getPluginInfo(const WebCore::Page*, Vector<WebCore:: END_BLOCK_OBJC_EXCEPTIONS; } -// LocalizationStrategy - -String WebPlatformStrategies::inputElementAltText() -{ - return UI_STRING_KEY_INTERNAL("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value"); -} - -String WebPlatformStrategies::resetButtonDefaultLabel() -{ - return UI_STRING_INTERNAL("Reset", "default label for Reset buttons in forms on web pages"); -} - -String WebPlatformStrategies::searchableIndexIntroduction() -{ - return UI_STRING_INTERNAL("This is a searchable index. Enter search keywords: ", - "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'"); -} - -String WebPlatformStrategies::submitButtonDefaultLabel() -{ - return UI_STRING_INTERNAL("Submit", "default label for Submit buttons in forms on web pages"); -} - -String WebPlatformStrategies::defaultDetailsSummaryText() -{ - return UI_STRING_INTERNAL("Details", "text to display in <details> tag when it has no <summary> child"); -} - -String WebPlatformStrategies::fileButtonChooseFileLabel() -{ - return UI_STRING_INTERNAL("Choose File", "title for file button used in HTML forms"); -} - -String WebPlatformStrategies::fileButtonNoFileSelectedLabel() -{ - return UI_STRING_INTERNAL("no file selected", "text to display in file button used in HTML forms when no file is selected"); -} - -String WebPlatformStrategies::copyImageUnknownFileLabel() -{ - return UI_STRING_INTERNAL("unknown", "Unknown filename"); -} - -#if ENABLE(CONTEXT_MENUS) - -String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow() -{ - return UI_STRING_INTERNAL("Open Link in New Window", "Open in New Window context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagDownloadLinkToDisk() -{ - return UI_STRING_INTERNAL("Download Linked File", "Download Linked File context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCopyLinkToClipboard() -{ - return UI_STRING_INTERNAL("Copy Link", "Copy Link context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagOpenImageInNewWindow() -{ - return UI_STRING_INTERNAL("Open Image in New Window", "Open Image in New Window context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagDownloadImageToDisk() -{ - return UI_STRING_INTERNAL("Download Image", "Download Image context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard() -{ - return UI_STRING_INTERNAL("Copy Image", "Copy Image context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow() -{ - return UI_STRING_INTERNAL("Open Video in New Window", "Open Video in New Window context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow() -{ - return UI_STRING_INTERNAL("Open Audio in New Window", "Open Audio in New Window context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard() -{ - return UI_STRING_INTERNAL("Copy Video Address", "Copy Video Address Location context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard() -{ - return UI_STRING_INTERNAL("Copy Audio Address", "Copy Audio Address Location context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagToggleMediaControls() -{ - return UI_STRING_INTERNAL("Controls", "Media Controls context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop() -{ - return UI_STRING_INTERNAL("Loop", "Media Loop context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen() -{ - return UI_STRING_INTERNAL("Enter Fullscreen", "Video Enter Fullscreen context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagMediaPlay() -{ - return UI_STRING_INTERNAL("Play", "Media Play context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagMediaPause() -{ - return UI_STRING_INTERNAL("Pause", "Media Pause context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagMediaMute() -{ - return UI_STRING_INTERNAL("Mute", "Media Mute context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow() -{ - return UI_STRING_INTERNAL("Open Frame in New Window", "Open Frame in New Window context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCopy() -{ - return UI_STRING_INTERNAL("Copy", "Copy context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagGoBack() -{ - return UI_STRING_INTERNAL("Back", "Back context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagGoForward() -{ - return UI_STRING_INTERNAL("Forward", "Forward context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagStop() -{ - return UI_STRING_INTERNAL("Stop", "Stop context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagReload() -{ - return UI_STRING_INTERNAL("Reload", "Reload context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCut() -{ - return UI_STRING_INTERNAL("Cut", "Cut context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagPaste() -{ - return UI_STRING_INTERNAL("Paste", "Paste context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagNoGuessesFound() -{ - return UI_STRING_INTERNAL("No Guesses Found", "No Guesses Found context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagIgnoreSpelling() -{ - return UI_STRING_INTERNAL("Ignore Spelling", "Ignore Spelling context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagLearnSpelling() -{ - return UI_STRING_INTERNAL("Learn Spelling", "Learn Spelling context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSearchWeb() -{ - return UI_STRING_INTERNAL("Search in Google", "Search in Google context menu item"); -} - -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() -{ - return UI_STRING_INTERNAL("Open Link", "Open Link context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagIgnoreGrammar() -{ - return UI_STRING_INTERNAL("Ignore Grammar", "Ignore Grammar context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSpellingMenu() -{ -#ifndef BUILDING_ON_TIGER - return UI_STRING_INTERNAL("Spelling and Grammar", "Spelling and Grammar context sub-menu item"); -#else - return UI_STRING_INTERNAL("Spelling", "Spelling context sub-menu item"); -#endif -} - -String WebPlatformStrategies::contextMenuItemTagShowSpellingPanel(bool show) -{ -#ifndef BUILDING_ON_TIGER - if (show) - return UI_STRING_INTERNAL("Show Spelling and Grammar", "menu item title"); - return UI_STRING_INTERNAL("Hide Spelling and Grammar", "menu item title"); -#else - return UI_STRING_INTERNAL("Spelling...", "menu item title"); -#endif -} - -String WebPlatformStrategies::contextMenuItemTagCheckSpelling() -{ -#ifndef BUILDING_ON_TIGER - return UI_STRING_INTERNAL("Check Document Now", "Check spelling context menu item"); -#else - return UI_STRING_INTERNAL("Check Spelling", "Check spelling context menu item"); -#endif -} - -String WebPlatformStrategies::contextMenuItemTagCheckSpellingWhileTyping() -{ -#ifndef BUILDING_ON_TIGER - return UI_STRING_INTERNAL("Check Spelling While Typing", "Check spelling while typing context menu item"); -#else - return UI_STRING_INTERNAL("Check Spelling as You Type", "Check spelling while typing context menu item"); -#endif -} - -String WebPlatformStrategies::contextMenuItemTagCheckGrammarWithSpelling() -{ - return UI_STRING_INTERNAL("Check Grammar With Spelling", "Check grammar with spelling context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagFontMenu() -{ - return UI_STRING_INTERNAL("Font", "Font context sub-menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagBold() -{ - return UI_STRING_INTERNAL("Bold", "Bold context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagItalic() -{ - return UI_STRING_INTERNAL("Italic", "Italic context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagUnderline() -{ - return UI_STRING_INTERNAL("Underline", "Underline context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagOutline() -{ - return UI_STRING_INTERNAL("Outline", "Outline context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagWritingDirectionMenu() -{ -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - return UI_STRING_INTERNAL("Paragraph Direction", "Paragraph direction context sub-menu item"); -#else - return UI_STRING_INTERNAL("Writing Direction", "Writing direction context sub-menu item"); -#endif -} - -String WebPlatformStrategies::contextMenuItemTagTextDirectionMenu() -{ - return UI_STRING_INTERNAL("Selection Direction", "Selection direction context sub-menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagDefaultDirection() -{ - return UI_STRING_INTERNAL("Default", "Default writing direction context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagLeftToRight() -{ - return UI_STRING_INTERNAL("Left to Right", "Left to Right context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagRightToLeft() -{ - return UI_STRING_INTERNAL("Right to Left", "Right to Left context menu item"); -} - -#if PLATFORM(MAC) - -String WebPlatformStrategies::contextMenuItemTagSearchInSpotlight() -{ - return UI_STRING_INTERNAL("Search in Spotlight", "Search in Spotlight context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagShowFonts() -{ - return UI_STRING_INTERNAL("Show Fonts", "Show fonts context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagStyles() -{ - return UI_STRING_INTERNAL("Styles...", "Styles context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagShowColors() -{ - return UI_STRING_INTERNAL("Show Colors", "Show colors context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSpeechMenu() -{ - return UI_STRING_INTERNAL("Speech", "Speech context sub-menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagStartSpeaking() -{ - return UI_STRING_INTERNAL("Start Speaking", "Start speaking context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagStopSpeaking() -{ - return UI_STRING_INTERNAL("Stop Speaking", "Stop speaking context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCorrectSpellingAutomatically() -{ - return UI_STRING_INTERNAL("Correct Spelling Automatically", "Correct Spelling Automatically context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSubstitutionsMenu() -{ - return UI_STRING_INTERNAL("Substitutions", "Substitutions context sub-menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagShowSubstitutions(bool show) -{ - if (show) - return UI_STRING_INTERNAL("Show Substitutions", "menu item title"); - return UI_STRING_INTERNAL("Hide Substitutions", "menu item title"); -} - -String WebPlatformStrategies::contextMenuItemTagSmartCopyPaste() -{ - return UI_STRING_INTERNAL("Smart Copy/Paste", "Smart Copy/Paste context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSmartQuotes() -{ - return UI_STRING_INTERNAL("Smart Quotes", "Smart Quotes context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSmartDashes() -{ - return UI_STRING_INTERNAL("Smart Dashes", "Smart Dashes context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagSmartLinks() -{ - return UI_STRING_INTERNAL("Smart Links", "Smart Links context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagTextReplacement() -{ - return UI_STRING_INTERNAL("Text Replacement", "Text Replacement context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagTransformationsMenu() -{ - return UI_STRING_INTERNAL("Transformations", "Transformations context sub-menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagMakeUpperCase() -{ - return UI_STRING_INTERNAL("Make Upper Case", "Make Upper Case context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagMakeLowerCase() -{ - return UI_STRING_INTERNAL("Make Lower Case", "Make Lower Case context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagCapitalize() -{ - return UI_STRING_INTERNAL("Capitalize", "Capitalize context menu item"); -} - -String WebPlatformStrategies::contextMenuItemTagChangeBack(const String& replacedString) -{ - static NSString *formatString = nil; -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - static bool lookedUpString = false; - if (!lookedUpString) { - formatString = [[[NSBundle bundleForClass:[NSSpellChecker class]] localizedStringForKey:@"Change Back to \\U201C%@\\U201D" value:nil table:@"MenuCommands"] retain]; - lookedUpString = true; - } -#endif - if (!formatString) - return replacedString; - return [NSString stringWithFormat:formatString, (NSString *)replacedString]; -} - -#endif - -String WebPlatformStrategies::contextMenuItemTagInspectElement() -{ - return UI_STRING_INTERNAL("Inspect Element", "Inspect Element context menu item"); -} - -#endif // ENABLE(CONTEXT_MENUS) - -String WebPlatformStrategies::searchMenuNoRecentSearchesText() -{ - return UI_STRING_INTERNAL("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed"); -} - -String WebPlatformStrategies::searchMenuRecentSearchesText() -{ - return UI_STRING_INTERNAL("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title"); -} - -String WebPlatformStrategies::searchMenuClearRecentSearchesText() -{ - return UI_STRING_INTERNAL("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents"); -} - -String WebPlatformStrategies::AXWebAreaText() -{ - return UI_STRING_INTERNAL("HTML content", "accessibility role description for web area"); -} - -String WebPlatformStrategies::AXLinkText() -{ - return UI_STRING_INTERNAL("link", "accessibility role description for link"); -} - -String WebPlatformStrategies::AXListMarkerText() -{ - return UI_STRING_INTERNAL("list marker", "accessibility role description for list marker"); -} - -String WebPlatformStrategies::AXImageMapText() -{ - return UI_STRING_INTERNAL("image map", "accessibility role description for image map"); -} - -String WebPlatformStrategies::AXHeadingText() -{ - return UI_STRING_INTERNAL("heading", "accessibility role description for headings"); -} - -String WebPlatformStrategies::AXDefinitionListTermText() -{ - return UI_STRING_INTERNAL("term", "term word of a definition"); -} - -String WebPlatformStrategies::AXDefinitionListDefinitionText() -{ - return UI_STRING_INTERNAL("definition", "definition phrase"); -} - -String WebPlatformStrategies::AXARIAContentGroupText(const String& ariaType) -{ - if (ariaType == "ARIAApplicationAlert") - return UI_STRING_INTERNAL("alert", "An ARIA accessibility group that acts as an alert."); - if (ariaType == "ARIAApplicationAlertDialog") - return UI_STRING_INTERNAL("alert dialog", "An ARIA accessibility group that acts as an alert dialog."); - if (ariaType == "ARIAApplicationDialog") - return UI_STRING_INTERNAL("dialog", "An ARIA accessibility group that acts as an dialog."); - if (ariaType == "ARIAApplicationLog") - return UI_STRING_INTERNAL("log", "An ARIA accessibility group that acts as a console log."); - if (ariaType == "ARIAApplicationMarquee") - return UI_STRING_INTERNAL("marquee", "An ARIA accessibility group that acts as a marquee."); - if (ariaType == "ARIAApplicationStatus") - return UI_STRING_INTERNAL("application status", "An ARIA accessibility group that acts as a status update."); - if (ariaType == "ARIAApplicationTimer") - return UI_STRING_INTERNAL("timer", "An ARIA accessibility group that acts as an updating timer."); - if (ariaType == "ARIADocument") - return UI_STRING_INTERNAL("document", "An ARIA accessibility group that acts as a document."); - if (ariaType == "ARIADocumentArticle") - return UI_STRING_INTERNAL("article", "An ARIA accessibility group that acts as an article."); - if (ariaType == "ARIADocumentNote") - return UI_STRING_INTERNAL("note", "An ARIA accessibility group that acts as a note in a document."); - if (ariaType == "ARIADocumentRegion") - return UI_STRING_INTERNAL("region", "An ARIA accessibility group that acts as a distinct region in a document."); - if (ariaType == "ARIALandmarkApplication") - return UI_STRING_INTERNAL("application", "An ARIA accessibility group that acts as an application."); - if (ariaType == "ARIALandmarkBanner") - return UI_STRING_INTERNAL("banner", "An ARIA accessibility group that acts as a banner."); - if (ariaType == "ARIALandmarkComplementary") - return UI_STRING_INTERNAL("complementary", "An ARIA accessibility group that acts as a region of complementary information."); - if (ariaType == "ARIALandmarkContentInfo") - return UI_STRING_INTERNAL("content", "An ARIA accessibility group that contains content."); - if (ariaType == "ARIALandmarkMain") - return UI_STRING_INTERNAL("main", "An ARIA accessibility group that is the main portion of the website."); - if (ariaType == "ARIALandmarkNavigation") - return UI_STRING_INTERNAL("navigation", "An ARIA accessibility group that contains the main navigation elements of a website."); - if (ariaType == "ARIALandmarkSearch") - return UI_STRING_INTERNAL("search", "An ARIA accessibility group that contains a search feature of a website."); - if (ariaType == "ARIAUserInterfaceTooltip") - return UI_STRING_INTERNAL("tooltip", "An ARIA accessibility group that acts as a tooltip."); - if (ariaType == "ARIATabPanel") - return UI_STRING_INTERNAL("tab panel", "An ARIA accessibility group that contains the content of a tab."); - if (ariaType == "ARIADocumentMath") - return UI_STRING_INTERNAL("math", "An ARIA accessibility group that contains mathematical symbols."); - return String(); -} - -String WebPlatformStrategies::AXButtonActionVerb() -{ - return UI_STRING_INTERNAL("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility"); -} - -String WebPlatformStrategies::AXRadioButtonActionVerb() -{ - return UI_STRING_INTERNAL("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility"); -} - -String WebPlatformStrategies::AXTextFieldActionVerb() -{ - return UI_STRING_INTERNAL("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility"); -} - -String WebPlatformStrategies::AXCheckedCheckBoxActionVerb() -{ - return UI_STRING_INTERNAL("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility"); -} - -String WebPlatformStrategies::AXUncheckedCheckBoxActionVerb() -{ - return UI_STRING_INTERNAL("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility"); -} - -String WebPlatformStrategies::AXMenuListActionVerb() -{ - return String(); -} - -String WebPlatformStrategies::AXMenuListPopupActionVerb() -{ - return String(); -} - -String WebPlatformStrategies::AXLinkActionVerb() -{ - return UI_STRING_INTERNAL("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility"); -} - -String WebPlatformStrategies::missingPluginText() -{ - return UI_STRING_INTERNAL("Missing Plug-in", "Label text to be used when a plugin is missing"); -} - -String WebPlatformStrategies::crashedPluginText() -{ - return UI_STRING_INTERNAL("Plug-in Failure", "Label text to be used if plugin host process has crashed"); -} - -String WebPlatformStrategies::multipleFileUploadText(unsigned numberOfFiles) -{ - return [NSString stringWithFormat:UI_STRING_INTERNAL("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles]; -} - -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) - NSString *widthString = [NSNumberFormatter localizedStringFromNumber:[NSNumber numberWithInt:size.width()] numberStyle:NSNumberFormatterDecimalStyle]; - NSString *heightString = [NSNumberFormatter localizedStringFromNumber:[NSNumber numberWithInt:size.height()] numberStyle:NSNumberFormatterDecimalStyle]; - return [NSString localizedStringWithFormat:UI_STRING_INTERNAL("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), (NSString *)filename, widthString, heightString]; -#else - return [NSString stringWithFormat:UI_STRING_INTERNAL("%@ %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), (NSString *)filename, size.width(), size.height()]; -#endif -} - -String WebPlatformStrategies::mediaElementLoadingStateText() -{ - return UI_STRING_INTERNAL("Loading...", "Media controller status message when the media is loading"); -} - -String WebPlatformStrategies::mediaElementLiveBroadcastStateText() -{ - return UI_STRING_INTERNAL("Live Broadcast", "Media controller status message when watching a live broadcast"); -} - -String WebPlatformStrategies::localizedMediaControlElementString(const String& name) -{ - if (name == "AudioElement") - return UI_STRING_INTERNAL("audio element controller", "accessibility role description for audio element controller"); - if (name == "VideoElement") - return UI_STRING_INTERNAL("video element controller", "accessibility role description for video element controller"); - if (name == "MuteButton") - return UI_STRING_INTERNAL("mute", "accessibility role description for mute button"); - if (name == "UnMuteButton") - return UI_STRING_INTERNAL("unmute", "accessibility role description for turn mute off button"); - if (name == "PlayButton") - return UI_STRING_INTERNAL("play", "accessibility role description for play button"); - if (name == "PauseButton") - return UI_STRING_INTERNAL("pause", "accessibility role description for pause button"); - if (name == "Slider") - return UI_STRING_INTERNAL("movie time", "accessibility role description for timeline slider"); - if (name == "SliderThumb") - return UI_STRING_INTERNAL("timeline slider thumb", "accessibility role description for timeline thumb"); - if (name == "RewindButton") - return UI_STRING_INTERNAL("back 30 seconds", "accessibility role description for seek back 30 seconds button"); - if (name == "ReturnToRealtimeButton") - return UI_STRING_INTERNAL("return to realtime", "accessibility role description for return to real time button"); - if (name == "CurrentTimeDisplay") - return UI_STRING_INTERNAL("elapsed time", "accessibility role description for elapsed time display"); - if (name == "TimeRemainingDisplay") - return UI_STRING_INTERNAL("remaining time", "accessibility role description for time remaining display"); - if (name == "StatusDisplay") - return UI_STRING_INTERNAL("status", "accessibility role description for movie status"); - if (name == "FullscreenButton") - return UI_STRING_INTERNAL("fullscreen", "accessibility role description for enter fullscreen button"); - if (name == "SeekForwardButton") - return UI_STRING_INTERNAL("fast forward", "accessibility role description for fast forward button"); - if (name == "SeekBackButton") - return UI_STRING_INTERNAL("fast reverse", "accessibility role description for fast reverse button"); - if (name == "ShowClosedCaptionsButton") - return UI_STRING_INTERNAL("show closed captions", "accessibility role description for show closed captions button"); - if (name == "HideClosedCaptionsButton") - return UI_STRING_INTERNAL("hide closed captions", "accessibility role description for hide closed captions button"); - - // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy. - if (name == "ControlsPanel") - return String(); - - ASSERT_NOT_REACHED(); - return String(); -} - -String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name) -{ - if (name == "AudioElement") - return UI_STRING_INTERNAL("audio element playback controls and status display", "accessibility role description for audio element controller"); - if (name == "VideoElement") - return UI_STRING_INTERNAL("video element playback controls and status display", "accessibility role description for video element controller"); - if (name == "MuteButton") - return UI_STRING_INTERNAL("mute audio tracks", "accessibility help text for mute button"); - if (name == "UnMuteButton") - return UI_STRING_INTERNAL("unmute audio tracks", "accessibility help text for un mute button"); - if (name == "PlayButton") - return UI_STRING_INTERNAL("begin playback", "accessibility help text for play button"); - if (name == "PauseButton") - return UI_STRING_INTERNAL("pause playback", "accessibility help text for pause button"); - if (name == "Slider") - return UI_STRING_INTERNAL("movie time scrubber", "accessibility help text for timeline slider"); - if (name == "SliderThumb") - return UI_STRING_INTERNAL("movie time scrubber thumb", "accessibility help text for timeline slider thumb"); - if (name == "RewindButton") - return UI_STRING_INTERNAL("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button"); - if (name == "ReturnToRealtimeButton") - return UI_STRING_INTERNAL("return streaming movie to real time", "accessibility help text for return streaming movie to real time button"); - if (name == "CurrentTimeDisplay") - return UI_STRING_INTERNAL("current movie time in seconds", "accessibility help text for elapsed time display"); - if (name == "TimeRemainingDisplay") - return UI_STRING_INTERNAL("number of seconds of movie remaining", "accessibility help text for remaining time display"); - if (name == "StatusDisplay") - return UI_STRING_INTERNAL("current movie status", "accessibility help text for movie status display"); - if (name == "SeekBackButton") - return UI_STRING_INTERNAL("seek quickly back", "accessibility help text for fast rewind button"); - if (name == "SeekForwardButton") - return UI_STRING_INTERNAL("seek quickly forward", "accessibility help text for fast forward button"); - if (name == "FullscreenButton") - return UI_STRING_INTERNAL("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"); - if (name == "ShowClosedCaptionsButton") - return UI_STRING_INTERNAL("start displaying closed captions", "accessibility help text for show closed captions button"); - if (name == "HideClosedCaptionsButton") - return UI_STRING_INTERNAL("stop displaying closed captions", "accessibility help text for hide closed captions button"); - - ASSERT_NOT_REACHED(); - return String(); -} - -String WebPlatformStrategies::localizedMediaTimeDescription(float time) -{ - if (!isfinite(time)) - return UI_STRING_INTERNAL("indefinite time", "accessibility help text for an indefinite media controller time value"); - - int seconds = (int)fabsf(time); - int days = seconds / (60 * 60 * 24); - int hours = seconds / (60 * 60); - int minutes = (seconds / 60) % 60; - seconds %= 60; - - if (days) - return [NSString stringWithFormat:UI_STRING_INTERNAL("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds]; - else if (hours) - return [NSString stringWithFormat:UI_STRING_INTERNAL("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds]; - else if (minutes) - return [NSString stringWithFormat:UI_STRING_INTERNAL("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds]; - - return [NSString stringWithFormat:UI_STRING_INTERNAL("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds]; -} - -String WebPlatformStrategies::validationMessageValueMissingText() -{ - return UI_STRING_INTERNAL("value missing", "Validation message for required form control elements that have no value"); -} - -String WebPlatformStrategies::validationMessageTypeMismatchText() -{ - return UI_STRING_INTERNAL("type mismatch", "Validation message for input form controls with a value not matching type"); -} - -String WebPlatformStrategies::validationMessagePatternMismatchText() -{ - return UI_STRING_INTERNAL("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern"); -} - -String WebPlatformStrategies::validationMessageTooLongText() -{ - return UI_STRING_INTERNAL("too long", "Validation message for form control elements with a value longer than maximum allowed length"); -} - -String WebPlatformStrategies::validationMessageRangeUnderflowText() -{ - return UI_STRING_INTERNAL("range underflow", "Validation message for input form controls with value lower than allowed minimum"); -} - -String WebPlatformStrategies::validationMessageRangeOverflowText() -{ - return UI_STRING_INTERNAL("range overflow", "Validation message for input form controls with value higher than allowed maximum"); -} - -String WebPlatformStrategies::validationMessageStepMismatchText() -{ - return UI_STRING_INTERNAL("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); -} - -// VisitedLinkStrategy bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash hash) { return page->group().isLinkVisited(hash); diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 1b212a7..de2a1f4 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -68,7 +68,6 @@ void InitWebCoreSystemInterface(void) INIT(GetWheelEventDeltas); INIT(HitTestMediaUIPart); INIT(InitializeMaximumHTTPConnectionCountPerHost); - INIT(IsLatchingWheelEvent); INIT(MeasureMediaUIPart); INIT(MediaControllerThemeAvailable); INIT(PopupMenu); @@ -77,7 +76,9 @@ void InitWebCoreSystemInterface(void) INIT(SetCONNECTProxyForStream); INIT(SetCookieStoragePrivateBrowsingEnabled); INIT(SetDragImage); + INIT(SetHTTPPipeliningMaximumPriority); INIT(SetHTTPPipeliningPriority); + INIT(SetHTTPPipeliningMinimumFastLanePriority); INIT(SetNSURLConnectionDefersCallbacks); INIT(SetNSURLRequestShouldContentSniff); INIT(SetPatternBaseCTM); @@ -119,9 +120,11 @@ void InitWebCoreSystemInterface(void) #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) INIT(GetHyphenationLocationBeforeIndex); + INIT(GetNSEventMomentumPhase); #endif INIT(CreateCTLineWithUniCharProvider); + #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) INIT(IOSurfaceContextCreate); INIT(IOSurfaceContextCreateImage); @@ -155,6 +158,8 @@ void InitWebCoreSystemInterface(void) INIT(WillEndLiveResize); INIT(ContentAreaDidShow); INIT(ContentAreaDidHide); + INIT(DidBeginScrollGesture); + INIT(DidEndScrollGesture); INIT(ScrollbarPainterUsesOverlayScrollers); #endif diff --git a/Source/WebKit/mac/Misc/WebNSAttributedStringExtras.h b/Source/WebKit/mac/WebInspector/WebNodeHighlighter.h index a4ee9fc..4fca732 100644 --- a/Source/WebKit/mac/Misc/WebNSAttributedStringExtras.h +++ b/Source/WebKit/mac/WebInspector/WebNodeHighlighter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,19 +20,22 @@ * 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 + * 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. */ -namespace WebCore { - class Range; -} - -@interface NSAttributedString (WebKitExtras) - -+ (NSAttributedString *)_web_attributedStringFromRange:(WebCore::Range*)range; -- (NSAttributedString *)_web_attributedStringByStrippingAttachmentCharacters; +@class DOMNode; +@class WebView; +@class WebNodeHighlight; +@interface WebNodeHighlighter : NSObject { +@private + WebView *_inspectedWebView; + WebNodeHighlight *_currentHighlight; +} +- (id)initWithInspectedWebView:(WebView *)webView; +- (void)highlightNode:(DOMNode *)node; +- (void)hideHighlight; @end diff --git a/Source/WebKit/mac/WebInspector/WebNodeHighlighter.mm b/Source/WebKit/mac/WebInspector/WebNodeHighlighter.mm new file mode 100644 index 0000000..56bee2e --- /dev/null +++ b/Source/WebKit/mac/WebInspector/WebNodeHighlighter.mm @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2006, 2007 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. + * 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 "WebNodeHighlighter.h" + +#import "DOMNodeInternal.h" +#import "WebNodeHighlight.h" +#import "WebViewInternal.h" +#import <WebCore/Page.h> + +@implementation WebNodeHighlighter + +- (id)initWithInspectedWebView:(WebView *)webView +{ + if (!(self = [super init])) + return nil; + + // Don't retain to avoid a circular reference. + _inspectedWebView = webView; + + return self; +} + +- (void)dealloc +{ + ASSERT(!_currentHighlight); + [super dealloc]; +} + +// MARK: - + +- (void)highlightNode:(DOMNode *)node +{ + // The scrollview's content view stays around between page navigations, so target it. + NSView *view = [[[[[_inspectedWebView mainFrame] frameView] documentView] enclosingScrollView] contentView]; + if (![view window]) + return; // Skip the highlight if we have no window (e.g. hidden tab). + + if (!_currentHighlight) { + _currentHighlight = [[WebNodeHighlight alloc] initWithTargetView:view inspectorController:[_inspectedWebView page]->inspectorController()]; + [_currentHighlight setDelegate:self]; + [_currentHighlight attach]; + } else + [[_currentHighlight highlightView] setNeedsDisplay:YES]; +} + +- (void)hideHighlight +{ + [_currentHighlight detach]; + [_currentHighlight setDelegate:nil]; + [_currentHighlight release]; + _currentHighlight = nil; +} + +// MARK: - +// MARK: WebNodeHighlight delegate + +- (void)didAttachWebNodeHighlight:(WebNodeHighlight *)highlight +{ + [_inspectedWebView setCurrentNodeHighlight:highlight]; +} + +- (void)willDetachWebNodeHighlight:(WebNodeHighlight *)highlight +{ + [_inspectedWebView setCurrentNodeHighlight:nil]; +} + +@end diff --git a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 9f0dd8d..1b245ec 100644 --- a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -515,7 +515,13 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; BOOL isContinuous; WKGetWheelEventDeltas(event, &deltaX, &deltaY, &isContinuous); - BOOL isLatchingEvent = WKIsLatchingWheelEvent(event); +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + NSEventPhase momentumPhase = [event momentumPhase]; + BOOL isLatchingEvent = momentumPhase & NSEventPhaseBegan || momentumPhase & NSEventPhaseChanged; +#else + int momentumPhase = WKGetNSEventMomentumPhase(event); + BOOL isLatchingEvent = momentumPhase == WKEventPhaseBegan || momentumPhase == WKEventPhaseChanged; +#endif if (fabsf(deltaY) > fabsf(deltaX)) { if (![self allowsVerticalScrolling]) { diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index 584b09e..ab8c34d 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -670,30 +670,15 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSRange)_convertToNSRange:(Range *)range { - if (!range || !range->startContainer()) + if (!range) return NSMakeRange(NSNotFound, 0); - Element* selectionRoot = _private->coreFrame->selection()->rootEditableElement(); - Element* scope = selectionRoot ? selectionRoot : _private->coreFrame->document()->documentElement(); - - // Mouse events may cause TSM to attempt to create an NSRange for a portion of the view - // that is not inside the current editable region. These checks ensure we don't produce - // potentially invalid data when responding to such requests. - if (range->startContainer() != scope && !range->startContainer()->isDescendantOf(scope)) - return NSMakeRange(NSNotFound, 0); - if (range->endContainer() != scope && !range->endContainer()->isDescendantOf(scope)) + size_t location; + size_t length; + if (!TextIterator::locationAndLengthFromRange(range, location, length)) return NSMakeRange(NSNotFound, 0); - - RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); - ASSERT(testRange->startContainer() == scope); - int startPosition = TextIterator::rangeLength(testRange.get()); - - ExceptionCode ec; - testRange->setEnd(range->endContainer(), range->endOffset(), ec); - ASSERT(testRange->startContainer() == scope); - int endPosition = TextIterator::rangeLength(testRange.get()); - return NSMakeRange(startPosition, endPosition - startPosition); + return NSMakeRange(location, length); } - (PassRefPtr<Range>)_convertToDOMRange:(NSRange)nsrange @@ -820,27 +805,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMRange *)_characterRangeAtPoint:(NSPoint)point { - VisiblePosition position = [self _visiblePositionForPoint:point]; - if (position.isNull()) - return nil; - - VisiblePosition previous = position.previous(); - if (previous.isNotNull()) { - DOMRange *previousCharacterRange = kit(makeRange(previous, position).get()); - NSRect rect = [self _firstRectForDOMRange:previousCharacterRange]; - if (NSPointInRect(point, rect)) - return previousCharacterRange; - } - - VisiblePosition next = position.next(); - if (next.isNotNull()) { - DOMRange *nextCharacterRange = kit(makeRange(position, next).get()); - NSRect rect = [self _firstRectForDOMRange:nextCharacterRange]; - if (NSPointInRect(point, rect)) - return nextCharacterRange; - } - - return nil; + return kit(_private->coreFrame->rangeForPoint(IntPoint(point)).get()); } - (DOMCSSStyleDeclaration *)_typingStyle diff --git a/Source/WebKit/mac/WebView/WebFrameInternal.h b/Source/WebKit/mac/WebView/WebFrameInternal.h index c13b721..ff382d4 100644 --- a/Source/WebKit/mac/WebView/WebFrameInternal.h +++ b/Source/WebKit/mac/WebView/WebFrameInternal.h @@ -142,6 +142,7 @@ WebView *getWebView(WebFrame *webFrame); - (NSRange)_convertToNSRange:(WebCore::Range*)range; - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range; - (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range; +- (PassRefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange; - (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString; - (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes; diff --git a/Source/WebKit/mac/WebView/WebFrameView.mm b/Source/WebKit/mac/WebView/WebFrameView.mm index c42738c..41ac9ed 100644 --- a/Source/WebKit/mac/WebView/WebFrameView.mm +++ b/Source/WebKit/mac/WebView/WebFrameView.mm @@ -771,6 +771,13 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (void)keyDown:(NSEvent *)event { + // Implement common browser behaviors for all kinds of content. + + // FIXME: This is not a good time to execute commands for WebHTMLView. We should run these at the time commands sent by key bindings + // are executed for consistency. + // This doesn't work automatically because most of the keys handled here are translated into moveXXX commands, which are not handled + // by Editor when focus is not in editable content. + NSString *characters = [event characters]; int index, count; BOOL callSuper = YES; diff --git a/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm b/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm index 03edd5d..1802ca8 100644 --- a/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -38,7 +38,6 @@ #import "WebFrameInternal.h" #import "WebKitNSStringExtras.h" #import "WebKitStatisticsPrivate.h" -#import "WebNSAttributedStringExtras.h" #import "WebNSObjectExtras.h" #import "WebTypesInternal.h" #import "WebView.h" @@ -48,6 +47,7 @@ #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> #import <WebCore/FrameLoaderClient.h> +#import <WebCore/HTMLConverter.h> #import <WebCore/HTMLFormControlElement.h> #import <WebCore/HTMLFormElement.h> #import <WebCore/HTMLInputElement.h> @@ -261,7 +261,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) - (NSString *)title { - return nsStringNilIfEmpty([_private->dataSource _documentLoader]->title()); + return nsStringNilIfEmpty([_private->dataSource _documentLoader]->title().string()); } - (DOMDocument *)DOMDocument @@ -277,7 +277,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset { - return [NSAttributedString _web_attributedStringFromRange:Range::create(core(startNode)->document(), core(startNode), startOffset, core(endNode), endOffset).get()]; + return [WebHTMLConverter editingAttributedStringFromRange:Range::create(core(startNode)->document(), core(startNode), startOffset, core(endNode), endOffset).get()]; } static HTMLFormElement* formElementFromDOMElement(DOMElement *element) diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index e611e2b..fb1d794 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -53,7 +53,6 @@ #import "WebKitNSStringExtras.h" #import "WebKitVersionChecks.h" #import "WebLocalizableStringsInternal.h" -#import "WebNSAttributedStringExtras.h" #import "WebNSEventExtras.h" #import "WebNSFileManagerExtras.h" #import "WebNSImageExtras.h" @@ -94,6 +93,7 @@ #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> #import <WebCore/FrameView.h> +#import <WebCore/HTMLConverter.h> #import <WebCore/HTMLNames.h> #import <WebCore/HitTestResult.h> #import <WebCore/Image.h> @@ -112,6 +112,7 @@ #import <WebCore/Text.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebFontCache.h> +#import <WebCore/WebNSAttributedStringExtras.h> #import <WebCore/markup.h> #import <WebKit/DOM.h> #import <WebKit/DOMExtensions.h> @@ -431,6 +432,7 @@ static CachedResourceClient* promisedDataClient() @interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick. - (void)_setPrinting:(BOOL)printing minimumPageLogicalWidth:(float)minPageWidth logicalHeight:(float)minPageHeight maximumPageLogicalWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize paginateScreenContent:(BOOL)paginateScreenContent; +- (void)_updateSecureInputState; @end @class NSTextInputContext; @@ -465,6 +467,7 @@ struct WebHTMLViewInterpretKeyEventsParameters { bool eventInterpretationHadSideEffects; bool shouldSaveCommands; bool consumedByIM; + bool executingSavedKeypressCommands; }; @interface WebHTMLViewPrivate : NSObject { @@ -493,6 +496,11 @@ struct WebHTMLViewInterpretKeyEventsParameters { // This state is saved each time selection changes, because computing it causes style recalc, which is not always safe to do. BOOL exposeInputContext; + // Track whether the view has set a secure input state. + BOOL isInSecureInputState; + + BOOL _forceUpdateSecureInputState; + NSPoint lastScrollPosition; #ifndef BUILDING_ON_TIGER BOOL inScrollPositionChanged; @@ -1041,12 +1049,10 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) [pasteboard setData:RTFDData forType:NSRTFDPboardType]; } if ([types containsObject:NSRTFPboardType]) { - if (attributedString == nil) { + if (!attributedString) attributedString = [self selectedAttributedString]; - } - if ([attributedString containsAttachments]) { - attributedString = [attributedString _web_attributedStringByStrippingAttachmentCharacters]; - } + if ([attributedString containsAttachments]) + attributedString = attributedStringByStrippingAttachmentCharacters(attributedString); NSData *RTFData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil]; [pasteboard setData:RTFData forType:NSRTFPboardType]; } @@ -1994,6 +2000,11 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) // remove tooltips before clearing _private so removeTrackingRect: will work correctly [self removeAllToolTips]; + if (_private->isInSecureInputState) { + DisableSecureEventInput(); + _private->isInSecureInputState = NO; + } + [_private clear]; } @@ -3459,8 +3470,10 @@ static void setMenuTargets(NSMenu* menu) NSWindow *keyWindow = [notification object]; - if (keyWindow == [self window]) + if (keyWindow == [self window]) { [self addMouseMovedObserver]; + [self _updateSecureInputState]; + } } - (void)windowDidResignKey:(NSNotification *)notification @@ -3475,8 +3488,10 @@ static void setMenuTargets(NSMenu* menu) if (formerKeyWindow == [self window]) [self removeMouseMovedObserver]; - if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) + if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) { + [self _updateSecureInputState]; [_private->completionController endRevertingChange:NO moveLeft:NO]; + } } - (void)windowWillClose:(NSNotification *)notification @@ -3809,6 +3824,10 @@ static BOOL isInPasswordField(Frame* coreFrame) [NSApp updateWindows]; } + _private->_forceUpdateSecureInputState = YES; + [self _updateSecureInputState]; + _private->_forceUpdateSecureInputState = NO; + frame->editor()->setStartNewKillRingSequence(true); Page* page = frame->page(); @@ -3834,6 +3853,10 @@ static BOOL isInPasswordField(Frame* coreFrame) { BOOL resign = [super resignFirstResponder]; if (resign) { + if (_private->isInSecureInputState) { + DisableSecureEventInput(); + _private->isInSecureInputState = NO; + } [_private->completionController endRevertingChange:NO moveLeft:NO]; Frame* coreFrame = core([self _frame]); if (!coreFrame) @@ -4163,15 +4186,12 @@ static BOOL isInPasswordField(Frame* coreFrame) // the current event prevents that from causing a problem inside WebKit or AppKit code. [[event retain] autorelease]; - Frame* coreFrame = core([self _frame]); - if (coreFrame) - coreFrame->eventHandler()->capsLockStateMayHaveChanged(); - RetainPtr<WebHTMLView> selfProtector = self; + Frame* coreFrame = core([self _frame]); unsigned short keyCode = [event keyCode]; - //Don't make an event from the num lock and function keys + // Don't make an event from the num lock and function keys. if (coreFrame && keyCode != 0 && keyCode != 10 && keyCode != 63) { coreFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(event)); return; @@ -4370,8 +4390,11 @@ static BOOL isInPasswordField(Frame* coreFrame) - (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event { - ASSERT([self _webView]); - if (![[[self _webView] preferences] respectStandardStyleKeyEquivalents]) + WebView *webView = [self _webView]; + if (!webView) + return NO; + + if (![[webView preferences] respectStandardStyleKeyEquivalents]) return NO; if (![self _canEdit]) @@ -5428,26 +5451,35 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [self _updateMouseoverWithFakeEvent]; } -- (void)_executeSavedEditingCommands +- (void)_executeSavedKeypressCommands { WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters; if (!parameters || parameters->event->keypressCommands().isEmpty()) return; + // We could be called again if the execution of one command triggers a call to selectedRange. + // In this case, the state is up to date, and we don't need to execute any more saved commands to return a result + if (parameters->executingSavedKeypressCommands) + 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; - + parameters->executingSavedKeypressCommands = true; + 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 if (commands[i].commandName == "noop:") + ; // Do nothing. This case can be removed once <rdar://problem/9025012> is fixed. else [self doCommandBySelector:NSSelectorFromString(commands[i].commandName)]; } parameters->event->keypressCommands().clear(); parameters->shouldSaveCommands = wasSavingCommands; + parameters->executingSavedKeypressCommands = false; } - (BOOL)_interpretKeyEvent:(KeyboardEvent*)event savingCommands:(BOOL)savingCommands @@ -5458,6 +5490,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) WebHTMLViewInterpretKeyEventsParameters parameters; parameters.eventInterpretationHadSideEffects = false; parameters.shouldSaveCommands = savingCommands; + parameters.executingSavedKeypressCommands = false; // 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 @@ -5501,7 +5534,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) // 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]; + [self _executeSavedKeypressCommands]; } _private->interpretKeyEventsParameters = 0; @@ -5746,7 +5779,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSUInteger)characterIndexForPoint:(NSPoint)thePoint { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; NSWindow *window = [self window]; WebFrame *frame = [self _frame]; @@ -5768,7 +5801,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSRect)firstRectForCharacterRange:(NSRange)theRange { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; WebFrame *frame = [self _frame]; @@ -5800,7 +5833,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSRange)selectedRange { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; if (!isTextInput(core([self _frame]))) { LOG(TextInput, "selectedRange -> (NSNotFound, 0)"); @@ -5814,7 +5847,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSRange)markedRange { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; WebFrame *webFrame = [self _frame]; Frame* coreFrame = core(webFrame); @@ -5828,7 +5861,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (NSAttributedString *)attributedSubstringFromRange:(NSRange)nsRange { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; WebFrame *frame = [self _frame]; Frame* coreFrame = core(frame); @@ -5836,15 +5869,15 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> nil", nsRange.location, nsRange.length); return nil; } - DOMRange *domRange = [frame _convertNSRangeToDOMRange:nsRange]; - if (!domRange) { + RefPtr<Range> range = [frame _convertToDOMRange:nsRange]; + if (!range) { LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> nil", nsRange.location, nsRange.length); return nil; } - NSAttributedString *result = [NSAttributedString _web_attributedStringFromRange:core(domRange)]; + NSAttributedString *result = [WebHTMLConverter editingAttributedStringFromRange:range.get()]; - // [NSAttributedString(WebKitExtras) _web_attributedStringFromRange:] insists on inserting a trailing + // [WebHTMLConverter editingAttributedStringFromRange:] insists on inserting a trailing // whitespace at the end of the string which breaks the ATOK input method. <rdar://problem/5400551> // To work around this we truncate the resultant string to the correct length. if ([result length] > nsRange.length) { @@ -5871,23 +5904,27 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) - (BOOL)hasMarkedText { - [self _executeSavedEditingCommands]; - Frame* coreFrame = core([self _frame]); BOOL result = coreFrame && coreFrame->editor()->hasComposition(); + + if (result) { + // A saved command can confirm a composition, but it cannot start a new one. + [self _executeSavedKeypressCommands]; + result = coreFrame->editor()->hasComposition(); + } + LOG(TextInput, "hasMarkedText -> %u", result); return result; } - (void)unmarkText { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; LOG(TextInput, "unmarkText"); // Use pointer to get parameters passed to us by the caller of interpretKeyEvents. WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters; - _private->interpretKeyEventsParameters = 0; if (parameters) { parameters->eventInterpretationHadSideEffects = true; @@ -5920,15 +5957,15 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange { - [self _executeSavedEditingCommands]; + [self _executeSavedKeypressCommands]; - BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; // Otherwise, NSString + BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; + ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]); LOG(TextInput, "setMarkedText:\"%@\" selectedRange:(%u, %u)", isAttributedString ? [string string] : string, newSelRange.location, newSelRange.length); // Use pointer to get parameters passed to us by the caller of interpretKeyEvents. WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters; - _private->interpretKeyEventsParameters = 0; if (parameters) { parameters->eventInterpretationHadSideEffects = true; @@ -5943,20 +5980,25 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde return; Vector<CompositionUnderline> underlines; - NSString *text = string; + NSString *text; + NSRange replacementRange = { NSNotFound, 0 }; if (isAttributedString) { - unsigned markedTextLength = [(NSString *)string length]; - NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:0 inRange:NSMakeRange(0, markedTextLength)]; + // FIXME: We ignore most attributes from the string, so an input method cannot specify e.g. a font or a glyph variation. + text = [string string]; + NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:0 inRange:NSMakeRange(0, [text length])]; 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. if (rangeString) - [[self _frame] _selectNSRange:NSRangeFromString(rangeString)]; + replacementRange = NSRangeFromString(rangeString); - text = [string string]; extractUnderlines(string, underlines); - } + } else + text = string; + + if (replacementRange.location != NSNotFound) + [[self _frame] _selectNSRange:replacementRange]; coreFrame->editor()->setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange)); } @@ -6018,7 +6060,8 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (void)insertText:(id)string { - BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; // Otherwise, NSString + BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; + ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]); LOG(TextInput, "insertText:\"%@\"", isAttributedString ? [string string] : string); @@ -6026,20 +6069,19 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde if (parameters) 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]); NSString *text; + NSRange replacementRange = { NSNotFound, 0 }; bool isFromInputMethod = coreFrame && coreFrame->editor()->hasComposition(); + if (isAttributedString) { + // FIXME: We ignore most attributes from the string, so for example inserting from Character Palette loses font and glyph variation data. + // It does not look like any input methods ever use insertText: with attributes other than NSTextInputReplacementRangeAttributeName. 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 behavior matches that of -[WebHTMLView setMarkedText:selectedRange:] when it receives an - // NSAttributedString 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)]; + replacementRange = NSRangeFromString(rangeString); isFromInputMethod = true; } } else @@ -6062,6 +6104,9 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde if (!coreFrame || !coreFrame->editor()->canEdit()) return; + if (replacementRange.location != NSNotFound) + [[self _frame] _selectNSRange:replacementRange]; + bool eventHandled = false; String eventText = text; eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore @@ -6078,6 +6123,37 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde parameters->eventInterpretationHadSideEffects |= eventHandled; } +- (void)_updateSecureInputState +{ + if (![[self window] isKeyWindow] || ([[self window] firstResponder] != self && !_private->_forceUpdateSecureInputState)) { + if (_private->isInSecureInputState) { + DisableSecureEventInput(); + _private->isInSecureInputState = NO; + } + return; + } + + Frame* coreFrame = core([self _frame]); + if (!coreFrame) + return; + + if (isInPasswordField(coreFrame)) { + if (!_private->isInSecureInputState) + EnableSecureEventInput(); + _private->isInSecureInputState = YES; + // WebKit substitutes nil for input context when in password field, which corresponds to null TSMDocument. So, there is + // no need to call TSMGetActiveDocument(), which may return an incorrect result when selection hasn't been yet updated + // after focusing a node. + static CFArrayRef inputSources = TISCreateASCIICapableInputSourceList(); + TSMSetDocumentProperty(0, kTSMDocumentEnabledInputSourcesPropertyTag, sizeof(CFArrayRef), &inputSources); + } else { + if (_private->isInSecureInputState) + DisableSecureEventInput(); + _private->isInSecureInputState = NO; + TSMRemoveDocumentProperty(0, kTSMDocumentEnabledInputSourcesPropertyTag); + } +} + - (void)_updateSelectionForInputManager { Frame* coreFrame = core([self _frame]); @@ -6093,6 +6169,8 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde [NSApp updateWindows]; } + [self _updateSecureInputState]; + if (!coreFrame->editor()->hasComposition()) return; @@ -6214,7 +6292,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]]; if (!attributedString) { Document* coreDocument = core(document); - attributedString = [NSAttributedString _web_attributedStringFromRange:Range::create(coreDocument, coreDocument, 0, coreDocument, coreDocument->childNodeCount()).get()]; + attributedString = [WebHTMLConverter editingAttributedStringFromRange:Range::create(coreDocument, coreDocument, 0, coreDocument, coreDocument->childNodeCount()).get()]; } return attributedString; } @@ -6231,7 +6309,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (coreFrame) { RefPtr<Range> range = coreFrame->selection()->selection().toNormalizedRange(); - attributedString = [NSAttributedString _web_attributedStringFromRange:range.get()]; + attributedString = [WebHTMLConverter editingAttributedStringFromRange:range.get()]; } } return attributedString; diff --git a/Source/WebKit/mac/WebView/WebPDFView.mm b/Source/WebKit/mac/WebView/WebPDFView.mm index 10ba829..5c9f3b7 100644 --- a/Source/WebKit/mac/WebView/WebPDFView.mm +++ b/Source/WebKit/mac/WebView/WebPDFView.mm @@ -39,7 +39,6 @@ #import "WebFrameView.h" #import "WebLocalizableStringsInternal.h" #import "WebNSArrayExtras.h" -#import "WebNSAttributedStringExtras.h" #import "WebNSPasteboardExtras.h" #import "WebNSViewExtras.h" #import "WebPDFRepresentation.h" @@ -61,6 +60,7 @@ #import <WebCore/MouseEvent.h> #import <WebCore/PlatformKeyboardEvent.h> #import <WebCore/RuntimeApplicationChecks.h> +#import <WebCore/WebNSAttributedStringExtras.h> #import <wtf/Assertions.h> using namespace WebCore; @@ -924,7 +924,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range) if ([types containsObject:NSRTFPboardType]) { if ([attributedString containsAttachments]) - attributedString = [attributedString _web_attributedStringByStrippingAttachmentCharacters]; + attributedString = attributedStringByStrippingAttachmentCharacters(attributedString); NSData *RTFData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil]; [pasteboard setData:RTFData forType:NSRTFPboardType]; diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index a2f176a..c5c101b 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -60,6 +60,7 @@ #define WebKitAllowAnimatedImagesPreferenceKey @"WebKitAllowAnimatedImagesPreferenceKey" #define WebKitAllowAnimatedImageLoopingPreferenceKey @"WebKitAllowAnimatedImageLoopingPreferenceKey" #define WebKitDisplayImagesKey @"WebKitDisplayImagesKey" +#define WebKitLoadSiteIconsKey @"WebKitLoadSiteIconsKey" #define WebKitBackForwardCacheExpirationIntervalKey @"WebKitBackForwardCacheExpirationIntervalKey" #define WebKitTabToLinksPreferenceKey @"WebKitTabToLinksPreferenceKey" #define WebKitPrivateBrowsingEnabledPreferenceKey @"WebKitPrivateBrowsingEnabled" diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index a5f24e0..e69a06b 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -42,6 +42,7 @@ NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification"; NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification"; +NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification"; #define KEY(x) (_private->identifier ? [_private->identifier stringByAppendingString:(x)] : (x)) @@ -232,7 +233,7 @@ static bool useQuickLookQuirks(void) [[self class] _setInstance:self forIdentifier:_private->identifier]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; return self; } @@ -345,6 +346,7 @@ static bool useQuickLookQuirks(void) [NSNumber numberWithBool:YES], WebKitAllowAnimatedImagesPreferenceKey, [NSNumber numberWithBool:YES], WebKitAllowAnimatedImageLoopingPreferenceKey, [NSNumber numberWithBool:YES], WebKitDisplayImagesKey, + [NSNumber numberWithBool:NO], WebKitLoadSiteIconsKey, @"1800", WebKitBackForwardCacheExpirationIntervalKey, [NSNumber numberWithBool:NO], WebKitTabToLinksPreferenceKey, [NSNumber numberWithBool:NO], WebKitPrivateBrowsingEnabledPreferenceKey, @@ -375,7 +377,7 @@ static bool useQuickLookQuirks(void) [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey, - [NSNumber numberWithBool:YES], WebKitCanvasUsesAcceleratedDrawingPreferenceKey, + [NSNumber numberWithBool:NO], WebKitCanvasUsesAcceleratedDrawingPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey, [NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey, @@ -436,7 +438,7 @@ static bool useQuickLookQuirks(void) [_private->values setObject:value forKey:_key]; if (_private->autosaves) [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; } - (int)_integerValueForKey:(NSString *)key @@ -453,7 +455,7 @@ static bool useQuickLookQuirks(void) [_private->values _webkit_setInt:value forKey:_key]; if (_private->autosaves) [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; } - (float)_floatValueForKey:(NSString *)key @@ -470,7 +472,7 @@ static bool useQuickLookQuirks(void) [_private->values _webkit_setFloat:value forKey:_key]; if (_private->autosaves) [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; } - (BOOL)_boolValueForKey:(NSString *)key @@ -486,7 +488,7 @@ static bool useQuickLookQuirks(void) [_private->values _webkit_setBool:value forKey:_key]; if (_private->autosaves) [[NSUserDefaults standardUserDefaults] setBool:value forKey:_key]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; } - (long long)_longLongValueForKey:(NSString *)key @@ -503,7 +505,7 @@ static bool useQuickLookQuirks(void) [_private->values _webkit_setLongLong:value forKey:_key]; if (_private->autosaves) [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; } - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key @@ -520,7 +522,7 @@ static bool useQuickLookQuirks(void) [_private->values _webkit_setUnsignedLongLong:value forKey:_key]; if (_private->autosaves) [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedLongLong:value] forKey:_key]; - [self _postPreferencesChangesNotification]; + [self _postPreferencesChangedNotification]; } - (NSString *)standardFontFamily @@ -1173,16 +1175,25 @@ static bool useQuickLookQuirks(void) [self performSelector:@selector(_checkLastReferenceForIdentifier:) withObject:[self _concatenateKeyWithIBCreatorID:ident] afterDelay:0.1]; } -- (void)_postPreferencesChangesNotification +- (void)_postPreferencesChangedNotification { if (!pthread_main_np()) { [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO]; return; } - [[NSNotificationCenter defaultCenter] - postNotificationName:WebPreferencesChangedNotification object:self - userInfo:nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil]; +} + +- (void)_postPreferencesChangedAPINotification +{ + if (!pthread_main_np()) { + [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO]; + return; + } + + [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil]; } + (CFStringEncoding)_systemCFStringEncoding @@ -1463,6 +1474,16 @@ static NSString *classIBCreatorID = nil; setWebKitLinkTimeVersion(version); } +- (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag +{ + [self _setBoolValue: flag forKey: WebKitLoadSiteIconsKey]; +} + +- (BOOL)loadsSiteIconsIgnoringImageLoadingPreference +{ + return [self _boolValueForKey: WebKitLoadSiteIconsKey]; +} + @end @implementation WebPreferences (WebInternal) diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 7e1f6a2..e66604a 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -51,6 +51,7 @@ typedef enum { extern NSString *WebPreferencesChangedNotification; extern NSString *WebPreferencesRemovedNotification; +extern NSString *WebPreferencesChangedInternalNotification; @interface WebPreferences (WebPrivate) @@ -210,7 +211,8 @@ extern NSString *WebPreferencesRemovedNotification; - (void)setHyperlinkAuditingEnabled:(BOOL)enabled; // Other private methods -- (void)_postPreferencesChangesNotification; +- (void)_postPreferencesChangedNotification; +- (void)_postPreferencesChangedAPINotification; + (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier; + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)identifier; + (void)_removeReferenceForIdentifier:(NSString *)identifier; @@ -238,4 +240,7 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)useQuickLookResourceCachingQuirks; +- (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag; +- (BOOL)loadsSiteIconsIgnoringImageLoadingPreference; + @end diff --git a/Source/WebKit/mac/WebView/WebScriptDebugger.h b/Source/WebKit/mac/WebView/WebScriptDebugger.h index 8f7fcaa..784a802 100644 --- a/Source/WebKit/mac/WebView/WebScriptDebugger.h +++ b/Source/WebKit/mac/WebView/WebScriptDebugger.h @@ -29,7 +29,7 @@ #ifndef WebScriptDebugger_h #define WebScriptDebugger_h -#include <collector/handles/Global.h> +#include <heap/Strong.h> #include <debugger/Debugger.h> #include <wtf/RetainPtr.h> @@ -69,7 +69,7 @@ private: bool m_callingDelegate; RetainPtr<WebScriptCallFrame> m_topCallFrame; - JSC::Global<JSC::JSGlobalObject> m_globalObject; + JSC::Strong<JSC::JSGlobalObject> m_globalObject; RetainPtr<WebScriptCallFrame> m_globalCallFrame; }; diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 3d42be0..c36acb9 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2006 David Smith (catfish.man@gmail.com) * Copyright (C) 2010 Igalia S.L * @@ -148,6 +148,7 @@ #import <WebCore/RenderWidget.h> #import <WebCore/ResourceHandle.h> #import <WebCore/ResourceLoadScheduler.h> +#import <WebCore/ResourceRequest.h> #import <WebCore/RuntimeApplicationChecks.h> #import <WebCore/SchemeRegistry.h> #import <WebCore/ScriptController.h> @@ -179,10 +180,6 @@ #import <wtf/StdLibExtras.h> #import <wtf/Threading.h> -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) -#import <AppKit/NSTextChecker.h> -#endif - #if ENABLE(DASHBOARD_SUPPORT) #import <WebKit/WebDashboardRegion.h> #endif @@ -639,17 +636,39 @@ static bool shouldEnableLoadDeferring() return _private->usesDocumentViews; } -static NSString *leakMailQuirksUserScriptPath() +static NSString *leakMailQuirksUserScriptContents() { NSString *scriptPath = [[NSBundle bundleForClass:[WebView class]] pathForResource:@"MailQuirksUserScript" ofType:@"js"]; - return [[NSString alloc] initWithContentsOfFile:scriptPath]; + NSStringEncoding encoding; + return [[NSString alloc] initWithContentsOfFile:scriptPath usedEncoding:&encoding error:0]; } - (void)_injectMailQuirksScript { - static NSString *mailQuirksScriptPath = leakMailQuirksUserScriptPath(); + static NSString *mailQuirksScriptContents = leakMailQuirksUserScriptContents(); + core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]), + mailQuirksScriptContents, KURL(), 0, 0, InjectAtDocumentEnd, InjectInAllFrames); +} + +static bool needsOutlookQuirksScript() +{ + static bool isOutlookNeedingQuirksScript = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER) + && applicationIsMicrosoftOutlook(); + return isOutlookNeedingQuirksScript; +} + +static NSString *leakOutlookQuirksUserScriptContents() +{ + NSString *scriptPath = [[NSBundle bundleForClass:[WebView class]] pathForResource:@"OutlookQuirksUserScript" ofType:@"js"]; + NSStringEncoding encoding; + return [[NSString alloc] initWithContentsOfFile:scriptPath usedEncoding:&encoding error:0]; +} + +-(void)_injectOutlookQuirksScript +{ + static NSString *outlookQuirksScriptContents = leakOutlookQuirksUserScriptContents(); core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]), - mailQuirksScriptPath, KURL(), 0, 0, InjectAtDocumentEnd, InjectInAllFrames); + outlookQuirksScriptContents, KURL(), 0, 0, InjectAtDocumentEnd, InjectInAllFrames); } - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews @@ -720,6 +739,11 @@ static NSString *leakMailQuirksUserScriptPath() _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); + if (needsOutlookQuirksScript()) { + _private->page->settings()->setShouldInjectUserScriptsInInitialEmptyDocument(true); + [self _injectOutlookQuirksScript]; + } + [WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView]; #ifndef BUILDING_ON_TIGER @@ -752,10 +776,10 @@ static NSString *leakMailQuirksUserScriptPath() WebPreferences *prefs = [self preferences]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) - name:WebPreferencesChangedNotification object:prefs]; + name:WebPreferencesChangedInternalNotification object:prefs]; - // Post a notification so the WebCore settings update. - [[self preferences] _postPreferencesChangesNotification]; + [self _preferencesChanged:[self preferences]]; + [[self preferences] _postPreferencesChangedAPINotification]; if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) { // Originally, we allowed all local loads. @@ -1272,10 +1296,16 @@ static bool fastDocumentTeardownEnabled() - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items { NSArray *defaultMenuItems = [[WebDefaultUIDelegate sharedUIDelegate] webView:self contextMenuItemsForElement:element defaultMenuItems:items]; - - NSArray *menuItems = CallUIDelegate(self, @selector(webView:contextMenuItemsForElement:defaultMenuItems:), element, defaultMenuItems); - if (!menuItems) - return nil; + NSArray *menuItems = defaultMenuItems; + + // CallUIDelegate returns nil if UIDelegate is nil or doesn't respond to the selector. So we need to check that here + // to distinguish between using defaultMenuItems or the delegate really returning nil to say "no context menu". + SEL selector = @selector(webView:contextMenuItemsForElement:defaultMenuItems:); + if (_private->UIDelegate && [_private->UIDelegate respondsToSelector:selector]) { + menuItems = CallUIDelegate(self, selector, element, defaultMenuItems); + if (!menuItems) + return nil; + } unsigned count = [menuItems count]; if (!count) @@ -1416,8 +1446,12 @@ static bool fastDocumentTeardownEnabled() - (void)_preferencesChangedNotification:(NSNotification *)notification { WebPreferences *preferences = (WebPreferences *)[notification object]; + [self _preferencesChanged:preferences]; +} + +- (void)_preferencesChanged:(WebPreferences *)preferences +{ ASSERT(preferences == [self preferences]); - if (!_private->userAgentOverridden) _private->userAgent = String(); @@ -1459,6 +1493,7 @@ static bool fastDocumentTeardownEnabled() settings->setSerifFontFamily([preferences serifFontFamily]); settings->setStandardFontFamily([preferences standardFontFamily]); settings->setLoadsImagesAutomatically([preferences loadsImagesAutomatically]); + settings->setLoadsSiteIconsIgnoringImageLoadingSetting([preferences loadsSiteIconsIgnoringImageLoadingPreference]); settings->setShouldPrintBackgrounds([preferences shouldPrintBackgrounds]); settings->setTextAreasAreResizable([preferences textAreasAreResizable]); settings->setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]); @@ -2262,8 +2297,9 @@ static inline IMP getMethod(id o, SEL s) { _private->usesPageCache = usesPageCache; - // Post a notification so the WebCore settings update. - [[self preferences] _postPreferencesChangesNotification]; + // Update our own settings and post the public notification only + [self _preferencesChanged:[self preferences]]; + [[self preferences] _postPreferencesChangedAPINotification]; } - (WebHistoryItem *)_globalHistoryItem @@ -2790,6 +2826,16 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) _private->page->settings()->setMinDOMTimerInterval(intervalInSeconds); } ++ (BOOL)_HTTPPipeliningEnabled +{ + return ResourceRequest::httpPipeliningEnabled(); +} + ++ (void)_setHTTPPipeliningEnabled:(BOOL)enabled +{ + ResourceRequest::setHTTPPipeliningEnabled(enabled); +} + @end @implementation _WebSafeForwarder @@ -2848,7 +2894,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) WTF::initializeMainThreadToProcessMainThread(); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) name:WebPreferencesChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) name:WebPreferencesChangedInternalNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesRemovedNotification:) name:WebPreferencesRemovedNotification object:nil]; continuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled]; @@ -3353,15 +3399,16 @@ static bool needsWebViewInitThreadWorkaround() WebPreferences *oldPrefs = _private->preferences; - [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedNotification object:[self preferences]]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedInternalNotification object:[self preferences]]; [WebPreferences _removeReferenceForIdentifier:[oldPrefs identifier]]; _private->preferences = [prefs retain]; // After registering for the notification, post it so the WebCore settings update. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) - name:WebPreferencesChangedNotification object:[self preferences]]; - [[self preferences] _postPreferencesChangesNotification]; + name:WebPreferencesChangedInternalNotification object:[self preferences]]; + [self _preferencesChanged:[self preferences]]; + [[self preferences] _postPreferencesChangedAPINotification]; [oldPrefs didRemoveFromWebView]; [oldPrefs release]; @@ -5964,7 +6011,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:) - name:WebPreferencesChangedNotification object:nil]; + name:WebPreferencesChangedInternalNotification object:nil]; } return _private->_keyboardUIMode; } diff --git a/Source/WebKit/mac/WebView/WebViewInternal.h b/Source/WebKit/mac/WebView/WebViewInternal.h index 65cb4d8..aeef7eb 100644 --- a/Source/WebKit/mac/WebView/WebViewInternal.h +++ b/Source/WebKit/mac/WebView/WebViewInternal.h @@ -183,6 +183,8 @@ namespace WebCore { - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard; +- (void)_preferencesChanged:(WebPreferences *)preferences; + #if ENABLE(VIDEO) && defined(__cplusplus) - (void)_enterFullscreenForNode:(WebCore::Node*)node; - (void)_exitFullscreen; diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index 7d7537e..fa4844f 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -594,6 +594,22 @@ Could be worth adding to the API. */ - (void)_setMinimumTimerInterval:(double)intervalInSeconds; +/*! + @method _HTTPPipeliningEnabled + @abstract Checks the HTTP pipelining status. + @discussion Defaults to NO. + @result YES if HTTP pipelining is enabled, NO if not enabled. + */ ++ (BOOL)_HTTPPipeliningEnabled; + +/*! + @method _setHTTPPipeliningEnabled: + @abstract Set the HTTP pipelining status. + @discussion Defaults to NO. + @param enabled The new HTTP pipelining status. + */ ++ (void)_setHTTPPipeliningEnabled:(BOOL)enabled; + @end @interface WebView (WebViewPrintingPrivate) |