Unreviewed, rolling out r238678.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2018 20:09:08 +0000 (20:09 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2018 20:09:08 +0000 (20:09 +0000)
Breaks internal builds.

Reverted changeset:

"Move Lookup Code for better cross platform usage"
https://bugs.webkit.org/show_bug.cgi?id=191732
https://trac.webkit.org/changeset/238678

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238682 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/spi/mac/LookupSPI.h
Source/WebCore/PAL/pal/spi/mac/RevealSPI.h [moved from Source/WebCore/PAL/pal/spi/cocoa/RevealSPI.h with 76% similarity]
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
Source/WebCore/editing/mac/DictionaryLookup.h
Source/WebCore/editing/mac/DictionaryLookup.mm [moved from Source/WebCore/editing/cocoa/DictionaryLookup.mm with 90% similarity]
Source/WebKit/ChangeLog
Source/WebKit/Platform/spi/ios/UIKitSPI.h
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm

index 667f578..b26293c 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-29  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r238678.
+
+        Breaks internal builds.
+
+        Reverted changeset:
+
+        "Move Lookup Code for better cross platform usage"
+        https://bugs.webkit.org/show_bug.cgi?id=191732
+        https://trac.webkit.org/changeset/238678
+
 2018-11-29  Youenn Fablet  <youenn@apple.com>
 
         A sender created through addTransceiver and populated using addTrack should have its source set
index 0109d03..882a6d0 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-29  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r238678.
+
+        Breaks internal builds.
+
+        Reverted changeset:
+
+        "Move Lookup Code for better cross platform usage"
+        https://bugs.webkit.org/show_bug.cgi?id=191732
+        https://trac.webkit.org/changeset/238678
+
 2018-11-29  Megan Gardner  <megan_gardner@apple.com>
 
         Move Lookup Code for better cross platform usage
index b8cc358..77f2467 100644 (file)
                                0C2DA1391F3BEB4900DBC317 /* PassKitSPI.h */,
                                0C2DA13A1F3BEB4900DBC317 /* pthreadSPI.h */,
                                0C2DA13B1F3BEB4900DBC317 /* QuartzCoreSPI.h */,
-                               442956CC218A72DE0080DB54 /* RevealSPI.h */,
                                570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */,
                                0C2DA13C1F3BEB4900DBC317 /* ServersSPI.h */,
                                0C2DA12B1F3BEB4900DBC317 /* URLFormattingSPI.h */,
                                0C7785861F45130F00F4EBB6 /* QTKitSPI.h */,
                                A102658A1F56748C00B4C844 /* QuickDrawSPI.h */,
                                0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */,
+                               442956CC218A72DE0080DB54 /* RevealSPI.h */,
                                A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */,
                                0C7785881F45130F00F4EBB6 /* TUCallSPI.h */,
                        );
index e0a3375..eb7f951 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-
-#if PLATFORM(MAC)
-
 #import <objc/runtime.h>
 #import <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
 #import <wtf/SoftLinking.h>
 
+#if PLATFORM(MAC)
+
 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(Lookup)
 SOFT_LINK_CLASS_OPTIONAL(Lookup, LULookupDefinitionModule)
 
similarity index 76%
rename from Source/WebCore/PAL/pal/spi/cocoa/RevealSPI.h
rename to Source/WebCore/PAL/pal/spi/mac/RevealSPI.h
index ba35de0..d6b8da4 100644 (file)
@@ -24,9 +24,7 @@
  */
 
 #import <objc/runtime.h>
-#if PLATFORM(MAC)
 #import <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
-#endif // PLATFORM(MAC)
 #import <wtf/SoftLinking.h>
 
 SOFT_LINK_PRIVATE_FRAMEWORK(Reveal)
@@ -38,17 +36,13 @@ SOFT_LINK_CLASS_OPTIONAL(RevealCore, RVSelection)
 
 #if USE(APPLE_INTERNAL_SDK)
 
-#if PLATFORM(MAC)
 #import <Reveal/RVPresenter.h>
 #import <Reveal/Reveal.h>
