Title: [238014] trunk
Revision
238014
Author
[email protected]
Date
2018-11-08 17:59:10 -0800 (Thu, 08 Nov 2018)

Log Message

Adopt Reveal Framework to replace Lookup
https://bugs.webkit.org/show_bug.cgi?id=191097
Source/WebCore:

Reviewed by Tim Horton.

Reveal is not currently testable.

The Reveal framework does the same job as Lookup and DataDectors.
In this patch we switch from using Lookup to determine what text
to select and define to using Reveal and RVItems. Since this
code needs to work on older systems, and Reveal is newer, we also need
to keep around the old code for old systems so that they can also
continue to work. Eventually we will remove this code and also likly switch
to passing RVItems across from the web process rather than making them
on each side.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/mac/DictionaryLookup.h:
* editing/mac/DictionaryLookup.mm:

Create a delegate to respond to Reveal and help draw the string or highlight.

(-[WebRevealHighlight initWithHighlightRect:useDefaultHighlight:attributedString:]):
(-[WebRevealHighlight setClearTextIndicator:]):
(-[WebRevealHighlight revealContext:rectsForItem:]):
(-[WebRevealHighlight revealContext:drawRectsForItem:]):
(-[WebRevealHighlight revealContext:shouldUseDefaultHighlightForItem:]):
(-[WebRevealHighlight revealContext:stopHighlightingItem:]):
(WebCore::showPopupOrCreateAnimationController):

Unify the code paths and utalize the Reveal framework to create and/or display the popovers.

(WebCore::DictionaryLookup::showPopup):
(WebCore::DictionaryLookup::animationControllerForPopup):

Pipe the new callback through.

(WebCore::tokenRange): Deleted.

Only used with Lookup

(WebCore::selectionContainsPosition): Deleted.

Only used with Lookup.

* editing/mac/DictionaryLookupLegacy.mm: Copied from Source/WebCore/editing/mac/DictionaryLookup.mm.

Keep a copy of the previous implementation of DictionaryLookup, because Reveal not available on older
system.

(WebCore::tokenRange):
(WebCore::selectionContainsPosition):
(WebCore::expandSelectionByCharacters):
(WebCore::showPopupOrCreateAnimationController):
(WebCore::DictionaryLookup::showPopup):
(WebCore::DictionaryLookup::hidePopup):
(WebCore::DictionaryLookup::animationControllerForPopup):

Source/WebCore/PAL:

<rdar://problem/45924508>

Reviewed by Tim Horton.

Add in reveal SPI so WebKit will continue to build without the internal SDK.

* PAL.xcodeproj/project.pbxproj:
* pal/spi/mac/RevealSPI.h: Added.

Source/WebKit:

<rdar://problem/45924508>

Reviewed by Tim Horton.

Pass in what it needed to clear the textIndicators. This is better than
the current notification structure.

* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKWindowVisibilityObserver dealloc]):
(-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::didPerformDictionaryLookup):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _animationControllerForText]):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::showDefinitionForAttributedString):

Generate and pass in the text indicator information, as this is needed now.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin):

Source/WebKitLegacy/mac:

<rdar://problem/45924508>

Reviewed by Tim Horton.

Pass in what it needed to clear the textIndicators. This is better than
the current notification structure.

* WebView/WebView.mm:
(-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
(-[WebView _prepareForDictionaryLookup]):

LayoutTests:

Reviewed by Tim Horton.

Reveal selects spaces instead of adjacent words, no matter how interesting they are.
Update the tests to show this, and change the expections for previous platforms.

* editing/mac/selection/context-menu-select-editability-expected.txt:
* editing/mac/selection/context-menu-select-editability.html:
* platform/mac-highsierra/editing/mac/selection/context-menu-select-editability-expected.txt: Copied from LayoutTests/editing/mac/selection/context-menu-select-editability-expected.txt.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238013 => 238014)


--- trunk/LayoutTests/ChangeLog	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/LayoutTests/ChangeLog	2018-11-09 01:59:10 UTC (rev 238014)
@@ -1,3 +1,17 @@
+2018-11-08  Megan Gardner  <[email protected]>
+
+        Adopt Reveal Framework to replace Lookup
+        https://bugs.webkit.org/show_bug.cgi?id=191097
+
+        Reviewed by Tim Horton.
+
+        Reveal selects spaces instead of adjacent words, no matter how interesting they are. 
+        Update the tests to show this, and change the expections for previous platforms.
+
+        * editing/mac/selection/context-menu-select-editability-expected.txt:
+        * editing/mac/selection/context-menu-select-editability.html:
+        * platform/mac-highsierra/editing/mac/selection/context-menu-select-editability-expected.txt: Copied from LayoutTests/editing/mac/selection/context-menu-select-editability-expected.txt.
+
 2018-11-08  Ryan Haddad  <[email protected]>
 
         Clean up test expectations after r237942

Modified: trunk/LayoutTests/editing/mac/selection/context-menu-select-editability-expected.txt (238013 => 238014)


--- trunk/LayoutTests/editing/mac/selection/context-menu-select-editability-expected.txt	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/LayoutTests/editing/mac/selection/context-menu-select-editability-expected.txt	2018-11-09 01:59:10 UTC (rev 238014)
@@ -7,7 +7,7 @@
 
 
 PASS getSelectionForId('inputWhitespace') is ""
-PASS getSelectionForId('readOnlyWhitespace') is "New York, New York"
+PASS getSelectionForId('readOnlyWhitespace') is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/editing/mac/selection/context-menu-select-editability.html (238013 => 238014)


--- trunk/LayoutTests/editing/mac/selection/context-menu-select-editability.html	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/LayoutTests/editing/mac/selection/context-menu-select-editability.html	2018-11-09 01:59:10 UTC (rev 238014)
@@ -31,7 +31,7 @@
 function performTest()
 {
     shouldBe("getSelectionForId('inputWhitespace')", '""');
-    shouldBe("getSelectionForId('readOnlyWhitespace')", '"New York, New York"');
+    shouldBe("getSelectionForId('readOnlyWhitespace')", '""');
 
     finishJSTest();
 }

