Title: [275238] branches/safari-611.1.21.161-branch
Revision
275238
Author
[email protected]
Date
2021-03-30 14:33:44 -0700 (Tue, 30 Mar 2021)

Log Message

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

    [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.161-branch/LayoutTests/ChangeLog (275237 => 275238)


--- branches/safari-611.1.21.161-branch/LayoutTests/ChangeLog	2021-03-30 21:31:55 UTC (rev 275237)
+++ branches/safari-611.1.21.161-branch/LayoutTests/ChangeLog	2021-03-30 21:33:44 UTC (rev 275238)
@@ -1,3 +1,42 @@
+2021-03-30  Alan Coon  <[email protected]>
+
+        Cherry-pick r275214. rdar://problem/76022033
+
+    [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  <[email protected]>
+
+            [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-04  Alan Coon  <[email protected]>
 
         Cherry-pick r273901. rdar://problem/75058990

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


--- branches/safari-611.1.21.161-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child-expected.txt	                        (rev 0)
+++ branches/safari-611.1.21.161-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child-expected.txt	2021-03-30 21:33:44 UTC (rev 275238)
@@ -0,0 +1,2 @@
+X
+PASS

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


--- branches/safari-611.1.21.161-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child.html	                        (rev 0)
+++ branches/safari-611.1.21.161-branch/LayoutTests/fast/inline-block/hit-test-negative-margin-child.html	2021-03-30 21:33:44 UTC (rev 275238)
@@ -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.161-branch/Source/WebCore/ChangeLog (275237 => 275238)


--- branches/safari-611.1.21.161-branch/Source/WebCore/ChangeLog	2021-03-30 21:31:55 UTC (rev 275237)
+++ branches/safari-611.1.21.161-branch/Source/WebCore/ChangeLog	2021-03-30 21:33:44 UTC (rev 275238)
@@ -1,3 +1,48 @@
+2021-03-30  Alan Coon  <[email protected]>
+
+        Cherry-pick r275214. rdar://problem/76022033
+
+    [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  <[email protected]>
+
+            [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-23  Russell Epstein  <[email protected]>
 
         Cherry-pick r271385. rdar://problem/75751024

Modified: branches/safari-611.1.21.161-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (275237 => 275238)


--- branches/safari-611.1.21.161-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-03-30 21:31:55 UTC (rev 275237)
+++ branches/safari-611.1.21.161-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-03-30 21:33:44 UTC (rev 275238)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to