-#endif // PLATFORM(MAC)
 #import <RevealCore/RVSelection.h>
 #import <RevealCore/RevealCore.h>
 
-#else // USE(APPLE_INTERNAL_SDK)
 
-
-@protocol RVPresenterHighlightDelegate;
+#else
 
 @interface RVItem : NSObject <NSSecureCoding>
 - (instancetype)initWithText:(NSString *)text selectedRange:(NSRange)selectedRange NS_DESIGNATED_INITIALIZER;
@@ -58,27 +52,8 @@ SOFT_LINK_CLASS_OPTIONAL(RevealCore, RVSelection)
 + (NSRange)revealRangeAtIndex:(NSUInteger)clickIndex selectedRanges:(NSArray <NSValue *> *)selectedRanges shouldUpdateSelection:(BOOL *)shouldUpdateSelection;
 @end
 
-#if PLATFORM(MAC)
-@interface RVPresentingContext : NSObject
-- (instancetype)initWithPointerLocationInView:(NSPoint)pointerLocationInView inView:(NSView *)view highlightDelegate:(id<RVPresenterHighlightDelegate>)highlightDelegate;
-@end
-#endif
-
-@protocol RVPresenterHighlightDelegate <NSObject>
-@required
-- (NSArray <NSValue *> *)revealContext:(RVPresentingContext *)context rectsForItem:(RVItem *)item;
-@optional
-- (void)revealContext:(RVPresentingContext *)context stopHighlightingItem:(RVItem *)item;
-- (void)revealContext:(RVPresentingContext *)context drawRectsForItem:(RVItem *)item;
-@end
-
-@interface RVDocumentContext : NSObject < NSSecureCoding >
-@end
-
 @interface RVPresenter : NSObject
-#if PLATFORM(MAC)
 - (id<NSImmediateActionAnimationController>)animationControllerForItem:(RVItem *)item documentContext:(RVDocumentContext *)documentContext presentingContext:(RVPresentingContext *)presentingContext options:(NSDictionary *)options;
-#endif // PLATFORM(MAC)
 - (BOOL)revealItem:(RVItem *)item documentContext:(RVDocumentContext *)documentContext presentingContext:(RVPresentingContext *)presentingContext options:(NSDictionary *)options;
 @end
 
index 062cdd7..063dfdc 100644 (file)
@@ -77,7 +77,6 @@ editing/SelectionRectGatherer.cpp
 editing/SmartReplaceCF.cpp
 
 editing/cocoa/DataDetection.mm
-editing/cocoa/DictionaryLookup.mm
 editing/cocoa/EditorCocoa.mm
 editing/cocoa/FontAttributeChangesCocoa.mm
 editing/cocoa/FontAttributesCocoa.mm
@@ -91,6 +90,7 @@ editing/ios/DictationCommandIOS.cpp
 editing/ios/EditorIOS.mm
 
 editing/mac/AlternativeTextUIController.mm
+editing/mac/DictionaryLookup.mm
 editing/mac/DictionaryLookupLegacy.mm
 editing/mac/EditorMac.mm
 editing/mac/FrameSelectionMac.mm
