[WK2] Take TopContentInset into account when sending dictionary lookup point to Plugi...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jul 2014 20:49:47 +0000 (20:49 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jul 2014 20:49:47 +0000 (20:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134624
<rdar://problem/17222041>

Reviewed by Sam Weinig.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::performDictionaryLookupAtLocation):
Perform the same coordinate conversion we use for mouse events, which happens
to take the top content inset into account.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm

index 30a2bd04e22307b170d4c67e9b07a33fa5732ab3..8a5b4196fb91e88758d93aebbb989d205f562d9f 100644 (file)
@@ -1,3 +1,16 @@
+2014-07-04  Tim Horton  <timothy_horton@apple.com>
+
+        [WK2] Take TopContentInset into account when sending dictionary lookup point to PluginView
+        https://bugs.webkit.org/show_bug.cgi?id=134624
+        <rdar://problem/17222041>
+
+        Reviewed by Sam Weinig.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::performDictionaryLookupAtLocation):
+        Perform the same coordinate conversion we use for mouse events, which happens
+        to take the top content inset into account.
+
 2014-07-04  Philippe Normand  <pnormand@igalia.com>
 
         Unreviewed, GTK WK2 build fix after r170787.
index 7167b7341def0fbaa7a8462e56d473c1fbe67e14..c9a6eb896c2528d68839dc85b761d3aa4c1d01d1 100644 (file)
@@ -1789,7 +1789,8 @@ bool PDFPlugin::findString(const String& target, WebCore::FindOptions options, u
 
 bool PDFPlugin::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
 {
-    PDFSelection* lookupSelection = [m_pdfLayerController getSelectionForWordAtPoint:convertFromPluginToPDFView(roundedIntPoint(point))];
+    IntPoint localPoint = convertFromRootViewToPlugin(roundedIntPoint(point));
+    PDFSelection* lookupSelection = [m_pdfLayerController getSelectionForWordAtPoint:convertFromPluginToPDFView(localPoint)];
 
     if ([[lookupSelection string] length])
         [m_pdfLayerController searchInDictionaryWithSelection:lookupSelection];