Copied: trunk/LayoutTests/platform/mac-highsierra/editing/mac/selection/context-menu-select-editability-expected.txt (from rev 238013, trunk/LayoutTests/editing/mac/selection/context-menu-select-editability-expected.txt) (0 => 238014)


--- trunk/LayoutTests/platform/mac-highsierra/editing/mac/selection/context-menu-select-editability-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-highsierra/editing/mac/selection/context-menu-select-editability-expected.txt	2018-11-09 01:59:10 UTC (rev 238014)
@@ -0,0 +1,15 @@
+This test checks that conext menu selection allows whitespace for non-editable fields. To test manually, right click on the blank text in the input box.
+
+The crowd says: New York, New York    is a helluva town!
+The crowd says: New York, New York    is a helluva town!
+
+
+
+
+PASS getSelectionForId('inputWhitespace') is ""
+FAIL getSelectionForId('readOnlyWhitespace') should be . Was New York, New York.
+PASS successfullyParsed is true
+Some tests failed.
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (238013 => 238014)


--- trunk/Source/WebCore/ChangeLog	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/ChangeLog	2018-11-09 01:59:10 UTC (rev 238014)
@@ -1,3 +1,64 @@
+2018-11-08  Megan Gardner  <[email protected]>
+
+        Adopt Reveal Framework to replace Lookup
+        https://bugs.webkit.org/show_bug.cgi?id=191097
+
+        Reviewed by Tim Horton.
+
+        Reveal is not currently testable.
+
+        The Reveal framework does the same job as Lookup and DataDectors.
+        In this patch we switch from using Lookup to determine what text
+        to select and define to using Reveal and RVItems. Since this
+        code needs to work on older systems, and Reveal is newer, we also need
+        to keep around the old code for old systems so that they can also
+        continue to work. Eventually we will remove this code and also likly switch
+        to passing RVItems across from the web process rather than making them
+        on each side.
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * editing/mac/DictionaryLookup.h:
+        * editing/mac/DictionaryLookup.mm:
+
+        Create a delegate to respond to Reveal and help draw the string or highlight.
+
+        (-[WebRevealHighlight initWithHighlightRect:useDefaultHighlight:attributedString:]):
+        (-[WebRevealHighlight setClearTextIndicator:]):
+        (-[WebRevealHighlight revealContext:rectsForItem:]):
+        (-[WebRevealHighlight revealContext:drawRectsForItem:]):
+        (-[WebRevealHighlight revealContext:shouldUseDefaultHighlightForItem:]):
+        (-[WebRevealHighlight revealContext:stopHighlightingItem:]):
+        (WebCore::showPopupOrCreateAnimationController):
+
+        Unify the code paths and utalize the Reveal framework to create and/or display the popovers.
+
+        (WebCore::DictionaryLookup::showPopup):
+        (WebCore::DictionaryLookup::animationControllerForPopup):
+
+        Pipe the new callback through.
+
+        (WebCore::tokenRange): Deleted.
+
+        Only used with Lookup
+
+        (WebCore::selectionContainsPosition): Deleted.
+
+        Only used with Lookup.
+
+        * editing/mac/DictionaryLookupLegacy.mm: Copied from Source/WebCore/editing/mac/DictionaryLookup.mm.
+
+        Keep a copy of the previous implementation of DictionaryLookup, because Reveal not available on older
+        system.
+
+        (WebCore::tokenRange):
+        (WebCore::selectionContainsPosition):
+        (WebCore::expandSelectionByCharacters):
+        (WebCore::showPopupOrCreateAnimationController):
+        (WebCore::DictionaryLookup::showPopup):
+        (WebCore::DictionaryLookup::hidePopup):
+        (WebCore::DictionaryLookup::animationControllerForPopup):
+
 2018-11-08  Keith Rollin  <[email protected]>
 
         Create .xcfilelist files

Modified: trunk/Source/WebCore/PAL/ChangeLog (238013 => 238014)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-11-09 01:59:10 UTC (rev 238014)
@@ -1,3 +1,16 @@
+2018-11-08  Megan Gardner  <[email protected]>
+
+        Adopt Reveal Framework to replace Lookup
+        https://bugs.webkit.org/show_bug.cgi?id=191097
+        <rdar://problem/45924508>
+
+        Reviewed by Tim Horton.
+
+        Add in reveal SPI so WebKit will continue to build without the internal SDK.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/spi/mac/RevealSPI.h: Added.
+
 2018-11-06  Justin Fan  <[email protected]>
 
         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain

Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (238013 => 238014)


--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2018-11-09 01:59:10 UTC (rev 238014)
@@ -111,6 +111,7 @@
 		2E1342CC215AA10A007199D2 /* UIKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E1342CA215AA10A007199D2 /* UIKitSoftLink.h */; };
 		2E1342CD215AA10A007199D2 /* UIKitSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */; };
 		31308B1420A21705003FB929 /* SystemPreviewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31308B1320A21705003FB929 /* SystemPreviewSPI.h */; };
+		442956CD218A72DF0080DB54 /* RevealSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 442956CC218A72DE0080DB54 /* RevealSPI.h */; };
 		570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */; };
 		570AB8F920AF6E3D00B8BE87 /* NSXPCConnectionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */; };
 		7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; };
@@ -265,6 +266,7 @@
 		2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UIKitSoftLink.mm; path = ios/UIKitSoftLink.mm; sourceTree = "<group>"; };
 		31308B1320A21705003FB929 /* SystemPreviewSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemPreviewSPI.h; sourceTree = "<group>"; };
 		37119A7820CCB5FF002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
+		442956CC218A72DE0080DB54 /* RevealSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RevealSPI.h; sourceTree = "<group>"; };
 		570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecKeyProxySPI.h; sourceTree = "<group>"; };
 		570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSXPCConnectionSPI.h; sourceTree = "<group>"; };
 		7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; };
@@ -465,6 +467,7 @@
 				0C7785861F45130F00F4EBB6 /* QTKitSPI.h */,
 				A102658A1F56748C00B4C844 /* QuickDrawSPI.h */,
 				0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */,
+				442956CC218A72DE0080DB54 /* RevealSPI.h */,
 				A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */,
 				0C7785881F45130F00F4EBB6 /* TUCallSPI.h */,
 			);
