Title: [176248] branches/safari-600.3-branch/Source
Revision
176248
Author
[email protected]
Date
2014-11-17 19:45:33 -0800 (Mon, 17 Nov 2014)

Log Message

Merge r176164. rdar://problem/18953982

Modified Paths

Added Paths

Diff

Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-11-18 03:45:33 UTC (rev 176248)
@@ -1,5 +1,35 @@
 2014-11-17  Dana Burkart  <[email protected]>
 
+        Merge r176164. <rdar://problem/18953982>
+
+    2014-11-16  Tim Horton  <[email protected]>
+    
+            Use TextIndicator instead of the built in Lookup highlight
+            https://bugs.webkit.org/show_bug.cgi?id=138775
+            <rdar://problem/18953982>
+    
+            Reviewed by Anders Carlsson.
+    
+            * WebCore.exp.in:
+            * platform/mac/WebCoreSystemInterface.h:
+            * platform/mac/WebCoreSystemInterface.mm:
+            Remove a WKSI import/export that we don't need anymore.
+            
+            * platform/spi/mac/LookupSPI.h: Added.
+            (WebCore::canDisableLookupIndicator):
+            Add Lookup SPI header.
+            Add a 'canDisableLookupIndicator', which must be called in any translation
+            unit that wants to use either of the soft-linked constants related to
+            that functionality, before calling the get* function.
+    
+            * WebCore.xcodeproj/project.pbxproj:
+            * editing/mac/DictionaryLookup.mm:
+            (WebCore::rangeForDictionaryLookupForSelection):
+            (WebCore::rangeForDictionaryLookupAtHitTestResult):
+            Adopt the Lookup SPI header.
+    
+2014-11-17  Dana Burkart  <[email protected]>
+
         Merge r175492. <rdar://problem/18978410>
 
     2014-11-03  Simon Fraser  <[email protected]>

Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in	2014-11-18 03:45:33 UTC (rev 176248)
@@ -2420,7 +2420,6 @@
 _wkDrawMediaUIPart
 _wkDrawTextFieldCellFocusRing
 _wkExecutableWasLinkedOnOrBeforeSnowLeopard
-_wkExtractWordDefinitionTokenRangeFromContextualString
 _wkGetAXTextMarkerRangeTypeID
 _wkGetAXTextMarkerTypeID
 _wkGetBytesFromAXTextMarker

Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-11-18 03:45:33 UTC (rev 176248)
@@ -1083,6 +1083,7 @@
 		2D3EF4491917915C00034184 /* WebActionDisablingCALayerDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4451917915C00034184 /* WebActionDisablingCALayerDelegate.mm */; };
 		2D3EF44A1917915C00034184 /* WebCoreCALayerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4461917915C00034184 /* WebCoreCALayerExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D3EF44B1917915C00034184 /* WebCoreCALayerExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */; };
+		2D413F611A187A3F0041A521 /* LookupSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D413F601A187A3F0041A521 /* LookupSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D46F04E17B96FBD005647F0 /* IntPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04D17B96FBD005647F0 /* IntPoint.cpp */; };
 		2D46F05017B96FD2005647F0 /* IntSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04F17B96FD2005647F0 /* IntSize.cpp */; };
 		2D481F00146B5C4C00AA7834 /* CrossfadeGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */; };
@@ -8106,6 +8107,7 @@
 		2D3EF4451917915C00034184 /* WebActionDisablingCALayerDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebActionDisablingCALayerDelegate.mm; sourceTree = "<group>"; };
 		2D3EF4461917915C00034184 /* WebCoreCALayerExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreCALayerExtras.h; sourceTree = "<group>"; };
 		2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreCALayerExtras.mm; sourceTree = "<group>"; };
+		2D413F601A187A3F0041A521 /* LookupSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LookupSPI.h; sourceTree = "<group>"; };
 		2D46F04D17B96FBD005647F0 /* IntPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntPoint.cpp; sourceTree = "<group>"; };
 		2D46F04F17B96FD2005647F0 /* IntSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntSize.cpp; sourceTree = "<group>"; };
 		2D58D8531A15F65F00A5F726 /* DataDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetection.h; sourceTree = "<group>"; };
@@ -17629,6 +17631,7 @@
 			isa = PBXGroup;
 			children = (
 				2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
+				2D413F601A187A3F0041A521 /* LookupSPI.h */,
 				2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
 				2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
 				9348428119F1A9190009D5AE /* NSViewSPI.h */,