index d18ce60..d16d326 100644 (file)
                        children = (
                                C5227DEF1C3C6DD700F5ED54 /* DataDetection.h */,
                                C5227DF01C3C6DD700F5ED54 /* DataDetection.mm */,
-                               937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */,
                                9B55EEE81B3E8898005342BC /* EditorCocoa.mm */,
                                F42CEB54214031EE002DCA72 /* FontAttributeChangesCocoa.mm */,
                                F48D2A752156FE5700C6752B /* FontAttributesCocoa.mm */,
                                CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */,
                                CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */,
                                937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */,
+                               937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */,
                                442956CA218A6D300080DB54 /* DictionaryLookupLegacy.mm */,
                                ED501DC50B249F2900AE18D9 /* EditorMac.mm */,
                                4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */,
index abfad8e..5139bb6 100644 (file)
@@ -34,8 +34,6 @@
 #import "Document.h"
 #import "DocumentFragment.h"
 #import "DocumentLoader.h"
-#import "Editor.h"
-#import "EditorClient.h"
 #import "File.h"
 #import "FileSystem.h"
 #import "Frame.h"
index f8f761c..cb6d53e 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#pragma once
-
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
 
 #include "DictionaryPopupInfo.h"
-#if PLATFORM(MAC)
-#import <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
-#endif // PLATFORM(MAC)
+#include <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h>
 #include <wtf/Function.h>
 
 OBJC_CLASS NSView;
 OBJC_CLASS PDFSelection;
 
-#if PLATFORM(MAC)
-typedef id <NSImmediateActionAnimationController> WKRevealController;
-#else
-typedef id WKRevealController;
-#endif // PLATFORM(MAC)
-
 namespace WebCore {
 
 class HitTestResult;
@@ -58,11 +48,8 @@ public:
 
     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();
-    
-#if PLATFORM(MAC)
-    WEBCORE_EXPORT static WKRevealController animationControllerForPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr, WTF::Function<void()>&& clearTextIndicator = nullptr);
-#endif // PLATFORM(MAC)
-    
+
+    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
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "DictionaryLookup.h"
 
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC) && ENABLE(REVEAL)
 
 #import "Document.h"
 #import "Editing.h"
@@ -35,7 +35,6 @@
 #import "FrameSelection.h"
 #import "HTMLConverter.h"
 #import "HitTestResult.h"
-#import "NotImplemented.h"
 #import "Page.h"
 #import "Range.h"
 #import "RenderObject.h"
 #import "VisibleSelection.h"
 #import "VisibleUnits.h"
 #import <PDFKit/PDFKit.h>
-#import <pal/spi/cocoa/RevealSPI.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>
 
-#if ENABLE(REVEAL)
-
-#if PLATFORM(MAC)
-
 @interface WebRevealHighlight <RVPresenterHighlightDelegate> : NSObject {
 @private
     Function<void()> _clearTextIndicator;
 
 @end
 
-#endif // PLATFORM(MAC)
-
-#endif // ENABLE(REVEAL)
-
 namespace WebCore {
 
-#if ENABLE(REVEAL)
-
 std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeForSelection(const VisibleSelection& selection)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -312,13 +302,11 @@ std::tuple<NSString *, NSDictionary *> DictionaryLookup::stringForPDFSelection(P
     return { @"", nil };
 }
 
-static WKRevealController showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback, WTF::Function<void()>&& clearTextIndicator)
+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 PLATFORM(MAC)
-    
-    if (!getRVItemClass() || !getRVPresenterClass())
+    if (!getRVItemClass())
         return nil;
 
     RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
@@ -369,21 +357,9 @@ static WKRevealController showPopupOrCreateAnimationController(bool createAnimat
         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;
-    
-#else // PLATFORM(MAC)
-    
-    UNUSED_PARAM(createAnimationController);
-    UNUSED_PARAM(dictionaryPopupInfo);
-    UNUSED_PARAM(view);
-    UNUSED_PARAM(textIndicatorInstallationCallback);
-    UNUSED_PARAM(rootViewToViewConversionCallback);
-    UNUSED_PARAM(clearTextIndicator);
-    
-    return nil;
-#endif // PLATFORM(MAC)
-    
+
     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)
@@ -393,32 +369,20 @@ void DictionaryLookup::showPopup(const DictionaryPopupInfo& dictionaryPopupInfo,
 
 void DictionaryLookup::hidePopup()
 {
-    notImplemented();
-}
-
-#if PLATFORM(MAC)
-
-WKRevealController 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, WTFMove(clearTextIndicator));
-}
-
-#endif // PLATFORM(MAC)
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-#elif PLATFORM(IOS_FAMILY) // ENABLE(REVEAL)
+    if (!getLULookupDefinitionModuleClass())
+        return;
+    [getLULookupDefinitionModuleClass() hideDefinition];
 
-std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeForSelection(const VisibleSelection&)
-{
-    return { nullptr, nil };
+    END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeAtHitTestResult(const HitTestResult&)
+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 { nullptr, nil };
+    return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback, WTFMove(clearTextIndicator));
 }
 
