Lookup only looking up the first word in selection
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Apr 2019 14:41:24 +0000 (14:41 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Apr 2019 14:41:24 +0000 (14:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197341
<rdar://problem/48221414>

Reviewed by Wenson Hsieh.

Lookup is not testable.

Reveal needs the full range in order to correctly create the item for the popover.

* editing/cocoa/DictionaryLookup.mm:
(WebCore::showPopupOrCreateAnimationController):

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

Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/DictionaryLookup.mm

index bcdf5b9..c00feef 100644 (file)
@@ -1,3 +1,18 @@
+2019-04-27  Megan Gardner  <megan_gardner@apple.com>
+
+        Lookup only looking up the first word in selection
+        https://bugs.webkit.org/show_bug.cgi?id=197341
+        <rdar://problem/48221414>
+
+        Reviewed by Wenson Hsieh.
+
+        Lookup is not testable.
+
+        Reveal needs the full range in order to correctly create the item for the popover.
+
+        * editing/cocoa/DictionaryLookup.mm:
+        (WebCore::showPopupOrCreateAnimationController):
+
 2019-04-26  Jer Noble  <jer.noble@apple.com>
 
         Reduce the number of copies made during SourceBufferPrivateAVFObjC::append() using SharedBuffer
index 1ff8a70..968a2c3 100644 (file)
@@ -482,7 +482,7 @@ static WKRevealController showPopupOrCreateAnimationController(bool createAnimat
     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)]);
+    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:dictionaryPopupInfo.attributedString.get().string selectedRange:NSMakeRange(0, dictionaryPopupInfo.attributedString.get().string.length)]);
     
     [webHighlight setClearTextIndicator:[webHighlight = WTFMove(webHighlight), clearTextIndicator = WTFMove(clearTextIndicator)] {
         if (clearTextIndicator)
@@ -504,8 +504,8 @@ static WKRevealController showPopupOrCreateAnimationController(bool createAnimat
     auto textIndicator = TextIndicator::create(dictionaryPopupInfo.textIndicator);
     
     RetainPtr<WebRevealHighlight> webHighlight = adoptNS([[WebRevealHighlight alloc] initWithHighlightRect:[view convertRect:textIndicator->selectionRectInRootViewCoordinates() toView:nil] view:view image:textIndicator->contentImage()]);
-    
-    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:dictionaryPopupInfo.attributedString.get().string selectedRange:NSMakeRange(0, 0)]);
+
+    RetainPtr<RVItem> item = adoptNS([allocRVItemInstance() initWithText:dictionaryPopupInfo.attributedString.get().string selectedRange:NSMakeRange(0, dictionaryPopupInfo.attributedString.get().string.length)]);
     
     [UINSSharedRevealController() revealItem:item.get() locationInWindow:dictionaryPopupInfo.origin window:view.window highlighter:(id<UIRVPresenterHighlightDelegate>) webHighlight.get()];
     return nil;