@@ -23625,7 +23628,7 @@
 				A584FE351864D5AF00843B10 /* CommandLineAPIHost.h in Headers */,
 				A584FE2C1863870F00843B10 /* CommandLineAPIModule.h in Headers */,
 				A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */,
-				2D29ECC8192ECC8300984B78 /* DisplayRefreshMonitorManager.h in Headers */,
+				2D413F611A187A3F0041A521 /* LookupSPI.h in Headers */,
 				6550B6A2099DF0270090D781 /* Comment.h in Headers */,
 				E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
 				37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */,

Modified: branches/safari-600.3-branch/Source/WebCore/editing/mac/DictionaryLookup.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/editing/mac/DictionaryLookup.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebCore/editing/mac/DictionaryLookup.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -34,6 +34,7 @@
 #import "FrameSelection.h"
 #import "HTMLConverter.h"
 #import "HitTestResult.h"
+#import "LookupSPI.h"
 #import "Page.h"
 #import "Range.h"
 #import "RenderObject.h"
@@ -115,8 +116,9 @@
     String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get());
 
     // Since we already have the range we want, we just need to grab the returned options.
-    wkExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options);
-    
+    if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass())
+        [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options];
+
     return selectedRange.release();
 }
 
@@ -155,7 +157,9 @@
 
     String fullPlainTextString = plainText(fullCharacterRange.get());
 
-    NSRange extractedRange = wkExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options);
+    NSRange extractedRange = NSMakeRange(rangeToPass.location, 0);
+    if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass())
+        extractedRange = [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options];
 
     // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
     if (extractedRange.location == NSNotFound)

Modified: branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -288,8 +288,6 @@
 
 extern bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
 
-extern NSRange (*wkExtractWordDefinitionTokenRangeFromContextualString)(NSString *contextString, NSRange range, NSDictionary **options);
-
 extern CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
 
 extern NSCursor *(*wkCursor)(const char*);

Modified: branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -146,8 +146,6 @@
 
 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
 
-NSRange (*wkExtractWordDefinitionTokenRangeFromContextualString)(NSString *contextString, NSRange range, NSDictionary **options);
-
 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
 void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef);
 

Copied: branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h (from rev 176164, trunk/Source/WebCore/platform/spi/mac/LookupSPI.h) (0 => 176248)


--- branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h	                        (rev 0)
+++ branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 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. ``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
+ * 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 "SoftLinking.h"
+#import <objc/runtime.h>
+
+#if PLATFORM(MAC)
+
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(Lookup)
+SOFT_LINK_CLASS_OPTIONAL(Lookup, LULookupDefinitionModule)
+
+SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUTermOptionDisableSearchTermIndicator, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
+
+namespace WebCore {
+inline bool canDisableLookupIndicator()
+{
+    return canLoadLUTermOptionDisableSearchTermIndicator() && canLoadLUNotificationPopoverWillClose();
+}
+};
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <Lookup/Lookup.h>
+
+#else
+
+@interface LULookupDefinitionModule : NSObject
+
++ (NSRange)tokenRangeForString:(NSString *)string range:(NSRange)range options:(NSDictionary **)options;
++ (void)showDefinitionForTerm:(NSAttributedString *)term atLocation:(NSPoint)screenPoint options:(NSDictionary *)options;
++ (void)hideDefinition;
+
+@end
+
+#endif // !USE(APPLE_INTERNAL_SDK)
+
+#endif // PLATFORM(MAC)

Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog	2014-11-18 03:45:33 UTC (rev 176248)
@@ -1,5 +1,27 @@
 2014-11-17  Dana Burkart  <[email protected]>
 