-#endif // ENABLE(REVEAL)
-
 } // namespace WebCore
 
-#endif // PLATFORM(COCOA)
+#endif // PLATFORM(MAC)
index 88b3b9d..6c6b134 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-29  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r238678.
+
+        Breaks internal builds.
+
+        Reverted changeset:
+
+        "Move Lookup Code for better cross platform usage"
+        https://bugs.webkit.org/show_bug.cgi?id=191732
+        https://trac.webkit.org/changeset/238678
+
 2018-11-29  Suresh Koppisetty  <skoppisetty@apple.com>
 
         Addressed a FIXME by removing an unnecessary call to [NSApplication sharedApplication].
index 2323796..143f16c 100644 (file)
@@ -733,9 +733,6 @@ struct _UIWebTouchEvent {
     bool isPotentialTap;
 };
 
-@interface _UILookupGestureRecognizer : UIGestureRecognizer
-@end
-
 @class UIWebTouchEventsGestureRecognizer;
 
 @protocol UIWebTouchEventsGestureRecognizerDelegate <NSObject>
index 65aecd9..f56875d 100644 (file)
@@ -33,7 +33,6 @@
 #import "PageClient.h"
 #import "SafeBrowsingSPI.h"
 #import "SafeBrowsingWarning.h"
-#import "WebPageMessages.h"
 #import "WebProcessProxy.h"
 #import <WebCore/DragItem.h>
 #import <WebCore/NotImplemented.h>
@@ -190,21 +189,5 @@ void WebPageProxy::platformCloneAttachment(Ref<API::Attachment>&& fromAttachment
 }
 
 #endif // ENABLE(ATTACHMENT_ELEMENT)
-    
-void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
-{
-    if (!isValid())
-        return;
-    
-    process().send(Messages::WebPage::PerformDictionaryLookupAtLocation(point), m_pageID);
-}
 
-void WebPageProxy::performDictionaryLookupOfCurrentSelection()
-{
-    if (!isValid())
-        return;
-    
-    process().send(Messages::WebPage::PerformDictionaryLookupOfCurrentSelection(), m_pageID);
 }
-
-} // namespace WebKit
index da26332..a807ccd 100644 (file)
@@ -87,7 +87,6 @@ class WebOpenPanelResultListenerProxy;
 class WebPageProxy;
 }
 
-@class _UILookupGestureRecognizer;
 @class _UIHighlightView;
 @class _UIWebHighlightLongPressGestureRecognizer;
 @class UIHoverGestureRecognizer;
