Title: [275255] branches/safari-611.1.21.0-branch
Revision
275255
Author
alanc...@apple.com
Date
2021-03-30 18:50:59 -0700 (Tue, 30 Mar 2021)

Log Message

Cherry-pick r275214. rdar://problem/76032705

    [LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
    https://bugs.webkit.org/show_bug.cgi?id=223932
    rdar://75888718

    Reviewed by Zalan Bujtas.
    Source/WebCore:

    If an inline block has overflowing children (for example due to negative margin) we may fail to hit test them.

    Test: fast/inline-block/hit-test-negative-margin-child.html

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

    Always descend into inline blocks even if their run didn't hit.

    LayoutTests:

    * fast/inline-block/hit-test-negative-margin-child-expected.txt: Added.
    * fast/inline-block/hit-test-negative-margin-child.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275214 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611.1.21.0-branch/LayoutTests/ChangeLog (275254 => 275255)


--- branches/safari-611.1.21.0-branch/LayoutTests/ChangeLog	2021-03-31 01:50:02 UTC (rev 275254)
+++ branches/safari-611.1.21.0-branch/LayoutTests/ChangeLog	2021-03-31 01:50:59 UTC (rev 275255)
@@ -1,3 +1,42 @@
+2021-03-30  Ruben Turcios  <rubent...@apple.com>
+
+        Cherry-pick r275214. rdar://problem/76032705
+
+    [LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
+    https://bugs.webkit.org/show_bug.cgi?id=223932
+    rdar://75888718
+    
+    Reviewed by Zalan Bujtas.
+    Source/WebCore:
+    
+    If an inline block has overflowing children (for example due to negative margin) we may fail to hit test them.
+    
+    Test: fast/inline-block/hit-test-negative-margin-child.html
+    
+    * layout/integration/LayoutIntegrationLineLayout.cpp:
+    (WebCore::LayoutIntegration::LineLayout::hitTest):
+    
+    Always descend into inline blocks even if their run didn't hit.
+    
+    LayoutTests:
+    
+    * fast/inline-block/hit-test-negative-margin-child-expected.txt: Added.
+    * fast/inline-block/hit-test-negative-margin-child.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-03-30  Antti Koivisto  <an...@apple.com>
+
+            [LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
+            https://bugs.webkit.org/show_bug.cgi?id=223932
+            rdar://75888718
+
+            Reviewed by Zalan Bujtas.
+
+            * fast/inline-block/hit-test-negative-margin-child-expected.txt: Added.
+            * fast/inline-block/hit-test-negative-margin-child.html: Added.
+
 2021-03-22  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r274796. rdar://problem/75712824

Added: branches/safari-611.1.21.0-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child-expected.txt (0 => 275255)


--- branches/safari-611.1.21.0-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child-expected.txt	                        (rev 0)
+++ branches/safari-611.1.21.0-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child-expected.txt	2021-03-31 01:50:59 UTC (rev 275255)
@@ -0,0 +1,2 @@
+X
+PASS

Added: branches/safari-611.1.21.0-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child.html (0 => 275255)


--- branches/safari-611.1.21.0-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child.html	                        (rev 0)
+++ branches/safari-611.1.21.0-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child.html	2021-03-31 01:50:59 UTC (rev 275255)
@@ -0,0 +1,12 @@
+<style>
+div { border: 2px solid blue; display:inline-block; margin-left:100px; width:200px; }
+button { margin-left:-75px; width:50px; height:50px; }
+</style>
+<div><button>X</button></div>
+<pre id=log></pre>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+const hitTestElement = document.elementFromPoint(50, 50);
+log.innerText = hitTestElement == document.querySelector('button') ? "PASS" : "FAIL";
+</script>

Modified: branches/safari-611.1.21.0-branch/Source/WebCore/ChangeLog (275254 => 275255)


--- branches/safari-611.1.21.0-branch/Source/WebCore/ChangeLog	2021-03-31 01:50:02 UTC (rev 275254)
+++ branches/safari-611.1.21.0-branch/Source/WebCore/ChangeLog	2021-03-31 01:50:59 UTC (rev 275255)
@@ -1,3 +1,48 @@
+2021-03-30  Ruben Turcios  <rubent...@apple.com>
+
+        Cherry-pick r275214. rdar://problem/76032705
+
+    [LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
+    https://bugs.webkit.org/show_bug.cgi?id=223932
+    rdar://75888718
+    
+    Reviewed by Zalan Bujtas.
+    Source/WebCore:
+    
+    If an inline block has overflowing children (for example due to negative margin) we may fail to hit test them.
+    
+    Test: fast/inline-block/hit-test-negative-margin-child.html
+    
+    * layout/integration/LayoutIntegrationLineLayout.cpp:
+    (WebCore::LayoutIntegration::LineLayout::hitTest):
+    
+    Always descend into inline blocks even if their run didn't hit.
+    
+    LayoutTests:
+    
+    * fast/inline-block/hit-test-negative-margin-child-expected.txt: Added.
+    * fast/inline-block/hit-test-negative-margin-child.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-03-30  Antti Koivisto  <an...@apple.com>
+
+            [LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
+            https://bugs.webkit.org/show_bug.cgi?id=223932
+            rdar://75888718
+
+            Reviewed by Zalan Bujtas.
+
+            If an inline block has overflowing children (for example due to negative margin) we may fail to hit test them.
+
+            Test: fast/inline-block/hit-test-negative-margin-child.html
+
+            * layout/integration/LayoutIntegrationLineLayout.cpp:
+            (WebCore::LayoutIntegration::LineLayout::hitTest):
+
+            Always descend into inline blocks even if their run didn't hit.
+
 2021-03-22  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r274846. rdar://problem/75706510

Modified: branches/safari-611.1.21.0-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (275254 => 275255)


--- branches/safari-611.1.21.0-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-03-31 01:50:02 UTC (rev 275254)
+++ branches/safari-611.1.21.0-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-03-31 01:50:59 UTC (rev 275255)
@@ -501,15 +501,15 @@
 
     // FIXME: This should do something efficient to find the run range.
     for (auto& run : WTF::makeReversedRange(inlineContent.runs)) {
-        auto runRect = Layout::toLayoutRect(run.rect());
-        runRect.moveBy(accumulatedOffset);
-
-        if (!locationInContainer.intersects(runRect))
-            continue;
-
         auto& renderer = m_boxTree.rendererForLayoutBox(run.layoutBox());
 
         if (is<RenderText>(renderer)) {
+            auto runRect = Layout::toLayoutRect(run.rect());
+            runRect.moveBy(accumulatedOffset);
+
+            if (!locationInContainer.intersects(runRect))
+                continue;
+            
             auto& style = run.style();
             if (style.visibility() != Visibility::Visible || style.pointerEvents() == PointerEvents::None)
                 continue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to