Title: [290396] trunk/Source/WebCore
Revision
290396
Author
[email protected]
Date
2022-02-23 16:21:04 -0800 (Wed, 23 Feb 2022)

Log Message

[IFC][Integration] Flip accumulatedOffset to take writing mode into account when hittesting across formatting contexts.
https://bugs.webkit.org/show_bug.cgi?id=237094

Reviewed by Antti Koivisto.

Both paint and hittest need coord flip (vertical writing mode here) when jumping through formatting context boundaries.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::flippedContentOffsetIfNeeded):
(WebCore::LayoutIntegration::LineLayout::paint):
(WebCore::LayoutIntegration::LineLayout::hitTest):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290395 => 290396)


--- trunk/Source/WebCore/ChangeLog	2022-02-23 23:47:27 UTC (rev 290395)
+++ trunk/Source/WebCore/ChangeLog	2022-02-24 00:21:04 UTC (rev 290396)
@@ -1,3 +1,17 @@
+2022-02-23  Alan Bujtas  <[email protected]>
+
+        [IFC][Integration] Flip accumulatedOffset to take writing mode into account when hittesting across formatting contexts.
+        https://bugs.webkit.org/show_bug.cgi?id=237094
+
+        Reviewed by Antti Koivisto.
+
+        Both paint and hittest need coord flip (vertical writing mode here) when jumping through formatting context boundaries.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::flippedContentOffsetIfNeeded):
+        (WebCore::LayoutIntegration::LineLayout::paint):
+        (WebCore::LayoutIntegration::LineLayout::hitTest):
+
 2022-02-23  Chris Dumez  <[email protected]>
 
         Adopt more widely the new URL constructor that takes in a String

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (290395 => 290396)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-23 23:47:27 UTC (rev 290395)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-24 00:21:04 UTC (rev 290396)
@@ -657,6 +657,13 @@
     return m_boxTree.rootLayoutBox();
 }
 
+static LayoutPoint flippedContentOffsetIfNeeded(const RenderBlockFlow& root, const RenderBox& childRenderer, LayoutPoint contentOffset)
+{
+    if (root.style().isFlippedBlocksWritingMode())
+        return root.flipForWritingModeForChild(childRenderer, contentOffset);
+    return contentOffset;
+}
+
 void LineLayout::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     if (!m_inlineContent)
@@ -736,12 +743,8 @@
 
         if (auto& renderer = m_boxTree.rendererForLayoutBox(box.layoutBox()); is<RenderBox>(renderer) && renderer.isReplacedOrInlineBlock()) {
             auto& renderBox = downcast<RenderBox>(renderer);
-            if (!renderBox.hasSelfPaintingLayer() && paintInfo.shouldPaintWithinRoot(renderBox)) {
-                auto visualTopLeft = paintOffset;
-                if (flow().style().isFlippedBlocksWritingMode())
-                    visualTopLeft = flow().flipForWritingModeForChild(renderBox, paintOffset);
-                renderBox.paintAsInlineBlock(paintInfo, visualTopLeft);
-            }
+            if (!renderBox.hasSelfPaintingLayer() && paintInfo.shouldPaintWithinRoot(renderBox))
+                renderBox.paintAsInlineBlock(paintInfo, flippedContentOffsetIfNeeded(flow(), renderBox, paintOffset));
         }
     }
 
@@ -768,7 +771,7 @@
             continue;
 
         if (box.isAtomicInlineLevelBox()) {
-            if (renderer.hitTest(request, result, locationInContainer, accumulatedOffset))
+            if (renderer.hitTest(request, result, locationInContainer, flippedContentOffsetIfNeeded(flow(), downcast<RenderBox>(renderer), accumulatedOffset)))
                 return true;
             continue;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to