@@ -735,6 +738,7 @@
 				A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */,
 				0C7785A01F45130F00F4EBB6 /* QuickLookMacSPI.h in Headers */,
 				0C5AF9201F43A4C7002EAC02 /* QuickLookSPI.h in Headers */,
+				442956CD218A72DF0080DB54 /* RevealSPI.h in Headers */,
 				570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */,
 				0C2DA1581F3BEB4900DBC317 /* ServersSPI.h in Headers */,
 				A3C66CDD1F462D6A009E6EE9 /* SessionID.h in Headers */,

Added: trunk/Source/WebCore/PAL/pal/spi/mac/RevealSPI.h (0 => 238014)


--- trunk/Source/WebCore/PAL/pal/spi/mac/RevealSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/RevealSPI.h	2018-11-09 01:59:10 UTC (rev 238014)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2018 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 <objc/runtime.h>
+#import <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK(Reveal)
+SOFT_LINK_PRIVATE_FRAMEWORK(RevealCore)
+SOFT_LINK_CLASS_OPTIONAL(Reveal, RVPresenter)
+SOFT_LINK_CLASS_OPTIONAL(Reveal, RVPresentingContext)
+SOFT_LINK_CLASS_OPTIONAL(RevealCore, RVItem)
+SOFT_LINK_CLASS_OPTIONAL(RevealCore, RVSelection)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <Reveal/RVPresenter.h>
+#import <Reveal/Reveal.h>
+#import <RevealCore/RVSelection.h>
+#import <RevealCore/RevealCore.h>
+
+
+#else
+
+@interface RVItem : NSObject <NSSecureCoding>
+- (instancetype)initWithText:(NSString *)text selectedRange:(NSRange)selectedRange NS_DESIGNATED_INITIALIZER;
+@end
+
+@interface RVSelection : NSObject
++ (NSRange)revealRangeAtIndex:(NSUInteger)clickIndex selectedRanges:(NSArray <NSValue *> *)selectedRanges shouldUpdateSelection:(BOOL *)shouldUpdateSelection;
+@end
+
+@interface RVPresenter : NSObject
+- (id<NSImmediateActionAnimationController>)animationControllerForItem:(RVItem *)item documentContext:(RVDocumentContext *)documentContext presentingContext:(RVPresentingContext *)presentingContext options:(NSDictionary *)options;
+- (BOOL)revealItem:(RVItem *)item documentContext:(RVDocumentContext *)documentContext presentingContext:(RVPresentingContext *)presentingContext options:(NSDictionary *)options;
+@end
+
+#endif // !USE(APPLE_INTERNAL_SDK)

Modified: trunk/Source/WebCore/SourcesCocoa.txt (238013 => 238014)


--- trunk/Source/WebCore/SourcesCocoa.txt	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2018-11-09 01:59:10 UTC (rev 238014)
@@ -96,6 +96,7 @@
 
 editing/mac/AlternativeTextUIController.mm
 editing/mac/DictionaryLookup.mm
+editing/mac/DictionaryLookupLegacy.mm
 editing/mac/EditorMac.mm
 editing/mac/FrameSelectionMac.mm
 editing/mac/TextAlternativeWithRange.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (238013 => 238014)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-11-09 01:59:10 UTC (rev 238014)
@@ -7626,6 +7626,7 @@
 		43F6FD9513BCD0B100224052 /* SVGAnimatedInteger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedInteger.cpp; sourceTree = "<group>"; };
 		4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInImageElement.h; sourceTree = "<group>"; };
 		4415292D0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInImageElement.cpp; sourceTree = "<group>"; };
+		442956CA218A6D300080DB54 /* DictionaryLookupLegacy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookupLegacy.mm; sourceTree = "<group>"; };
 		443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLookSoftLink.mm; sourceTree = "<group>"; };
 		443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookSoftLink.h; sourceTree = "<group>"; };
 		443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkStateNotifierIOS.mm; sourceTree = "<group>"; };
@@ -26117,6 +26118,7 @@
 				CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */,
 				937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */,
 				937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */,
+				442956CA218A6D300080DB54 /* DictionaryLookupLegacy.mm */,
 				ED501DC50B249F2900AE18D9 /* EditorMac.mm */,
 				4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */,
 				CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */,

Modified: trunk/Source/WebCore/editing/mac/DictionaryLookup.h (238013 => 238014)


--- trunk/Source/WebCore/editing/mac/DictionaryLookup.h	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookup.h	2018-11-09 01:59:10 UTC (rev 238014)
@@ -46,10 +46,10 @@
 
     // FIXME: Should move/unify dictionaryPopupInfoForRange here too.
 
-    WEBCORE_EXPORT static void showPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr);
+    WEBCORE_EXPORT static void showPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr, WTF::Function<void()>&& clearTextIndicator = nullptr);
     WEBCORE_EXPORT static void hidePopup();
 
-    WEBCORE_EXPORT static id <NSImmediateActionAnimationController> animationControllerForPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr);
+    WEBCORE_EXPORT static id <NSImmediateActionAnimationController> animationControllerForPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr, WTF::Function<void()>&& clearTextIndicator = nullptr);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/mac/DictionaryLookup.mm (238013 => 238014)


--- trunk/Source/WebCore/editing/mac/DictionaryLookup.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookup.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "DictionaryLookup.h"
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && ENABLE(REVEAL)
 
 #import "Document.h"
 #import "Editing.h"
@@ -45,41 +45,95 @@
 #import <PDFKit/PDFKit.h>
 #import <pal/spi/mac/LookupSPI.h>
 #import <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
+#import <pal/spi/mac/RevealSPI.h>
 #import <wtf/BlockObjCExceptions.h>
 #import <wtf/RefPtr.h>
 
-SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUTermOptionDisableSearchTermIndicator, NSString *)
+@interface WebRevealHighlight <RVPresenterHighlightDelegate> : NSObject
 