+        Merge r176164. <rdar://problem/18953982>
+
+    2014-11-16  Tim Horton  <[email protected]>
+    
+            Use TextIndicator instead of the built in Lookup highlight
+            https://bugs.webkit.org/show_bug.cgi?id=138775
+            <rdar://problem/18953982>
+    
+            Reviewed by Anders Carlsson.
+    
+            * WebCoreSupport/WebSystemInterface.mm:
+            (InitWebCoreSystemInterface):
+            Remove a WKSI import.
+    
+            * WebView/WebActionMenuController.mm:
+            (-[WebActionMenuController _lookupText:]):
+            (-[WebActionMenuController _createActionMenuItemForTag:]):
+            Make use of the new Lookup SPI header.
+            Disable the Lookup item if lookup is not available.
+    
+2014-11-17  Dana Burkart  <[email protected]>
+
         Merge r176145. <rdar://problem/18989840>
 
     2014-11-14  Timothy Horton  <[email protected]>

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -163,7 +163,6 @@
 #if !PLATFORM(IOS)
     INIT(RecommendedScrollerStyle);
     INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
-    INIT(ExtractWordDefinitionTokenRangeFromContextualString);
     INIT(CopyDefaultSearchProviderDisplayName);
     INIT(Cursor);
 #endif

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -48,6 +48,7 @@
 #import <WebCore/FrameView.h>
 #import <WebCore/HTMLConverter.h>
 #import <WebCore/LocalizedStrings.h>
+#import <WebCore/LookupSPI.h>
 #import <WebCore/NSSharingServicePickerSPI.h>
 #import <WebCore/NSSharingServiceSPI.h>
 #import <WebCore/NSViewSPI.h>
@@ -564,7 +565,7 @@
     // Convert to screen coordinates.
     textBaselineOrigin = [_webView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
 
-    WKShowWordDefinitionWindow(popupInfo.attributedString.get(), textBaselineOrigin, popupInfo.options.get());
+    [getLULookupDefinitionModuleClass() showDefinitionForTerm:popupInfo.attributedString.get() atLocation:textBaselineOrigin options:popupInfo.options.get()];
 }
 
 - (void)_paste:(id)sender
@@ -690,6 +691,7 @@
     SEL selector = nullptr;
     NSString *title = nil;
     NSImage *image = nil;
+    bool enabled = true;
 
     switch (tag) {
     case WebActionMenuItemTagOpenLinkInDefaultBrowser:
@@ -720,6 +722,7 @@
         selector = @selector(_lookupText:);
         title = WEB_UI_STRING_KEY("Look Up", "Look Up (action menu item)", "action menu item");
         image = [NSImage imageNamed:@"NSActionMenuLookup"];
+        enabled = getLULookupDefinitionModuleClass();
         break;
 
     case WebActionMenuItemTagPaste:
@@ -782,6 +785,7 @@
     [item setImage:image];
     [item setTarget:self];
     [item setTag:tag];
+    [item setEnabled:enabled];
     return item;
 }
 

Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-18 03:45:33 UTC (rev 176248)
@@ -1,5 +1,100 @@
 2014-11-17  Dana Burkart  <[email protected]>
 
