Title: [279061] trunk/Source/WebCore
Revision
279061
Author
[email protected]
Date
2021-06-20 18:19:50 -0700 (Sun, 20 Jun 2021)

Log Message

HitTestLocation::m_boundingBox should be able hold subpixel values
https://bugs.webkit.org/show_bug.cgi?id=227185

Reviewed by Sam Weinig.

This is in preparation for supporting non-integral area hi-testing (e.g. on 2x displays).
No functionality change yet.

* rendering/HitTestLocation.cpp:
(WebCore::rectForPoint):
* rendering/HitTestLocation.h:
(WebCore::HitTestLocation::boundingBox const):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::hitTestCulledInline):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279060 => 279061)


--- trunk/Source/WebCore/ChangeLog	2021-06-20 23:22:06 UTC (rev 279060)
+++ trunk/Source/WebCore/ChangeLog	2021-06-21 01:19:50 UTC (rev 279061)
@@ -1,3 +1,20 @@
+2021-06-20  Alan Bujtas  <[email protected]>
+
+        HitTestLocation::m_boundingBox should be able hold subpixel values
+        https://bugs.webkit.org/show_bug.cgi?id=227185
+
+        Reviewed by Sam Weinig.
+
+        This is in preparation for supporting non-integral area hi-testing (e.g. on 2x displays).
+        No functionality change yet.
+
+        * rendering/HitTestLocation.cpp:
+        (WebCore::rectForPoint):
+        * rendering/HitTestLocation.h:
+        (WebCore::HitTestLocation::boundingBox const):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::hitTestCulledInline):
+
 2021-06-20  Wenson Hsieh  <[email protected]>
 
         [Live Text] Mouse events should only trigger text recognition if the cursor is moving

Modified: trunk/Source/WebCore/rendering/HitTestLocation.cpp (279060 => 279061)


--- trunk/Source/WebCore/rendering/HitTestLocation.cpp	2021-06-20 23:22:06 UTC (rev 279060)
+++ trunk/Source/WebCore/rendering/HitTestLocation.cpp	2021-06-21 01:19:50 UTC (rev 279061)
@@ -24,17 +24,16 @@
 
 namespace WebCore {
 
-static IntRect rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+static LayoutRect rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
 {
-    IntPoint actualPoint(flooredIntPoint(point));
-    actualPoint -= IntSize(leftPadding, topPadding);
+    auto adjustedPosition = LayoutPoint { flooredIntPoint(point) };
+    adjustedPosition -= LayoutSize  { leftPadding, topPadding };
 
-    IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
+    auto width = LayoutUnit { leftPadding + rightPadding };
+    auto height = LayoutUnit { topPadding + bottomPadding };
     // As IntRect is left inclusive and right exclusive (seeing IntRect::contains(x, y)), adding "1".
     // FIXME: Remove this once non-rect based hit-detection stops using IntRect:intersects.
-    actualPadding += IntSize(1, 1);
-
-    return IntRect(actualPoint, actualPadding);
+    return { adjustedPosition, LayoutSize { width + 1, height + 1 } };
 }
 
 HitTestLocation::HitTestLocation() = default;

Modified: trunk/Source/WebCore/rendering/HitTestLocation.h (279060 => 279061)


--- trunk/Source/WebCore/rendering/HitTestLocation.h	2021-06-20 23:22:06 UTC (rev 279060)
+++ trunk/Source/WebCore/rendering/HitTestLocation.h	2021-06-21 01:19:50 UTC (rev 279061)
@@ -46,7 +46,7 @@
     // Rect-based hit test related methods.
     bool isRectBasedTest() const { return m_isRectBased; }
     bool isRectilinear() const { return m_isRectilinear; }
-    IntRect boundingBox() const { return m_boundingBox; }
+    LayoutRect boundingBox() const { return m_boundingBox; }
     
     int topPadding() const { return roundedPoint().y() - m_boundingBox.y(); }
     int rightPadding() const { return m_boundingBox.maxX() - roundedPoint().x() - 1; }
@@ -67,7 +67,7 @@
 
     // These are the cached forms of the more accurate point and rect below.
     LayoutPoint m_point;
-    IntRect m_boundingBox;
+    LayoutRect m_boundingBox;
 
     FloatPoint m_transformedPoint;
     FloatQuad m_transformedRect;

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (279060 => 279061)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2021-06-20 23:22:06 UTC (rev 279060)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2021-06-21 01:19:50 UTC (rev 279061)
@@ -584,7 +584,7 @@
         // We cannot use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area
         // because it can only handle rectangular targets.
         result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer);
-        return regionResult.contains(tmpLocation.boundingBox());
+        return regionResult.contains(enclosingIntRect(tmpLocation.boundingBox()));
     }
     return false;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to