-namespace WebCore {
+- (instancetype)initWithHighlightRect:(NSRect)highlightRect useDefaultHighlight:(BOOL)useDefaultHighlight attributedString:(NSAttributedString *) attributedString;
 
-static NSRange tokenRange(const String& string, NSRange range, NSDictionary **options)
-{
-    if (!getLULookupDefinitionModuleClass())
-        return NSMakeRange(NSNotFound, 0);
+@property (nonatomic, readonly) NSRect highlightRect;
+@property (nonatomic, readonly) BOOL useDefaultHighlight;
+@property (nonatomic, readonly) NSAttributedString *attributedString;
 
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+- (void)setClearTextIndicator:(Function<void()>&&)clearTextIndicator;
 
-    return [classLULookupDefinitionModule tokenRangeForString:string range:range options:options];
+@end
 
-    END_BLOCK_OBJC_EXCEPTIONS;
+@implementation WebRevealHighlight {
+    Function<void()> _clearTextIndicator;
+}
 
-    return NSMakeRange(NSNotFound, 0);
+- (instancetype)initWithHighlightRect:(NSRect)highlightRect useDefaultHighlight:(BOOL)useDefaultHighlight attributedString:(NSAttributedString *) attributedString
+{
+    if (!(self = [super init]))
+        return nil;
+    
+    _highlightRect = highlightRect;
+    _useDefaultHighlight = useDefaultHighlight;
+    _attributedString = attributedString;
+    
+    return self;
 }
 
-static bool selectionContainsPosition(const VisiblePosition& position, const VisibleSelection& selection)
+- (void)setClearTextIndicator:(Function<void()>&&)clearTextIndicator
 {
-    if (!selection.isRange())
-        return false;
+    _clearTextIndicator = WTFMove(clearTextIndicator);
+}
 
-    RefPtr<Range> selectedRange = selection.toNormalizedRange();
-    if (!selectedRange)
-        return false;
+- (NSArray<NSValue *> *)revealContext:(RVPresentingContext *)context rectsForItem:(RVItem *)item
+{
+    UNUSED_PARAM(context);
+    UNUSED_PARAM(item);
+    return @[[NSValue valueWithRect:self.highlightRect]];
+}
 
-    return selectedRange->contains(position);
+- (void)revealContext:(RVPresentingContext *)context drawRectsForItem:(RVItem *)item
+{
+    UNUSED_PARAM(item);
+    
+    for (NSValue *rectVal in context.itemRectsInView) {
+        NSRect rect = rectVal.rectValue;
+
+        // Get current font attributes from the attributed string above, and add paragraph style attribute in order to center text.
+        RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] initWithDictionary:[self.attributedString fontAttributesInRange:NSMakeRange(0, [self.attributedString length])]]);
+        RetainPtr<NSMutableParagraphStyle> paragraph = adoptNS([[NSMutableParagraphStyle alloc] init]);
+        [paragraph setAlignment:NSTextAlignmentCenter];
+        [attributes setObject:paragraph.get() forKey:NSParagraphStyleAttributeName];
+    
+        RetainPtr<NSAttributedString> string = adoptNS([[NSAttributedString alloc] initWithString:[self.attributedString string] attributes:attributes.get()]);
+        [string drawInRect:rect];
+    }
 }
 
+- (BOOL)revealContext:(RVPresentingContext *)context shouldUseDefaultHighlightForItem:(RVItem *)item
+{
+    UNUSED_PARAM(context);
+    UNUSED_PARAM(item);
+    return self.useDefaultHighlight;
+}
+
+- (void)revealContext:(RVPresentingContext *)context stopHighlightingItem:(RVItem *)item
+{
+    UNUSED_PARAM(context);
+    UNUSED_PARAM(item);
+    auto block = WTFMove(_clearTextIndicator);
+    if (block)
+        block();
+}
+
+@end
+
+namespace WebCore {
+
 std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeForSelection(const VisibleSelection& selection)
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    if (!getRVItemClass())
+        return { nullptr, nil };
+    
     auto selectedRange = selection.toNormalizedRange();
     if (!selectedRange)
         return { nullptr, nil };
@@ -95,15 +149,26 @@
     int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
     int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get());
     NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart);
-
-    NSDictionary *options = nil;
-    tokenRange(plainText(makeRange(paragraphStart, paragraphEnd).get()), rangeToPass, &options);
-
-    return { selectedRange, options };
+    
+    RefPtr<Range> fullCharacterRange = makeRange(paragraphStart, paragraphEnd);
+    String itemString = plainText(fullCharacterRange.get());
+    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:itemString selectedRange:rangeToPass]);
+    NSRange highlightRange = item.get().highlightRange;
+    
+    return { TextIterator::subrange(*fullCharacterRange, highlightRange.location, highlightRange.length), nil };
+    
+    END_BLOCK_OBJC_EXCEPTIONS;
+    
+    return { nullptr, nil };
 }
 
 std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTestResult)
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    if (!getRVItemClass())
+        return { nullptr, nil };
+    
     auto* node = hitTestResult.innerNonSharedNode();
     if (!node || !node->renderer())
         return { nullptr, nil };
@@ -121,30 +186,56 @@
     if (position.isNull())
         position = firstPositionInOrBeforeNode(node);
 
-    // If we hit the selection, use that instead of letting Lookup decide the range.
     auto selection = frame->page()->focusController().focusedOrMainFrame().selection().selection();