@@ -216,7 +215,6 @@ struct WKAutoCorrectionData {
 
 #if PLATFORM(IOSMAC)
     RetainPtr<UIHoverGestureRecognizer> _hoverGestureRecognizer;
-    RetainPtr<_UILookupGestureRecognizer> _lookupGestureRecognizer;
 #endif
 
     RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant;
index abb04a4..60cfb8f 100644 (file)
 #if PLATFORM(IOSMAC)
 #import "NativeWebMouseEvent.h"
 #import <UIKit/UIHoverGestureRecognizer.h>
-#import <UIKit/_UILookupGestureRecognizer.h>
 #import <pal/spi/ios/GraphicsServicesSPI.h>
 #endif
 
@@ -650,11 +649,6 @@ static inline bool hasAssistedNode(WebKit::AssistedNodeInformation assistedNodeI
     _hoverGestureRecognizer = adoptNS([[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(_hoverGestureRecognizerChanged:)]);
     [_hoverGestureRecognizer setDelegate:self];
     [self addGestureRecognizer:_hoverGestureRecognizer.get()];
-    
-    _lookupGestureRecognizer = adoptNS([[_UILookupGestureRecognizer alloc] initWithTarget:self action:@selector(_lookupGestureRecognized:)]);
-    [_lookupGestureRecognizer setDelegate:self];
-    [self addGestureRecognizer:_lookupGestureRecognizer.get()];
-    
 #endif
 
     _singleTapGestureRecognizer = adoptNS([[WKSyntheticClickTapGestureRecognizer alloc] initWithTarget:self action:@selector(_singleTapCommited:)]);
@@ -765,9 +759,6 @@ static inline bool hasAssistedNode(WebKit::AssistedNodeInformation assistedNodeI
 #if PLATFORM(IOSMAC)
     [_hoverGestureRecognizer setDelegate:nil];
     [self removeGestureRecognizer:_hoverGestureRecognizer.get()];
-    
-    [_lookupGestureRecognizer setDelegate:nil];
-    [self removeGestureRecognizer:_lookupGestureRecognizer.get()];
 #endif
 
     [_singleTapGestureRecognizer setDelegate:nil];
@@ -855,7 +846,6 @@ static inline bool hasAssistedNode(WebKit::AssistedNodeInformation assistedNodeI
     [self removeGestureRecognizer:_stylusSingleTapGestureRecognizer.get()];
 #if PLATFORM(IOSMAC)
     [self removeGestureRecognizer:_hoverGestureRecognizer.get()];
-    [self removeGestureRecognizer:_lookupGestureRecognizer.get()];
 #endif
 }
 
@@ -871,7 +861,6 @@ static inline bool hasAssistedNode(WebKit::AssistedNodeInformation assistedNodeI
     [self addGestureRecognizer:_stylusSingleTapGestureRecognizer.get()];
 #if PLATFORM(IOSMAC)
     [self addGestureRecognizer:_hoverGestureRecognizer.get()];
-    [self addGestureRecognizer:_lookupGestureRecognizer.get()];
 #endif
 }
 
@@ -1478,10 +1467,6 @@ static inline bool isSamePair(UIGestureRecognizer *a, UIGestureRecognizer *b, UI
 
     if ([gestureRecognizer isKindOfClass:[UIHoverGestureRecognizer class]] || [otherGestureRecognizer isKindOfClass:[UIHoverGestureRecognizer class]])
         return YES;
-    
-    if (([gestureRecognizer isKindOfClass:[_UILookupGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) || ([otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]] && [gestureRecognizer isKindOfClass:[_UILookupGestureRecognizer class]]))
-        return YES;
-
 #endif
     if (isSamePair(gestureRecognizer, otherGestureRecognizer, _highlightLongPressGestureRecognizer.get(), _textSelectionAssistant.get().forcePressGesture))
         return YES;
@@ -6072,12 +6057,6 @@ static NSArray<NSItemProvider *> *extractItemProvidersFromDropSession(id <UIDrop
 #endif // PLATFORM(WATCHOS)
 
 #if PLATFORM(IOSMAC)
-- (void)_lookupGestureRecognized:(UIGestureRecognizer *)gestureRecognizer
-{
-    NSPoint locationInViewCoordinates = [gestureRecognizer locationInView:self];
-    _page->performDictionaryLookupAtLocation(WebCore::FloatPoint(locationInViewCoordinates));
-}
-
 - (void)_hoverGestureRecognizerChanged:(UIGestureRecognizer *)gestureRecognizer
 {
     if (!_page->isValid())
index 2795f73..b473f08 100644 (file)
@@ -121,6 +121,11 @@ bool WebPageProxy::readSelectionFromPasteboard(const String&)
     return false;
 }
 
+void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint&)
+{
+    notImplemented();
+}
+
 void WebPageProxy::gestureCallback(const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<GestureCallback>(callbackID);
index e2ab29c..fffc5e0 100644 (file)
@@ -323,6 +323,22 @@ void WebPageProxy::setPromisedDataForImage(const String& pasteboardName, const S
 
 #endif
 
+void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
+{
+    if (!isValid())
+        return;
+
+    process().send(Messages::WebPage::PerformDictionaryLookupAtLocation(point), m_pageID);
+}
+
+void WebPageProxy::performDictionaryLookupOfCurrentSelection()
+{
+    if (!isValid())
+        return;
+
+    process().send(Messages::WebPage::PerformDictionaryLookupOfCurrentSelection(), m_pageID);
+}
+
 // Complex text input support for plug-ins.
 void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput)
 {
index a38cd2b..3e79431 100644 (file)
 #import "config.h"
 #import "WebPage.h"
 
-
 #import "LoadParameters.h"
-#import "PluginView.h"
 #import "WebPageProxyMessages.h"
-#import <WebCore/DictionaryLookup.h>
-#import <WebCore/Editor.h>
-#import <WebCore/EventHandler.h>
-#import <WebCore/FocusController.h>
-#import <WebCore/HTMLConverter.h>
-#import <WebCore/HitTestResult.h>
-#import <WebCore/NodeRenderStyle.h>
 #import <WebCore/PlatformMediaSessionManager.h>
-#import <WebCore/RenderElement.h>
-#import <WebCore/RenderObject.h>
 
 #if PLATFORM(COCOA)
 
@@ -70,114 +59,6 @@ void WebPage::requestActiveNowPlayingSessionInfo(CallbackID callbackID)
 
     send(Messages::WebPageProxy::NowPlayingInfoCallback(hasActiveSession, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier, callbackID));
 }
-    
-void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
-{
-    if (auto* pluginView = pluginViewForFrame(&m_page->mainFrame())) {
-        if (pluginView->performDictionaryLookupAtLocation(floatPoint))
-            return;
-    }
-    
-    // Find the frame the point is over.
-    HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(roundedIntPoint(floatPoint)));
-    RefPtr<Range> range;
-    NSDictionary *options;
-    std::tie(range, options) = DictionaryLookup::rangeAtHitTestResult(result);
-    if (!range)
-        return;
-    
-    auto* frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document().frame() : &m_page->focusController().focusedOrMainFrame();
-    if (!frame)
-        return;
-    
-    performDictionaryLookupForRange(*frame, *range, options, TextIndicatorPresentationTransition::Bounce);
-}
-
-void WebPage::performDictionaryLookupForSelection(Frame& frame, const VisibleSelection& selection, TextIndicatorPresentationTransition presentationTransition)
-{
-    RefPtr<Range> selectedRange;
-    NSDictionary *options;
-    std::tie(selectedRange, options) = DictionaryLookup::rangeForSelection(selection);
-    if (selectedRange)
-        performDictionaryLookupForRange(frame, *selectedRange, options, presentationTransition);
-}
-
-void WebPage::performDictionaryLookupOfCurrentSelection()
-{
-    auto& frame = m_page->focusController().focusedOrMainFrame();
-    performDictionaryLookupForSelection(frame, frame.selection().selection(), TextIndicatorPresentationTransition::BounceAndCrossfade);
-}
-    
-void WebPage::performDictionaryLookupForRange(Frame& frame, Range& range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
-{
-    send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfoForRange(frame, range, options, presentationTransition)));
-}
-
-DictionaryPopupInfo WebPage::dictionaryPopupInfoForRange(Frame& frame, Range& range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
-{
-    Editor& editor = frame.editor();
-    editor.setIsGettingDictionaryPopupInfo(true);
-    
-    DictionaryPopupInfo dictionaryPopupInfo;
-    if (range.text().stripWhiteSpace().isEmpty()) {
-        editor.setIsGettingDictionaryPopupInfo(false);
-        return dictionaryPopupInfo;
-    }
-    
-    Vector<FloatQuad> quads;
-    range.absoluteTextQuads(quads);
-    if (quads.isEmpty()) {
-        editor.setIsGettingDictionaryPopupInfo(false);
-        return dictionaryPopupInfo;
-    }
-    
-    IntRect rangeRect = frame.view()->contentsToWindow(quads[0].enclosingBoundingBox());
-    
-    const RenderStyle* style = range.startContainer().renderStyle();
-    float scaledAscent = style ? style->fontMetrics().ascent() * pageScaleFactor() : 0;
-    dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + scaledAscent);
-    dictionaryPopupInfo.options = options;
-
-#if PLATFORM(MAC)
-
-    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
-    
-    RetainPtr<NSMutableAttributedString> scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
-    
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-    
-    [nsAttributedString enumerateAttributesInRange:NSMakeRange(0, [nsAttributedString length]) options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop) {
-        RetainPtr<NSMutableDictionary> scaledAttributes = adoptNS([attributes mutableCopy]);
-        
-        NSFont *font = [scaledAttributes objectForKey:NSFontAttributeName];
-        if (font)
-            font = [fontManager convertFont:font toSize:font.pointSize * pageScaleFactor()];
-        if (font)
-            [scaledAttributes setObject:font forKey:NSFontAttributeName];
-        
-        [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
-    }];
-
-#endif // PLATFORM(MAC)
-    
-    TextIndicatorOptions indicatorOptions = TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges;
-    if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade)
-        indicatorOptions |= TextIndicatorOptionIncludeSnapshotWithSelectionHighlight;
-    
-    RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(range, indicatorOptions, presentationTransition);
-    if (!textIndicator) {
-        editor.setIsGettingDictionaryPopupInfo(false);
-        return dictionaryPopupInfo;
-    }
-    
-    dictionaryPopupInfo.textIndicator = textIndicator->data();
-#if PLATFORM(MAC)
-    dictionaryPopupInfo.attributedString = scaledNSAttributedString;
-#endif // PLATFORM(MAC)
-    
-    editor.setIsGettingDictionaryPopupInfo(false);
-    return dictionaryPopupInfo;
-}
 
 } // namespace WebKit
 
index 5052e04..127d841 100644 (file)
@@ -189,14 +189,17 @@ messages -> WebPage LegacyReceiver {
     RunJavaScriptInMainFrameScriptWorld(String script, bool forceUserGesture, String worldName, WebKit::CallbackID callbackID)
     ForceRepaint(WebKit::CallbackID callbackID)
 
+#if PLATFORM(COCOA)
+    # Dictionary support.
+    PerformDictionaryLookupAtLocation(WebCore::FloatPoint point)
+#endif
+
 #if ENABLE(DATA_DETECTION)
     DetectDataInAllFrames(uint64_t types) -> (struct WebKit::DataDetectionResult result) Async
     RemoveDataDetectedLinks() -> (struct WebKit::DataDetectionResult result) Async
 #endif
 
-#if PLATFORM(COCOA)
-    # Dictionary support.
-    PerformDictionaryLookupAtLocation(WebCore::FloatPoint point)
+#if PLATFORM(MAC)
     PerformDictionaryLookupOfCurrentSelection()
 #endif
 
index 6e5a6d1..eac4f4f 100644 (file)
@@ -417,6 +417,21 @@ void WebPage::sendComplexTextInputToPlugin(uint64_t, const String&)
     notImplemented();
 }
 
+void WebPage::performDictionaryLookupAtLocation(const FloatPoint&)
+{
+    notImplemented();
+}
+
+void WebPage::performDictionaryLookupForSelection(Frame&, const VisibleSelection&, TextIndicatorPresentationTransition)
+{
+    notImplemented();
+}
+
+void WebPage::performDictionaryLookupForRange(Frame&, Range&, NSDictionary *, TextIndicatorPresentationTransition)
+{
+    notImplemented();
+}
+
 bool WebPage::performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*)
 {
     notImplemented();
index fa7a6aa..4733b1c 100644 (file)
@@ -389,7 +389,102 @@ void WebPage::fontAtSelection(CallbackID callbackID)
     send(Messages::WebPageProxy::FontAtSelectionCallback(fontName, fontSize, selectionHasMultipleFonts, callbackID));
 }
     
+void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
+{
+    if (auto* pluginView = pluginViewForFrame(&m_page->mainFrame())) {
+        if (pluginView->performDictionaryLookupAtLocation(floatPoint))
+            return;
+    }
+
+    // Find the frame the point is over.
+    HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(roundedIntPoint(floatPoint)));
+    RefPtr<Range> range;
+    NSDictionary *options;
+    std::tie(range, options) = DictionaryLookup::rangeAtHitTestResult(result);
+    if (!range)
+        return;
+
+    auto* frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document().frame() : &m_page->focusController().focusedOrMainFrame();
+    if (!frame)
+        return;
+
+    performDictionaryLookupForRange(*frame, *range, options, TextIndicatorPresentationTransition::Bounce);
+}
+
+void WebPage::performDictionaryLookupForSelection(Frame& frame, const VisibleSelection& selection, TextIndicatorPresentationTransition presentationTransition)
+{
+    RefPtr<Range> selectedRange;
+    NSDictionary *options;
+    std::tie(selectedRange, options) = DictionaryLookup::rangeForSelection(selection);
+    if (selectedRange)
+        performDictionaryLookupForRange(frame, *selectedRange, options, presentationTransition);
+}
 
+void WebPage::performDictionaryLookupOfCurrentSelection()
+{
+    auto& frame = m_page->focusController().focusedOrMainFrame();
+    performDictionaryLookupForSelection(frame, frame.selection().selection(), TextIndicatorPresentationTransition::BounceAndCrossfade);
+}
+
+DictionaryPopupInfo WebPage::dictionaryPopupInfoForRange(Frame& frame, Range& range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
+{
+    Editor& editor = frame.editor();
+    editor.setIsGettingDictionaryPopupInfo(true);
+
+    DictionaryPopupInfo dictionaryPopupInfo;
+    if (range.text().stripWhiteSpace().isEmpty()) {
+        editor.setIsGettingDictionaryPopupInfo(false);
+        return dictionaryPopupInfo;
+    }
+
+    Vector<FloatQuad> quads;
+    range.absoluteTextQuads(quads);
+    if (quads.isEmpty()) {
+        editor.setIsGettingDictionaryPopupInfo(false);
+        return dictionaryPopupInfo;
+    }
+
+    IntRect rangeRect = frame.view()->contentsToWindow(quads[0].enclosingBoundingBox());
+
+    const RenderStyle* style = range.startContainer().renderStyle();
+    float scaledAscent = style ? style->fontMetrics().ascent() * pageScaleFactor() : 0;
+    dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + scaledAscent);
+    dictionaryPopupInfo.options = options;
+
+    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
+
+    RetainPtr<NSMutableAttributedString> scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
+
+    NSFontManager *fontManager = [NSFontManager sharedFontManager];
+
+    [nsAttributedString enumerateAttributesInRange:NSMakeRange(0, [nsAttributedString length]) options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop) {
+        RetainPtr<NSMutableDictionary> scaledAttributes = adoptNS([attributes mutableCopy]);
+
+        NSFont *font = [scaledAttributes objectForKey:NSFontAttributeName];
+        if (font)
+            font = [fontManager convertFont:font toSize:font.pointSize * pageScaleFactor()];
+        if (font)
+            [scaledAttributes setObject:font forKey:NSFontAttributeName];
+
+        [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
+    }];
+
+    TextIndicatorOptions indicatorOptions = TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges;
+    if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade)
+        indicatorOptions |= TextIndicatorOptionIncludeSnapshotWithSelectionHighlight;
+
+    RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(range, indicatorOptions, presentationTransition);
+    if (!textIndicator) {
+        editor.setIsGettingDictionaryPopupInfo(false);
+        return dictionaryPopupInfo;
+    }
+
+    dictionaryPopupInfo.textIndicator = textIndicator->data();
+    dictionaryPopupInfo.attributedString = scaledNSAttributedString;
+
+    editor.setIsGettingDictionaryPopupInfo(false);
+    return dictionaryPopupInfo;
+}
 
 #if ENABLE(PDFKIT_PLUGIN)
 
@@ -444,6 +539,11 @@ DictionaryPopupInfo WebPage::dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelec
 
 #endif
 
+void WebPage::performDictionaryLookupForRange(Frame& frame, Range& range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
+{
+    send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfoForRange(frame, range, options, presentationTransition)));
+}
+
 bool WebPage::performNonEditingBehaviorForSelector(const String& selector, KeyboardEvent* event)
 {
     // First give accessibility a chance to handle the event.