+        Merge r176164. <rdar://problem/18953982>
+
+    2014-11-16  Tim Horton  <[email protected]>
+    
+            Use TextIndicator instead of the built in Lookup highlight
+            https://bugs.webkit.org/show_bug.cgi?id=138775
+            <rdar://problem/18953982>
+    
+            Reviewed by Anders Carlsson.
+    
+            In order to make the yellow highlight for Lookup more accurately match the
+            painted content of the web page (in light of e.g. Web fonts, and interesting
+            text features that only WebKit implements and cannot round-trip through
+            NSAttributedString), use a TextIndicator instead of the built-in Lookup
+            highlight where possible.
+    
+            * Configurations/BaseTarget.xcconfig:
+            Make it possible to include headers from private frameworks. This matches WebCore.
+    
+            * Shared/DictionaryPopupInfo.cpp:
+            (WebKit::DictionaryPopupInfo::encode):
+            (WebKit::DictionaryPopupInfo::decode):
+            * Shared/DictionaryPopupInfo.h:
+            Include the attributed string inside the DictionaryPopupInfo, instead of
+            as a secondary argument to DidPerformDictionaryLookup.
+            Add a TextIndicator to DictionaryPopupInfo, which can be used to highlight
+            the text in the UI process.
+    
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView dealloc]):
+            (-[WKView viewDidMoveToWindow]):
+            (-[WKView _dictionaryLookupPopoverWillClose:]):
+            (-[WKView _setTextIndicator:fadeOut:animate:animationCompletionHandler:]):
+            (-[WKView _setTextIndicator:fadeOut:animate:]):
+            (-[WKView initWithFrame:context:configuration:webView:]):
+            (+[WKView hideWordDefinitionWindow]):
+            * UIProcess/API/mac/WKViewInternal.h:
+            Adopt the Lookup SPI header.
+            If we have the requisite API, register the notification that Lookup sends
+            when the popover closes, and hook that up to hide the text indicator.
+            Add a version of _setTextIndicator: that takes an animation completion handler.
+    
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::didPerformDictionaryLookup):
+            * UIProcess/mac/WebPageProxyMac.mm:
+            (WebKit::WebPageProxy::didPerformDictionaryLookup):
+            Adjust to the new didPerformDictionaryLookup signature.
+    
+            * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+            (InitWebCoreSystemInterface):
+            Remove a WKSI import.
+    
+            * UIProcess/mac/PageClientImpl.h:
+            * UIProcess/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::didPerformDictionaryLookup):
+            If we have the requisite API, disable Lookup's built-in highlight and
+            present a TextIndicator instead.
+            We currently have to run the animations serially (first bounce the TextIndicator,
+            then animate in the Lookup popover) because the act of adding the Lookup popover
+            blocks us from getting any animation events for the TextIndicator, and breaks
+            the bounce. We could also fix this by using a threaded animation for the TextIndicator,
+            but it's not clear that it's safe to do so.
+    
+            (WebKit::PageClientImpl::dismissDictionaryLookupPanel):
+            When explicitly dismissing the Lookup panel, also hide the text indicator.
+    
+            * UIProcess/mac/TextIndicatorWindow.h:
+            * UIProcess/mac/TextIndicatorWindow.mm:
+            (WebKit::TextIndicatorWindow::setTextIndicator):
+            Store the completion handler.
+    
+            (WebKit::TextIndicatorWindow::bounceAnimationDidEnd):
+            Call the completion handler when the animation completes.
+    
+            * UIProcess/mac/WKActionMenuController.mm:
+            (-[WKActionMenuController _createActionMenuItemForTag:]):
+            Disable the Lookup item if lookup is not available.
+    
+            * WebProcess/Plugins/PDF/PDFPlugin.mm:
+            (WebKit::PDFPlugin::showDefinitionForAttributedString):
+            Adjust to the new didPerformDictionaryLookup signature.
+            Since PDFPlugin can't trivially repaint the required part of the PDF,
+            we don't build a TextIndicator. This will result in PDFPlugin continuing
+            to use Lookup's built-in highlight.
+            
+            * WebProcess/WebPage/mac/WebPageMac.mm:
+            (WebKit::WebPage::performDictionaryLookupForRange):
+            Build a TextIndicator from the Lookup range and pass it along with
+            the DictionaryPopupInfo.
+    
+2014-11-17  Dana Burkart  <[email protected]>
+
         Merge r176150. <rdar://problem/18982046>
 
     2014-11-14  Tim Horton  <[email protected]>

Modified: branches/safari-600.3-branch/Source/WebKit2/Configurations/BaseTarget.xcconfig (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/Configurations/BaseTarget.xcconfig	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/Configurations/BaseTarget.xcconfig	2014-11-18 03:45:33 UTC (rev 176248)
@@ -29,7 +29,7 @@
 GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit
 HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2 $(HEADER_SEARCH_PATHS);
 
-OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks;
+OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
 OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS);
 
 NORMAL_WEBKIT_FRAMEWORKS_DIR = $(SYSTEM_LIBRARY_DIR)/Frameworks;

Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.cpp (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.cpp	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.cpp	2014-11-18 03:45:33 UTC (rev 176248)
@@ -37,12 +37,15 @@
 void DictionaryPopupInfo::encode(IPC::ArgumentEncoder& encoder) const
 {
     encoder << origin;
+    encoder << textIndicator;
 
 #if PLATFORM(COCOA)
     bool hadOptions = options;
     encoder << hadOptions;
     if (hadOptions)
         IPC::encode(encoder, options.get());
+
+    encoder << attributedString;
 #endif
 }
 
@@ -50,6 +53,10 @@
 {
     if (!decoder.decode(result.origin))
         return false;
+
+    if (!decoder.decode(result.textIndicator))
+        return false;
+
 #if PLATFORM(COCOA)
     bool hadOptions;
     if (!decoder.decode(hadOptions))
@@ -58,6 +65,9 @@
         if (!IPC::decode(decoder, result.options))
             return false;
     }
+
+    if (!decoder.decode(result.attributedString))
+        return false;
 #endif
     return true;
 }

Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -26,15 +26,17 @@
 #ifndef DictionaryPopupInfo_h
 #define DictionaryPopupInfo_h
 