-    if (selectionContainsPosition(position, selection))
-        return rangeForSelection(selection);
+    NSRange selectionRange;
+    int hitIndex;
+    RefPtr<Range> fullCharacterRange;
+    
+    if (selection.selectionType() == VisibleSelection::RangeSelection) {
+        auto selectionStart = selection.visibleStart();
+        auto selectionEnd = selection.visibleEnd();
+        
+        // As context, we are going to use the surrounding paragraphs of text.
+        auto paragraphStart = startOfParagraph(selectionStart);
+        auto paragraphEnd = endOfParagraph(selectionEnd);
+        
+        auto rangeToSelectionStart = makeRange(paragraphStart, selectionStart);
+        auto rangeToSelectionEnd = makeRange(paragraphStart, selectionEnd);
+        
+        fullCharacterRange = makeRange(paragraphStart, paragraphEnd);
+        
+        selectionRange = NSMakeRange(TextIterator::rangeLength(rangeToSelectionStart.get()), TextIterator::rangeLength(makeRange(selectionStart, selectionEnd).get()));
+        
+        hitIndex = TextIterator::rangeLength(makeRange(paragraphStart, position).get());
+    } else {
+        VisibleSelection selectionAccountingForLineRules { position };
+        selectionAccountingForLineRules.expandUsingGranularity(WordGranularity);
+        position = selectionAccountingForLineRules.start();
+        // As context, we are going to use 250 characters of text before and after the point.
+        fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250);
+        
+        if (!fullCharacterRange)
+            return { nullptr, nil };
+        
+        selectionRange = NSMakeRange(NSNotFound, 0);
+        hitIndex = TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get());
+    }
+    
+    NSRange selectedRange = [getRVSelectionClass() revealRangeAtIndex:hitIndex selectedRanges:@[[NSValue valueWithRange:selectionRange]] shouldUpdateSelection:nil];
+    
+    String itemString = plainText(fullCharacterRange.get());
+    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:itemString selectedRange:selectedRange]);
+    NSRange highlightRange = item.get().highlightRange;
 
-    VisibleSelection selectionAccountingForLineRules { position };
-    selectionAccountingForLineRules.expandUsingGranularity(WordGranularity);
-    position = selectionAccountingForLineRules.start();
-
-    // As context, we are going to use 250 characters of text before and after the point.
-    auto fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250);
-    if (!fullCharacterRange)
+    if (highlightRange.location == NSNotFound || !highlightRange.length)
         return { nullptr, nil };
-
-    NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0);
-    NSDictionary *options = nil;
-    NSRange extractedRange = tokenRange(plainText(fullCharacterRange.get()), rangeToPass, &options);
-
-    // tokenRange sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
-    // FIXME (159063): We shouldn't need to check for zero length here.
-    if (extractedRange.location == NSNotFound || extractedRange.length == 0)
-        return { nullptr, nil };
-
-    return { TextIterator::subrange(*fullCharacterRange, extractedRange.location, extractedRange.length), options };
+    
+    return { TextIterator::subrange(*fullCharacterRange, highlightRange.location, highlightRange.length), nil };
+    
+    END_BLOCK_OBJC_EXCEPTIONS;
+    
+    return { nullptr, nil };
+    
 }
 
 static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numberOfCharactersToExpand, NSInteger& charactersAddedBeforeStart, NSInteger& charactersAddedAfterEnd)
@@ -165,6 +256,9 @@
 std::tuple<NSString *, NSDictionary *> DictionaryLookup::stringForPDFSelection(PDFSelection *selection)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    if (!getRVItemClass())
+        return { nullptr, nil };
 
     // Don't do anything if there is no character at the point.
     if (!selection || !selection.string.length)
@@ -181,12 +275,11 @@
     auto fullPlainTextString = [selectionForLookup string];
     auto rangeToPass = NSMakeRange(charactersAddedBeforeStart, 0);
 
-    NSDictionary *options = nil;
-    auto extractedRange = tokenRange(fullPlainTextString, rangeToPass, &options);
-
-    // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
+    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:fullPlainTextString selectedRange:rangeToPass]);
+    NSRange extractedRange = item.get().highlightRange;
+    
     if (extractedRange.location == NSNotFound)
-        return { selection.string, options };
+        return { selection.string, nil };
 
     NSInteger lookupAddedBefore = rangeToPass.location - extractedRange.location;
     NSInteger lookupAddedAfter = (extractedRange.location + extractedRange.length) - (rangeToPass.location + originalLength);
@@ -195,7 +288,7 @@
     [selection extendSelectionAtEnd:lookupAddedAfter];
 
     ASSERT([selection.string isEqualToString:[fullPlainTextString substringWithRange:extractedRange]]);
-    return { selection.string, options };
+    return { selection.string, nil };
 
     END_BLOCK_OBJC_EXCEPTIONS;
 
@@ -202,11 +295,11 @@
     return { @"", nil };
 }
 
-static id <NSImmediateActionAnimationController> showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback)
+static id <NSImmediateActionAnimationController> showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback, WTF::Function<void()>&& clearTextIndicator)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    if (!getLULookupDefinitionModuleClass())
+    
+    if (!getRVItemClass())
         return nil;
 
     RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
@@ -214,33 +307,48 @@
         [mutableOptions addEntriesFromDictionary:options];
 
     auto textIndicator = TextIndicator::create(dictionaryPopupInfo.textIndicator);
-
-    if (canLoadLUTermOptionDisableSearchTermIndicator() && textIndicator.get().contentImage()) {
+    
+    RetainPtr<RVPresenter> presenter = adoptNS([allocRVPresenterInstance() init]);
+    
+    NSRect highlightRect;
+    NSPoint pointerLocation;
+    
+    if (textIndicator.get().contentImage()) {
         textIndicatorInstallationCallback(textIndicator.get());
-        [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
 
         FloatRect firstTextRectInViewCoordinates = textIndicator.get().textRectsInBoundingRectCoordinates()[0];
         FloatRect textBoundingRectInViewCoordinates = textIndicator.get().textBoundingRectInRootViewCoordinates();
-        if (rootViewToViewConversionCallback)
+        FloatRect selectionBoundingRectInViewCoordinates = textIndicator.get().selectionRectInRootViewCoordinates();
+        
+        if (rootViewToViewConversionCallback) {
             textBoundingRectInViewCoordinates = rootViewToViewConversionCallback(textBoundingRectInViewCoordinates);
+            selectionBoundingRectInViewCoordinates = rootViewToViewConversionCallback(selectionBoundingRectInViewCoordinates);
+        }
+        
         firstTextRectInViewCoordinates.moveBy(textBoundingRectInViewCoordinates.location());
-        if (createAnimationController)
-            return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()];
-
-        [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()];
-        return nil;
+        highlightRect = selectionBoundingRectInViewCoordinates;
+        pointerLocation = firstTextRectInViewCoordinates.location();
+        
+    } else {
+        NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+        
+        highlightRect = textIndicator->selectionRectInRootViewCoordinates();
+        pointerLocation = [view convertPoint:textBaselineOrigin toView:nil];
     }
-
-    NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
-
-    // Convert to screen coordinates.
-    textBaselineOrigin = [view convertPoint:textBaselineOrigin toView:nil];
-    textBaselineOrigin = [view.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
-
+    
+    RetainPtr<WebRevealHighlight> webHighlight =  adoptNS([[WebRevealHighlight alloc] initWithHighlightRect: highlightRect useDefaultHighlight:!textIndicator.get().contentImage() attributedString:dictionaryPopupInfo.attributedString.get()]);
+    RetainPtr<RVPresentingContext> context = adoptNS([allocRVPresentingContextInstance() initWithPointerLocationInView:pointerLocation inView:view highlightDelegate:(id<RVPresenterHighlightDelegate>) webHighlight.get()]);
+    
+    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:dictionaryPopupInfo.attributedString.get().string selectedRange:NSMakeRange(0, 0)]);
+    
+    [webHighlight setClearTextIndicator:[webHighlight = WTFMove(webHighlight), clearTextIndicator = WTFMove(clearTextIndicator)] {
+        if (clearTextIndicator)
+            clearTextIndicator();
+    }];
+    
     if (createAnimationController)
