Title: [290428] trunk/Source/WebCore
Revision
290428
Author
za...@apple.com
Date
2022-02-24 06:40:29 -0800 (Thu, 24 Feb 2022)

Log Message

[IFC][Integration] Adjust hittest coords when in flipped writing mode
https://bugs.webkit.org/show_bug.cgi?id=237103

Reviewed by Antti Koivisto.

This is similar to what we do in LegacyInlineFlowBox::nodeAtPoint.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::flippedRectForWritingMode):
(WebCore::LayoutIntegration::flippedPointForWritingMode):
(WebCore::LayoutIntegration::LineLayout::hitTest):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290427 => 290428)


--- trunk/Source/WebCore/ChangeLog	2022-02-24 14:27:40 UTC (rev 290427)
+++ trunk/Source/WebCore/ChangeLog	2022-02-24 14:40:29 UTC (rev 290428)
@@ -1,3 +1,17 @@
+2022-02-24  Alan Bujtas  <za...@apple.com>
+
+        [IFC][Integration] Adjust hittest coords when in flipped writing mode
+        https://bugs.webkit.org/show_bug.cgi?id=237103
+
+        Reviewed by Antti Koivisto.
+
+        This is similar to what we do in LegacyInlineFlowBox::nodeAtPoint.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::flippedRectForWritingMode):
+        (WebCore::LayoutIntegration::flippedPointForWritingMode):
+        (WebCore::LayoutIntegration::LineLayout::hitTest):
+
 2022-02-24  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         LibWebRTCCodecs, -Proxy create and communicate the RemoteVideoFrameProxy incorrectly

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (290427 => 290428)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-24 14:27:40 UTC (rev 290427)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-24 14:40:29 UTC (rev 290428)
@@ -752,6 +752,13 @@
         renderInline->paintOutline(paintInfo, paintOffset);
 }
 
+static LayoutRect flippedRectForWritingMode(const RenderBlockFlow& root, const FloatRect& rect)
+{
+    auto flippedRect = LayoutRect { rect };
+    root.flipForWritingMode(flippedRect);
+    return flippedRect;
+}
+
 bool LineLayout::hitTest(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
 {
     if (hitTestAction != HitTestForeground)
@@ -776,7 +783,7 @@
             continue;
         }
 
-        auto boxRect = Layout::toLayoutRect(box.rect());
+        auto boxRect = flippedRectForWritingMode(flow(), box.rect());
         boxRect.moveBy(accumulatedOffset);
 
         if (!locationInContainer.intersects(boxRect))
@@ -786,7 +793,7 @@
         if (!elementRenderer.visibleToHitTesting(request))
             continue;
         
-        renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
+        renderer.updateHitTestResult(result, flow().flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset)));
         if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, boxRect) == HitTestProgress::Stop)
             return true;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to