+#include "TextIndicator.h"
 #include <WebCore/FloatPoint.h>
 
 #if PLATFORM(COCOA)
+#include "AttributedString.h"
 #include <wtf/RetainPtr.h>
 #endif
 
 namespace IPC {
-    class ArgumentDecoder;
-    class ArgumentEncoder;
+class ArgumentDecoder;
+class ArgumentEncoder;
 }
 
 namespace WebKit {
@@ -44,8 +46,10 @@
     static bool decode(IPC::ArgumentDecoder&, DictionaryPopupInfo&);
 
     WebCore::FloatPoint origin;
+    TextIndicator::Data textIndicator;
 #if PLATFORM(COCOA)
     RetainPtr<CFDictionaryRef> options;
+    AttributedString attributedString;
 #endif
 };
 

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -88,6 +88,7 @@
 #import <WebCore/FileSystem.h>
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/LocalizedStrings.h>
+#import <WebCore/LookupSPI.h>
 #import <WebCore/NSViewSPI.h>
 #import <WebCore/PlatformEventFactoryMac.h>
 #import <WebCore/PlatformScreen.h>
@@ -325,6 +326,9 @@
 
     [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationWillTerminateNotification object:NSApp];
 
+    if (canDisableLookupIndicator())
+        [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
+
     WebContext::statistics().wkViewCount--;
 
     [super dealloc];
@@ -2553,7 +2557,8 @@
         [NSEvent removeMonitor:_data->_flagsChangedEventMonitor];
         _data->_flagsChangedEventMonitor = nil;
 
-        WKHideWordDefinitionWindow();
+        if (getLULookupDefinitionModuleClass())
+            [getLULookupDefinitionModuleClass() hideDefinition];
         [self _dismissActionMenuPopovers];
     }
 
@@ -2689,6 +2694,11 @@
     _data->_page->process().context().applicationWillTerminate();
 }
 
+- (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
+{
+    [self _setTextIndicator:nil fadeOut:NO animate:NO];
+}
+
 - (void)_accessibilityRegisterUIProcessTokens
 {
     // Initialize remote accessibility when the window connection has been established.
@@ -3057,7 +3067,7 @@
     }
 }
 
-- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
+- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate animationCompletionHandler:(std::function<void ()>)completionHandler
 {
     if (!textIndicator) {
         _data->_textIndicatorWindow = nullptr;
@@ -3067,9 +3077,14 @@
     if (!_data->_textIndicatorWindow)
         _data->_textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
 
-    _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, animate);
+    _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, animate, WTF::move(completionHandler));
 }
 
+- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
+{
+    [self _setTextIndicator:textIndicator fadeOut:fadeOut animate:animate animationCompletionHandler:[] {}];
+}
+
 - (CALayer *)_rootLayer
 {
     return [_data->_layerHostingView layer];
@@ -3559,6 +3574,9 @@
 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:NSApp];
 
+    if (canDisableLookupIndicator())
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     if ([self respondsToSelector:@selector(setActionMenu:)]) {
         RetainPtr<NSMenu> menu = adoptNS([[NSMenu alloc] init]);
@@ -3801,7 +3819,9 @@
 
 + (void)hideWordDefinitionWindow
 {
-    WKHideWordDefinitionWindow();
+    if (!getLULookupDefinitionModuleClass())
+        return;
+    [getLULookupDefinitionModuleClass() hideDefinition];
 }
 
 - (CGFloat)minimumLayoutWidth

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -81,6 +81,7 @@
 - (NSRect)_convertToDeviceSpace:(NSRect)rect;
 - (NSRect)_convertToUserSpace:(NSRect)rect;
 - (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
+- (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate animationCompletionHandler:(std::function<void ()>)completionHandler;
 
 - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
 - (CALayer *)_acceleratedCompositingModeRootLayer;

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -223,7 +223,7 @@
 #if PLATFORM(MAC)
     virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) = 0;
     virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) = 0;
-    virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&) = 0;
+    virtual void didPerformDictionaryLookup(const DictionaryPopupInfo&) = 0;
     virtual void dismissDictionaryLookupPanel() = 0;
     virtual void dismissActionMenuPopovers() = 0;
     virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -1148,7 +1148,7 @@
     void searchTheWeb(const String&);
 
     // Dictionary.
