Title: [246404] trunk
Revision
246404
Author
commit-qu...@webkit.org
Date
2019-06-13 09:05:27 -0700 (Thu, 13 Jun 2019)

Log Message

"display: contents" Content click does not trigger
https://bugs.webkit.org/show_bug.cgi?id=198559
<rdar://problem/51488524>

Patch by Antoine Quint <grao...@apple.com> on 2019-06-13
Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/events/ios/click-event-and-display-contents.html

* dom/Element.h:

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::commitPotentialTap):

LayoutTests:

Add a new test that checks that tapping on an element with "display: contents" correctly gets a "click" event.

* fast/events/ios/click-event-and-display-contents-expected.txt: Added.
* fast/events/ios/click-event-and-display-contents.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246403 => 246404)


--- trunk/LayoutTests/ChangeLog	2019-06-13 15:07:18 UTC (rev 246403)
+++ trunk/LayoutTests/ChangeLog	2019-06-13 16:05:27 UTC (rev 246404)
@@ -1,3 +1,16 @@
+2019-06-13  Antoine Quint  <grao...@apple.com>
+
+        "display: contents" Content click does not trigger
+        https://bugs.webkit.org/show_bug.cgi?id=198559
+        <rdar://problem/51488524>
+
+        Reviewed by Antti Koivisto.
+
+        Add a new test that checks that tapping on an element with "display: contents" correctly gets a "click" event.
+
+        * fast/events/ios/click-event-and-display-contents-expected.txt: Added.
+        * fast/events/ios/click-event-and-display-contents.html: Added.
+
 2019-06-13  Youenn Fablet  <you...@apple.com>
 
         Update service worker test and expectation after revision 246363

Added: trunk/LayoutTests/fast/events/ios/click-event-and-display-contents-expected.txt (0 => 246404)


--- trunk/LayoutTests/fast/events/ios/click-event-and-display-contents-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/click-event-and-display-contents-expected.txt	2019-06-13 16:05:27 UTC (rev 246404)
@@ -0,0 +1,2 @@
+PASS
+

Added: trunk/LayoutTests/fast/events/ios/click-event-and-display-contents.html (0 => 246404)


--- trunk/LayoutTests/fast/events/ios/click-event-and-display-contents.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/click-event-and-display-contents.html	2019-06-13 16:05:27 UTC (rev 246404)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that a tap on an element with display: contents dispatches a "click" event.</title>
+<script src=""
+<style>
+#target {
+    width: 100px;
+    height: 100px;
+    background-color: black;
+    display: contents;
+}
+</style>
+</head>
+<body>
+<div id="target">FAIL</div>
+<script>
+
+(function() {
+    if (!window.testRunner || !testRunner.runUIScript)
+        return;
+
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+
+    const target = document.getElementById("target");
+
+    target.addEventListener("click", event => {
+        document.getElementById("target").innerText = "PASS";
+        testRunner.notifyDone();
+    });
+
+    const bounds = target.getBoundingClientRect();
+    const x = bounds.left + bounds.width / 2;
+    const y = bounds.top + bounds.height / 2;
+    tapAtPoint(x, y);
+})();
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (246403 => 246404)


--- trunk/Source/WebCore/ChangeLog	2019-06-13 15:07:18 UTC (rev 246403)
+++ trunk/Source/WebCore/ChangeLog	2019-06-13 16:05:27 UTC (rev 246404)
@@ -1,3 +1,15 @@
+2019-06-13  Antoine Quint  <grao...@apple.com>
+
+        "display: contents" Content click does not trigger
+        https://bugs.webkit.org/show_bug.cgi?id=198559
+        <rdar://problem/51488524>
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/events/ios/click-event-and-display-contents.html
+
+        * dom/Element.h:
+
 2019-06-13  Takashi Komori  <takashi.kom...@sony.com>
 
         [curl] Remove member objects of CurlRequest not to share by different threads.

Modified: trunk/Source/WebCore/dom/Element.h (246403 => 246404)


--- trunk/Source/WebCore/dom/Element.h	2019-06-13 15:07:18 UTC (rev 246403)
+++ trunk/Source/WebCore/dom/Element.h	2019-06-13 16:05:27 UTC (rev 246404)
@@ -540,7 +540,7 @@
     LayoutRect absoluteEventHandlerBounds(bool& includesFixedPositionElements) override;
 
     const RenderStyle* existingComputedStyle() const;
-    const RenderStyle* renderOrDisplayContentsStyle() const;
+    WEBCORE_EXPORT const RenderStyle* renderOrDisplayContentsStyle() const;
 
     void setBeforePseudoElement(Ref<PseudoElement>&&);
     void setAfterPseudoElement(Ref<PseudoElement>&&);

Modified: trunk/Source/WebKit/ChangeLog (246403 => 246404)


--- trunk/Source/WebKit/ChangeLog	2019-06-13 15:07:18 UTC (rev 246403)
+++ trunk/Source/WebKit/ChangeLog	2019-06-13 16:05:27 UTC (rev 246404)
@@ -1,3 +1,14 @@
+2019-06-13  Antoine Quint  <grao...@apple.com>
+
+        "display: contents" Content click does not trigger
+        https://bugs.webkit.org/show_bug.cgi?id=198559
+        <rdar://problem/51488524>
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::commitPotentialTap):
+
 2019-06-13  Takashi Komori  <takashi.kom...@sony.com>
 
         [curl] Remove member objects of CurlRequest not to share by different threads.

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (246403 => 246404)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-06-13 15:07:18 UTC (rev 246403)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-06-13 16:05:27 UTC (rev 246404)
@@ -1058,7 +1058,13 @@
         m_lastCommittedTapLocation = currentPotentialTapLocation;
     };
 
-    auto invalidTargetForSingleClick = !m_potentialTapNode || (!m_potentialTapNode->renderer() && !is<HTMLAreaElement>(m_potentialTapNode.get()));
+    auto invalidTargetForSingleClick = !m_potentialTapNode;
+    if (!invalidTargetForSingleClick) {
+        bool targetRenders = m_potentialTapNode->renderer();
+        if (!targetRenders && is<Element>(m_potentialTapNode.get()))
+            targetRenders = downcast<Element>(*m_potentialTapNode).renderOrDisplayContentsStyle();
+        invalidTargetForSingleClick = !targetRenders && !is<HTMLAreaElement>(m_potentialTapNode.get());
+    }
     if (invalidTargetForSingleClick) {
         // When the node has no click eventlistener, but it may have a dblclick one.
         handlePotentialDoubleTapForDoubleClickAtPoint(modifiers, lastLayerTreeTransactionId);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to