Title: [282060] trunk/Source/WebCore
Revision
282060
Author
[email protected]
Date
2021-09-06 10:49:10 -0700 (Mon, 06 Sep 2021)

Log Message

[LFC][Integration] Use inline boxes in run vector for hit testing
https://bugs.webkit.org/show_bug.cgi?id=229933

Reviewed by Alan Bujtas.

Stop using nonRootInlineBoxes.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282059 => 282060)


--- trunk/Source/WebCore/ChangeLog	2021-09-06 16:38:28 UTC (rev 282059)
+++ trunk/Source/WebCore/ChangeLog	2021-09-06 17:49:10 UTC (rev 282060)
@@ -1,3 +1,15 @@
+2021-09-06  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Use inline boxes in run vector for hit testing
+        https://bugs.webkit.org/show_bug.cgi?id=229933
+
+        Reviewed by Alan Bujtas.
+
+        Stop using nonRootInlineBoxes.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::hitTest):
+
 2021-09-06  Enrique Ocaña González  <[email protected]>
 
         [MSE] Prevent false-positive "stalled" event iff MSE used

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (282059 => 282060)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-06 16:38:28 UTC (rev 282059)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-06 17:49:10 UTC (rev 282060)
@@ -480,56 +480,29 @@
 
     // FIXME: This should do something efficient to find the run range.
     for (auto& run : WTF::makeReversedRange(inlineContent.runs)) {
-        // FIXME: Use for hit testing instead of nonRootInlineBoxes.
-        if (run.isInlineBox())
-            continue;
-
         auto& renderer = m_boxTree.rendererForLayoutBox(run.layoutBox());
 
-        if (is<RenderText>(renderer)) {
-            auto runRect = Layout::toLayoutRect(run.logicalRect());
-            runRect.moveBy(accumulatedOffset);
+        if (!run.isRootInlineBox() && is<RenderLayerModelObject>(renderer) && downcast<RenderLayerModelObject>(renderer).hasSelfPaintingLayer())
+            continue;
 
-            if (!locationInContainer.intersects(runRect))
-                continue;
-            
-            auto& style = run.style();
-            if (style.visibility() != Visibility::Visible || style.pointerEvents() == PointerEvents::None)
-                continue;
-
-            renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
-            if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, runRect) == HitTestProgress::Stop)
+        if (run.isAtomicInlineLevelBox()) {
+            if (renderer.hitTest(request, result, locationInContainer, accumulatedOffset))
                 return true;
             continue;
         }
 
-        if (is<RenderBox>(renderer)) {
-            auto& renderBox = downcast<RenderBox>(renderer);
-            if (renderBox.hasSelfPaintingLayer())
-                continue;
-            
-            if (renderBox.hitTest(request, result, locationInContainer, accumulatedOffset)) {
-                renderBox.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
-                return true;
-            }
-        }
-    }
+        auto runRect = Layout::toLayoutRect(run.logicalRect());
+        runRect.moveBy(accumulatedOffset);
 
-    for (auto& inlineBox : WTF::makeReversedRange(inlineContent.nonRootInlineBoxes)) {
-        auto inlineBoxRect = Layout::toLayoutRect(inlineBox.rect());
-        inlineBoxRect.moveBy(accumulatedOffset);
-
-        if (!locationInContainer.intersects(inlineBoxRect))
+        if (!locationInContainer.intersects(runRect))
             continue;
 
-        auto& style = inlineBox.style();
+        auto& style = run.style();
         if (style.visibility() != Visibility::Visible || style.pointerEvents() == PointerEvents::None)
             continue;
-
-        auto& renderer = m_boxTree.rendererForLayoutBox(inlineBox.layoutBox());
-
+        
         renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
-        if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, inlineBoxRect) == HitTestProgress::Stop)
+        if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, runRect) == HitTestProgress::Stop)
             return true;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to