-    void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
+    void didPerformDictionaryLookup(const DictionaryPopupInfo&);
 #endif
 
     // Spelling and grammar.

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-11-18 03:45:33 UTC (rev 176248)
@@ -287,7 +287,7 @@
 
 #if PLATFORM(COCOA)
     # Dictionary support.
-    DidPerformDictionaryLookup(WebKit::AttributedString text, WebKit::DictionaryPopupInfo dictionaryPopupInfo)
+    DidPerformDictionaryLookup(WebKit::DictionaryPopupInfo dictionaryPopupInfo)
 
     # Keyboard input support messages
     ExecuteSavedCommandBySelector(String selector) -> (bool handled)

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -750,7 +750,7 @@
     process().send(Messages::WebPage::SetAssistedNodeSelectedIndex(index, allowMultipleSelection), m_pageID);
 }
 
-void WebPageProxy::didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&)
+void WebPageProxy::didPerformDictionaryLookup(const DictionaryPopupInfo&)
 {
     notImplemented();
 }

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -136,7 +136,7 @@
 
     virtual void makeFirstResponder();
     
-    virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
+    virtual void didPerformDictionaryLookup(const DictionaryPopupInfo&);
     virtual void dismissDictionaryLookupPanel();
     virtual void dismissActionMenuPopovers();
 

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -58,6 +58,7 @@
 #import <WebCore/GraphicsContext.h>
 #import <WebCore/Image.h>
 #import <WebCore/KeyboardEvent.h>
+#import <WebCore/LookupSPI.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/SharedBuffer.h>
 #import <WebCore/TextUndoInsertionMarkupMac.h>
@@ -529,22 +530,39 @@
     [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
 }
 
-void PageClientImpl::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo)
+void PageClientImpl::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo)
 {
-    RetainPtr<NSAttributedString> attributedString = text.string;
+    if (!getLULookupDefinitionModuleClass())
+        return;
+
     NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
 
     // Convert to screen coordinates.
     textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
     textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
 
-    WKShowWordDefinitionWindow(attributedString.get(), textBaselineOrigin, (NSDictionary *)dictionaryPopupInfo.options.get());
+    RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]);
+
+    if (canDisableLookupIndicator() && dictionaryPopupInfo.textIndicator.contentImage) {
+        // Run the animations serially because attaching another subwindow breaks the bounce animation.
+        // We could consider making the bounce NSAnimationNonblockingThreaded instead, which seems
+        // to work, but need to consider all of the implications.
+        [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO animate:YES animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] {
+            [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
+            [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+        }];
+    } else
+        [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
 }
 
 void PageClientImpl::dismissDictionaryLookupPanel()
 {
+    if (!getLULookupDefinitionModuleClass())
+        return;
+
     // FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>).
-    WKHideWordDefinitionWindow();
+    [getLULookupDefinitionModuleClass() hideDefinition];
+    setTextIndicator(nil, false, true);
 }
 
 void PageClientImpl::dismissActionMenuPopovers()

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h	2014-11-18 03:45:33 UTC (rev 176248)
@@ -29,6 +29,7 @@
 #if PLATFORM(MAC)
 
 #import "WebKitSystemInterface.h"
+#import <functional>
 #import <wtf/Noncopyable.h>
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
@@ -48,7 +49,7 @@
     explicit TextIndicatorWindow(WKView *);
     ~TextIndicatorWindow();
 
-    void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate);
+    void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate, std::function<void ()> animationCompletionHandler);
 
 private:
     void closeWindow();
@@ -70,6 +71,8 @@
 
     RunLoop::Timer<TextIndicatorWindow> m_startFadeOutTimer;
     RetainPtr<WKTextIndicatorWindowAnimation> m_fadeOutAnimation;
+
+    std::function<void ()> m_bounceAnimationCompletionHandler;
 };
 
 } // namespace WebKit

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -120,7 +120,7 @@
     closeWindow();
 }
 