-        return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
-
-    [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+        return [presenter animationControllerForItem:item.get() documentContext:nil presentingContext:context.get() options:nil];
+    [presenter revealItem:item.get() documentContext:nil presentingContext:context.get() options:nil];
     return nil;
 
     END_BLOCK_OBJC_EXCEPTIONS;
@@ -247,9 +355,9 @@
     return nil;
 }
 
-void DictionaryLookup::showPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback)
+void DictionaryLookup::showPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback, WTF::Function<void()>&& clearTextIndicator)
 {
-    showPopupOrCreateAnimationController(false, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback);
+    showPopupOrCreateAnimationController(false, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback, WTFMove(clearTextIndicator));
 }
 
 void DictionaryLookup::hidePopup()
@@ -263,9 +371,9 @@
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-id <NSImmediateActionAnimationController> DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback)
+id <NSImmediateActionAnimationController> DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback, WTF::Function<void()>&& clearTextIndicator)
 {
-    return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback);
+    return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback, WTFMove(clearTextIndicator));
 }
 
 } // namespace WebCore

Copied: trunk/Source/WebCore/editing/mac/DictionaryLookupLegacy.mm (from rev 238013, trunk/Source/WebCore/editing/mac/DictionaryLookup.mm) (0 => 238014)


--- trunk/Source/WebCore/editing/mac/DictionaryLookupLegacy.mm	                        (rev 0)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookupLegacy.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -0,0 +1,277 @@
+/*
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "DictionaryLookup.h"
+
+#if PLATFORM(MAC) && !ENABLE(REVEAL)
+
+#import "Document.h"
+#import "Editing.h"
+#import "FocusController.h"
+#import "Frame.h"
+#import "FrameSelection.h"
+#import "HTMLConverter.h"
+#import "HitTestResult.h"
+#import "Page.h"
+#import "Range.h"
+#import "RenderObject.h"
+#import "TextIterator.h"
+#import "VisiblePosition.h"
+#import "VisibleSelection.h"
+#import "VisibleUnits.h"
+#import <PDFKit/PDFKit.h>
+#import <pal/spi/mac/LookupSPI.h>
+#import <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
+#import <wtf/BlockObjCExceptions.h>
+#import <wtf/RefPtr.h>
+
+SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUTermOptionDisableSearchTermIndicator, NSString *)
+
+namespace WebCore {
+
+static NSRange tokenRange(const String& string, NSRange range, NSDictionary **options)
+{
+    if (!getLULookupDefinitionModuleClass())
+        return NSMakeRange(NSNotFound, 0);
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    return [classLULookupDefinitionModule tokenRangeForString:string range:range options:options];
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    return NSMakeRange(NSNotFound, 0);
+}
+
+static bool selectionContainsPosition(const VisiblePosition& position, const VisibleSelection& selection)
+{
+    if (!selection.isRange())
+        return false;
+
+    RefPtr<Range> selectedRange = selection.toNormalizedRange();
+    if (!selectedRange)
+        return false;
+
+    return selectedRange->contains(position);
+}
+
+std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeForSelection(const VisibleSelection& selection)
+{
+    auto selectedRange = selection.toNormalizedRange();
+    if (!selectedRange)
+        return { nullptr, nil };
+
+    // Since we already have the range we want, we just need to grab the returned options.
+    auto selectionStart = selection.visibleStart();
+    auto selectionEnd = selection.visibleEnd();
+
+    // As context, we are going to use the surrounding paragraphs of text.
+    auto paragraphStart = startOfParagraph(selectionStart);
+    auto paragraphEnd = endOfParagraph(selectionEnd);
+
+    int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
+    int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get());
+    NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart);
+
+    NSDictionary *options = nil;
+    tokenRange(plainText(makeRange(paragraphStart, paragraphEnd).get()), rangeToPass, &options);
+
+    return { selectedRange, options };
+}
+
+std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTestResult)
+{
+    auto* node = hitTestResult.innerNonSharedNode();
+    if (!node || !node->renderer())
+        return { nullptr, nil };
+
+    auto* frame = node->document().frame();
+    if (!frame)
+        return { nullptr, nil };
+
+    // Don't do anything if there is no character at the point.
+    auto framePoint = hitTestResult.roundedPointInInnerNodeFrame();
+    if (!frame->rangeForPoint(framePoint))
+        return { nullptr, nil };
+
+    auto position = frame->visiblePositionForPoint(framePoint);
+    if (position.isNull())
+        position = firstPositionInOrBeforeNode(node);
+
+    // If we hit the selection, use that instead of letting Lookup decide the range.
+    auto selection = frame->page()->focusController().focusedOrMainFrame().selection().selection();
+    if (selectionContainsPosition(position, selection))
+        return rangeForSelection(selection);
+
+    VisibleSelection selectionAccountingForLineRules { position };
+    selectionAccountingForLineRules.expandUsingGranularity(WordGranularity);
+    position = selectionAccountingForLineRules.start();
+
+    // As context, we are going to use 250 characters of text before and after the point.
+    auto fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250);
+    if (!fullCharacterRange)
+        return { nullptr, nil };
+
+    NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0);
+    NSDictionary *options = nil;
+    NSRange extractedRange = tokenRange(plainText(fullCharacterRange.get()), rangeToPass, &options);
+
+    // tokenRange sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
+    // FIXME (159063): We shouldn't need to check for zero length here.
+    if (extractedRange.location == NSNotFound || !extractedRange.length)
+        return { nullptr, nil };
+
+    return { TextIterator::subrange(*fullCharacterRange, extractedRange.location, extractedRange.length), options };
+}
+
+static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numberOfCharactersToExpand, NSInteger& charactersAddedBeforeStart, NSInteger& charactersAddedAfterEnd)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    size_t originalLength = selection.string.length;
+    [selection extendSelectionAtStart:numberOfCharactersToExpand];
+    
+    charactersAddedBeforeStart = selection.string.length - originalLength;
+    
+    [selection extendSelectionAtEnd:numberOfCharactersToExpand];
+    charactersAddedAfterEnd = selection.string.length - originalLength - charactersAddedBeforeStart;
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+std::tuple<NSString *, NSDictionary *> DictionaryLookup::stringForPDFSelection(PDFSelection *selection)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    // Don't do anything if there is no character at the point.
+    if (!selection || !selection.string.length)
+        return { @"", nil };
+
+    RetainPtr<PDFSelection> selectionForLookup = adoptNS([selection copy]);
+
+    // As context, we are going to use 250 characters of text before and after the point.
+    auto originalLength = [selectionForLookup string].length;
+    NSInteger charactersAddedBeforeStart = 0;
+    NSInteger charactersAddedAfterEnd = 0;
+    expandSelectionByCharacters(selectionForLookup.get(), 250, charactersAddedBeforeStart, charactersAddedAfterEnd);
+
+    auto fullPlainTextString = [selectionForLookup string];
+    auto rangeToPass = NSMakeRange(charactersAddedBeforeStart, 0);
+
+    NSDictionary *options = nil;
+    auto extractedRange = tokenRange(fullPlainTextString, rangeToPass, &options);
+
+    // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
+    if (extractedRange.location == NSNotFound)
+        return { selection.string, options };
+
+    NSInteger lookupAddedBefore = rangeToPass.location - extractedRange.location;
+    NSInteger lookupAddedAfter = (extractedRange.location + extractedRange.length) - (rangeToPass.location + originalLength);
+
+    [selection extendSelectionAtStart:lookupAddedBefore];
+    [selection extendSelectionAtEnd:lookupAddedAfter];
+
+    ASSERT([selection.string isEqualToString:[fullPlainTextString substringWithRange:extractedRange]]);
+    return { selection.string, options };
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    return { @"", nil };
+}
+
+static id <NSImmediateActionAnimationController> showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!getLULookupDefinitionModuleClass())
+        return nil;
+
+    RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
+    if (NSDictionary *options = dictionaryPopupInfo.options.get())
+        [mutableOptions addEntriesFromDictionary:options];
+
+    auto textIndicator = TextIndicator::create(dictionaryPopupInfo.textIndicator);
+
+    if (canLoadLUTermOptionDisableSearchTermIndicator() && textIndicator.get().contentImage()) {
+        textIndicatorInstallationCallback(textIndicator.get());
+        [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
+
+        FloatRect firstTextRectInViewCoordinates = textIndicator.get().textRectsInBoundingRectCoordinates()[0];
+        FloatRect textBoundingRectInViewCoordinates = textIndicator.get().textBoundingRectInRootViewCoordinates();
+        if (rootViewToViewConversionCallback)
+            textBoundingRectInViewCoordinates = rootViewToViewConversionCallback(textBoundingRectInViewCoordinates);
+        firstTextRectInViewCoordinates.moveBy(textBoundingRectInViewCoordinates.location());
+        if (createAnimationController)
+            return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()];
+
+        [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()];
+        return nil;
+    }
+
+    NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+
+    // Convert to screen coordinates.
+    textBaselineOrigin = [view convertPoint:textBaselineOrigin toView:nil];
+    textBaselineOrigin = [view.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
+
+    if (createAnimationController)
+        return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+
+    [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+    return nil;
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return nil;
+}
+
+void DictionaryLookup::showPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback, WTF::Function<void()>&& clearTextIndicator)
+{
+    UNUSED_PARAM(clearTextIndicator);
+    
+    showPopupOrCreateAnimationController(false, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback);
+}
+
+void DictionaryLookup::hidePopup()
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!getLULookupDefinitionModuleClass())
+        return;
+    [getLULookupDefinitionModuleClass() hideDefinition];
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+id <NSImmediateActionAnimationController> DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback, WTF::Function<void()>&& clearTextIndicator)
+{
+    UNUSED_PARAM(clearTextIndicator);
+    
+    return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(MAC) && !ENABLE(REVEAL)

Modified: trunk/Source/WebKit/ChangeLog (238013 => 238014)


--- trunk/Source/WebKit/ChangeLog	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKit/ChangeLog	2018-11-09 01:59:10 UTC (rev 238014)
@@ -1,3 +1,29 @@
+2018-11-08  Megan Gardner  <[email protected]>
+
+        Adopt Reveal Framework to replace Lookup
+        https://bugs.webkit.org/show_bug.cgi?id=191097
+        <rdar://problem/45924508>
+
+        Reviewed by Tim Horton.
+
+        Pass in what it needed to clear the textIndicators. This is better than
+        the current notification structure.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (-[WKWindowVisibilityObserver dealloc]):
+        (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::didPerformDictionaryLookup):
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _animationControllerForText]):
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::showDefinitionForAttributedString):
+
+        Generate and pass in the text indicator information, as this is needed now.
+
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin):
+
 2018-11-08  Keith Rollin  <[email protected]>
 
         Create .xcfilelist files

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (238013 => 238014)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -131,7 +131,9 @@
 static NSString * const WKMediaExitFullScreenItem = @"WKMediaExitFullScreenItem";
 #endif // HAVE(TOUCH_BAR) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 
+#if PLATFORM(MAC) && !ENABLE(REVEAL)
 SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
+#endif // ENABLE(REVEAL)
 
 WTF_DECLARE_CF_TYPE_TRAIT(CGImage);
 
@@ -226,8 +228,10 @@
 
 - (void)dealloc
 {
+#if !ENABLE(REVEAL)
     if (_didRegisterForLookupPopoverCloseNotifications && canLoadLUNotificationPopoverWillClose())
         [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
+#endif // !ENABLE(REVEAL)
 
     NSNotificationCenter *workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
     [workspaceNotificationCenter removeObserver:self name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
@@ -301,9 +305,10 @@
         return;
 
     _didRegisterForLookupPopoverCloseNotifications = YES;
-
+#if !ENABLE(REVEAL)
     if (canLoadLUNotificationPopoverWillClose())
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+#endif
 }
 
 - (void)_windowDidOrderOnScreen:(NSNotification *)notification
@@ -382,10 +387,12 @@
         _impl->updateContentInsetsIfAutomatic();
 }
 
+#if !ENABLE(REVEAL)
 - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
 {
     _impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
 }
+#endif
 
 - (void)_activeSpaceDidChange:(NSNotification *)notification
 {

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (238013 => 238014)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -598,6 +598,8 @@
 
     DictionaryLookup::showPopup(dictionaryPopupInfo, m_view, [this](TextIndicator& textIndicator) {
         m_impl->setTextIndicator(textIndicator, TextIndicatorWindowLifetime::Permanent);
+    }, nullptr, [this]() {
+        m_impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
     });
 }
 

Modified: trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm (238013 => 238014)


--- trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -472,6 +472,8 @@
 
     return WebCore::DictionaryLookup::animationControllerForPopup(dictionaryPopupInfo, _view, [self](WebCore::TextIndicator& textIndicator) {
         _viewImpl->setTextIndicator(textIndicator, WebCore::TextIndicatorWindowLifetime::Permanent);
+    }, nullptr, [self]() {
+        _viewImpl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
     });
 }
 

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (238013 => 238014)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -1872,7 +1872,24 @@
     DictionaryPopupInfo dictionaryPopupInfo;
     dictionaryPopupInfo.origin = convertFromPDFViewToRootView(IntPoint(point));
     dictionaryPopupInfo.attributedString = string;
+    
+    
+    NSRect rangeRect;
+    rangeRect.origin = point;
+    CGFloat scaleFactor = PDFPlugin::scaleFactor();
 
+    rangeRect.size.height = string.size.height * scaleFactor;
+    rangeRect.size.width = string.size.width * scaleFactor;
+
+    rangeRect.origin.y -= rangeRect.size.height;
+
+    TextIndicatorData dataForSelection;
+    dataForSelection.selectionRectInRootViewCoordinates = rangeRect;
+    dataForSelection.textBoundingRectInRootViewCoordinates = rangeRect;
+    dataForSelection.contentImageScaleFactor = scaleFactor;
+    dataForSelection.presentationTransition = TextIndicatorPresentationTransition::FadeIn;
+    dictionaryPopupInfo.textIndicator = dataForSelection;
+    
     webFrame()->page()->send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfo));
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (238013 => 238014)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -520,13 +520,8 @@
         [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
     }];
 
-    // Based on TextIndicator implementation:
-    // TODO(144307): Come up with a better way to share this information than duplicating these values.
-    CGFloat verticalMargin = 2.5;
-    CGFloat horizontalMargin = 0.5;
-
-    rangeRect.origin.y -= CGCeiling(rangeRect.size.height - maxAscender - std::abs(maxDescender) + verticalMargin * scaleFactor);
-    rangeRect.origin.x += CGFloor(horizontalMargin * scaleFactor);
+    rangeRect.size.height = nsAttributedString.size.height * scaleFactor;
+    rangeRect.size.width = nsAttributedString.size.width * scaleFactor;
     
     TextIndicatorData dataForSelection;
     dataForSelection.selectionRectInRootViewCoordinates = rangeRect;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (238013 => 238014)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-11-09 01:59:10 UTC (rev 238014)
@@ -1,3 +1,18 @@
+2018-11-08  Megan Gardner  <[email protected]>
+
+        Adopt Reveal Framework to replace Lookup
+        https://bugs.webkit.org/show_bug.cgi?id=191097
+        <rdar://problem/45924508>
+
+        Reviewed by Tim Horton.
+
+        Pass in what it needed to clear the textIndicators. This is better than
+        the current notification structure.
+
+        * WebView/WebView.mm:
+        (-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
+        (-[WebView _prepareForDictionaryLookup]):
+
 2018-11-06  Justin Fan  <[email protected]>
 
         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (238013 => 238014)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-11-09 01:51:52 UTC (rev 238013)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-11-09 01:59:10 UTC (rev 238014)
@@ -358,7 +358,7 @@
 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
 #endif // HAVE(TOUCH_BAR) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !ENABLE(REVEAL)
 SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
 #endif
 
@@ -9531,6 +9531,8 @@
         [self _setTextIndicator:textIndicator withLifetime:TextIndicatorWindowLifetime::Permanent];
     }, [self](FloatRect rectInRootViewCoordinates) {
         return [self _convertRectFromRootView:rectInRootViewCoordinates];
+    }, [self]() {
+        [self _clearTextIndicatorWithAnimation:TextIndicatorWindowDismissalAnimation::FadeOut];
     });
 }
 
@@ -9578,9 +9580,12 @@
         return;
 
     _private->hasInitializedLookupObserver = YES;
-
+    
+#if !ENABLE(REVEAL)
     if (canLoadLUNotificationPopoverWillClose())
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+#endif // !ENABLE(REVEAL)
+    
 }
 
 - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&)dictionaryPopupInfo
@@ -9597,10 +9602,12 @@
     });
 }
 
+#if !ENABLE(REVEAL)
 - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
 {
     [self _clearTextIndicatorWithAnimation:TextIndicatorWindowDismissalAnimation::FadeOut];
 }
+#endif // ENABLE(REVEAL)
 
 #endif // PLATFORM(MAC)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to