Title: [227346] trunk
Revision
227346
Author
an...@apple.com
Date
2018-01-22 12:07:29 -0800 (Mon, 22 Jan 2018)

Log Message

REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
https://bugs.webkit.org/show_bug.cgi?id=179666
<rdar://problem/35534292>

Reviewed by Zalan Bujtas.

Source/WebCore:

The legend element of a fieldset is in the border area, outside the clip rect.
With overflow:hidden mouse events won't reach it.

Test case by Dhaya Benmessaoud.

Test: fast/forms/legend-overflow-hidden-hit-test.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeAtPoint):
(WebCore::RenderBlock::hitTestExcludedChildrenInBorder):

Add a special case to hit testing to handle legend, similarly to what is done for painting.

* rendering/RenderBlock.h:

LayoutTests:

* fast/forms/legend-overflow-hidden-hit-test-expected.txt: Added.
* fast/forms/legend-overflow-hidden-hit-test.html: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227345 => 227346)


--- trunk/LayoutTests/ChangeLog	2018-01-22 19:25:21 UTC (rev 227345)
+++ trunk/LayoutTests/ChangeLog	2018-01-22 20:07:29 UTC (rev 227346)
@@ -1,3 +1,15 @@
+2018-01-22  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
+        https://bugs.webkit.org/show_bug.cgi?id=179666
+        <rdar://problem/35534292>
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/forms/legend-overflow-hidden-hit-test-expected.txt: Added.
+        * fast/forms/legend-overflow-hidden-hit-test.html: Added.
+        * platform/ios/TestExpectations:
+
 2018-01-22  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Implement support for Graphics ARIA roles

Added: trunk/LayoutTests/fast/forms/legend-overflow-hidden-hit-test-expected.txt (0 => 227346)


--- trunk/LayoutTests/fast/forms/legend-overflow-hidden-hit-test-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/legend-overflow-hidden-hit-test-expected.txt	2018-01-22 20:07:29 UTC (rev 227346)
@@ -0,0 +1,2 @@
+Check that hit testing works in the legend of a fieldset with overflow:hidden. Click me
+Clicks: 1

Added: trunk/LayoutTests/fast/forms/legend-overflow-hidden-hit-test.html (0 => 227346)


--- trunk/LayoutTests/fast/forms/legend-overflow-hidden-hit-test.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/legend-overflow-hidden-hit-test.html	2018-01-22 20:07:29 UTC (rev 227346)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+fieldset {
+    overflow: hidden;
+}
+</style>
+</head>
+<body>
+    Check that hit testing works in the legend of a fieldset with overflow:hidden.
+    <fieldset>
+        <legend>
+            <button id=button>Click me</button>
+        </legend>
+        <p id=log>Clicks: 0</p>
+    </fieldset>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+let index = 0;
+function updateCount() {
+    log.innerHTML = `Clicks: ${++index}`;
+}
+button.addEventListener('click', updateCount);
+if (window.eventSender) {
+    eventSender.mouseMoveTo(button.offsetLeft + 5, button.offsetTop + 5)
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
+

Modified: trunk/LayoutTests/platform/ios/TestExpectations (227345 => 227346)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-01-22 19:25:21 UTC (rev 227345)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-01-22 20:07:29 UTC (rev 227346)
@@ -558,6 +558,7 @@
 fast/forms/input-readonly-select.html [ Skip ]
 fast/forms/input-select-on-click.html [ Skip ]
 fast/forms/input-step-as-double.html [ Skip ]
+fast/forms/legend-overflow-hidden-hit-test.html [ Skip ]
 fast/forms/listbox-deselect-scroll.html [ Skip ]
 fast/forms/listbox-scrollbar-hit-test.html [ Skip ]
 fast/forms/listbox-selection-after-typeahead.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (227345 => 227346)


--- trunk/Source/WebCore/ChangeLog	2018-01-22 19:25:21 UTC (rev 227345)
+++ trunk/Source/WebCore/ChangeLog	2018-01-22 20:07:29 UTC (rev 227346)
@@ -1,3 +1,26 @@
+2018-01-22  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
+        https://bugs.webkit.org/show_bug.cgi?id=179666
+        <rdar://problem/35534292>
+
+        Reviewed by Zalan Bujtas.
+
+        The legend element of a fieldset is in the border area, outside the clip rect.
+        With overflow:hidden mouse events won't reach it.
+
+        Test case by Dhaya Benmessaoud.
+
+        Test: fast/forms/legend-overflow-hidden-hit-test.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::nodeAtPoint):
+        (WebCore::RenderBlock::hitTestExcludedChildrenInBorder):
+
+        Add a special case to hit testing to handle legend, similarly to what is done for painting.
+
+        * rendering/RenderBlock.h:
+
 2018-01-22  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Implement support for Graphics ARIA roles

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (227345 => 227346)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2018-01-22 19:25:21 UTC (rev 227345)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2018-01-22 20:07:29 UTC (rev 227346)
@@ -2225,6 +2225,9 @@
         }
     }
 
+    if (!checkChildren && hitTestExcludedChildrenInBorder(request, result, locationInContainer, adjustedLocation, hitTestAction))
+        return true;
+
     // Check if the point is outside radii.
     if (!isRenderView() && style().hasBorderRadius()) {
         LayoutRect borderRect = borderBoxRect();
@@ -3656,5 +3659,21 @@
     LayoutPoint childPoint = flipForWritingModeForChild(box, paintOffset);
     box->paintAsInlineBlock(paintInfo, childPoint);
 }
+
+bool RenderBlock::hitTestExcludedChildrenInBorder(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
+{
+    if (!isFieldset())
+        return false;
+
+    auto* legend = findFieldsetLegend();
+    if (!legend || !legend->isExcludedFromNormalLayout() || legend->hasSelfPaintingLayer())
+        return false;
+
+    HitTestAction childHitTest = hitTestAction;
+    if (hitTestAction == HitTestChildBlockBackgrounds)
+        childHitTest = HitTestChildBlockBackground;
+    LayoutPoint childPoint = flipForWritingModeForChild(legend, accumulatedOffset);
+    return legend->nodeAtPoint(request, result, locationInContainer, childPoint, childHitTest);
+}
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (227345 => 227346)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2018-01-22 19:25:21 UTC (rev 227345)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2018-01-22 20:07:29 UTC (rev 227346)
@@ -455,6 +455,7 @@
     // FIXME-BLOCKFLOW: Remove virtualization when all callers have moved to RenderBlockFlow
     virtual bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&) { return false; }
     virtual bool hitTestInlineChildren(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) { return false; }
+    bool hitTestExcludedChildrenInBorder(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
 
     virtual bool isPointInOverflowControl(HitTestResult&, const LayoutPoint& locationInContainer, const LayoutPoint& accumulatedOffset);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to