-void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate)
+void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate, std::function<void ()> animationCompletionHandler)
 {
     if (m_textIndicator == textIndicator)
         return;
@@ -154,6 +154,7 @@
     [m_textIndicatorWindow setReleasedWhenClosed:NO];
 
     if (animate) {
+        m_bounceAnimationCompletionHandler = WTF::move(animationCompletionHandler);
         // Start the bounce animation.
         m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_textIndicatorWindow.get());
         m_bounceAnimation = adoptNS([[WKTextIndicatorWindowAnimation alloc] _initWithTextIndicatorWindow:this animationDuration:bounceAnimationDuration
@@ -230,6 +231,7 @@
 
     WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
     m_bounceAnimationContext = 0;
+    m_bounceAnimationCompletionHandler();
 }
 
 } // namespace WebKit

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -45,6 +45,7 @@
 #import <WebCore/DataDetectorsSPI.h>
 #import <WebCore/GeometryUtilities.h>
 #import <WebCore/LocalizedStrings.h>
+#import <WebCore/LookupSPI.h>
 #import <WebCore/NSSharingServiceSPI.h>
 #import <WebCore/NSSharingServicePickerSPI.h>
 #import <WebCore/NSViewSPI.h>
@@ -756,6 +757,7 @@
     SEL selector = nullptr;
     NSString *title = nil;
     NSImage *image = nil;
+    bool enabled = true;
 
     switch (tag) {
     case kWKContextActionItemTagOpenLinkInDefaultBrowser:
@@ -811,6 +813,7 @@
         selector = @selector(_lookupText:);
         title = WEB_UI_STRING_KEY("Look Up", "Look Up (action menu item)", "action menu item");
         image = [NSImage imageNamed:@"NSActionMenuLookup"];
+        enabled = getLULookupDefinitionModuleClass();
         break;
 
     case kWKContextActionItemTagPaste:
@@ -850,6 +853,7 @@
     [item setImage:image];
     [item setTarget:self];
     [item setTag:tag];
+    [item setEnabled:enabled];
     return item;
 }
 

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -450,9 +450,9 @@
     process().send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID);
 }
 
-void WebPageProxy::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo)
+void WebPageProxy::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo)
 {
-    m_pageClient.didPerformDictionaryLookup(text, dictionaryPopupInfo);
+    m_pageClient.didPerformDictionaryLookup(dictionaryPopupInfo);
 }
     
 void WebPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data)

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -1700,11 +1700,9 @@
 {
     DictionaryPopupInfo dictionaryPopupInfo;
     dictionaryPopupInfo.origin = convertFromPDFViewToRootView(IntPoint(point));
+    dictionaryPopupInfo.attributedString.string = string;
 
-    AttributedString attributedString;
-    attributedString.string = string;
-
-    webFrame()->page()->send(Messages::WebPageProxy::DidPerformDictionaryLookup(attributedString, dictionaryPopupInfo));
+    webFrame()->page()->send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfo));
 }
 
 unsigned PDFPlugin::countFindMatches(const String& target, WebCore::FindOptions options, unsigned maxMatchCount)

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -153,7 +153,6 @@
 #if !PLATFORM(IOS)
         INIT(RecommendedScrollerStyle);
         INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
-        INIT(ExtractWordDefinitionTokenRangeFromContextualString);
         INIT(CopyDefaultSearchProviderDisplayName);
         INIT(Cursor);
         INIT(WindowSetScaledFrame);

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (176247 => 176248)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2014-11-18 03:29:02 UTC (rev 176247)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2014-11-18 03:45:33 UTC (rev 176248)
@@ -543,10 +543,14 @@
         [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
     }];
 
-    AttributedString attributedString;
-    attributedString.string = scaledNSAttributedString;
+    RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(range);
+    if (!textIndicator)
+        return;
 
-    send(Messages::WebPageProxy::DidPerformDictionaryLookup(attributedString, dictionaryPopupInfo));
+    dictionaryPopupInfo.textIndicator = textIndicator->data();
+    dictionaryPopupInfo.attributedString.string = scaledNSAttributedString;
+
+    send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfo));
 }
 
 bool WebPage::performNonEditingBehaviorForSelector(const String& selector, KeyboardEvent* event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to