Title: [186132] trunk/Source
Revision
186132
Author
[email protected]
Date
2015-06-30 14:40:01 -0700 (Tue, 30 Jun 2015)

Log Message

The bounds on InteractionInformationAtPosition should be more precise
https://bugs.webkit.org/show_bug.cgi?id=146468
-and corresponding-
rdar://problem/20739834

Reviewed by Enrica Casucci and Simon Fraser.

Source/WebCore:

Export absoluteContentQuad().
* rendering/RenderBox.h:

Source/WebKit2:

For links, get the TextQuads from the Range, and for images, look at the 
absoluteContentQuad(). All other items can continue to use absoluteBoundingBox.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186131 => 186132)


--- trunk/Source/WebCore/ChangeLog	2015-06-30 21:37:57 UTC (rev 186131)
+++ trunk/Source/WebCore/ChangeLog	2015-06-30 21:40:01 UTC (rev 186132)
@@ -1,3 +1,15 @@
+2015-06-30  Beth Dakin  <[email protected]>
+
+        The bounds on InteractionInformationAtPosition should be more precise
+        https://bugs.webkit.org/show_bug.cgi?id=146468
+        -and corresponding-
+        rdar://problem/20739834
+
+        Reviewed by Enrica Casucci and Simon Fraser.
+
+        Export absoluteContentQuad().
+        * rendering/RenderBox.h:
+
 2015-06-30  Zalan Bujtas  <[email protected]>
 
         Addressing post-review comments in r185756.

Modified: trunk/Source/WebCore/rendering/RenderBox.h (186131 => 186132)


--- trunk/Source/WebCore/rendering/RenderBox.h	2015-06-30 21:37:57 UTC (rev 186131)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2015-06-30 21:40:01 UTC (rev 186132)
@@ -167,7 +167,7 @@
     // The content box in absolute coords. Ignores transforms.
     IntRect absoluteContentBox() const;
     // The content box converted to absolute coords (taking transforms into account).
-    FloatQuad absoluteContentQuad() const;
+    WEBCORE_EXPORT FloatQuad absoluteContentQuad() const;
 
     // This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect
     // does include the intrinsic padding in the content box as this is what some callers expect (like getComputedStyle).

Modified: trunk/Source/WebKit2/ChangeLog (186131 => 186132)


--- trunk/Source/WebKit2/ChangeLog	2015-06-30 21:37:57 UTC (rev 186131)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-30 21:40:01 UTC (rev 186132)
@@ -1,3 +1,17 @@
+2015-06-30  Beth Dakin  <[email protected]>
+
+        The bounds on InteractionInformationAtPosition should be more precise
+        https://bugs.webkit.org/show_bug.cgi?id=146468
+        -and corresponding-
+        rdar://problem/20739834
+
+        Reviewed by Enrica Casucci and Simon Fraser.
+
+        For links, get the TextQuads from the Range, and for images, look at the 
+        absoluteContentQuad(). All other items can continue to use absoluteBoundingBox.
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getPositionInformation):
+
 2015-06-30  Anders Carlsson  <[email protected]>
 
         Disable Spintracer when getting the list of plug-ins

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (186131 => 186132)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-06-30 21:37:57 UTC (rev 186131)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-06-30 21:40:01 UTC (rev 186132)
@@ -2160,9 +2160,23 @@
             info.title = element->fastGetAttribute(HTMLNames::titleAttr).string();
             if (linkElement && info.title.isEmpty())
                 info.title = element->innerText();
-            if (element->renderer()) {
-                info.bounds = element->renderer()->absoluteBoundingBoxRect(true);
+            if (element->renderer())
                 info.touchCalloutEnabled = element->renderer()->style().touchCalloutEnabled();
+
+            if (element == linkElement) {
+                RefPtr<Range> linkRange = rangeOfContents(*linkElement);
+                Vector<FloatQuad> quads;
+                linkRange->textQuads(quads);
+                FloatRect linkBoundingBox;
+                for (const auto& quad : quads)
+                    linkBoundingBox.unite(quad.enclosingBoundingBox());
+                info.bounds = IntRect(linkBoundingBox);
+            } else if (RenderElement* renderer = element->renderer()) {
+                if (renderer->isRenderImage()) {
+                    auto& renderImage = downcast<RenderImage>(*renderer);
+                    info.bounds = renderImage.absoluteContentQuad().enclosingBoundingBox();
+                } else
+                    info.bounds = renderer->absoluteBoundingBoxRect();
             }
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to