Title: [243503] trunk
Revision
243503
Author
[email protected]
Date
2019-03-26 10:27:05 -0700 (Tue, 26 Mar 2019)

Log Message

[ContentChangeObserver] Skip anonymous renderers when checking for "willRespondToMouseClickEvents"
https://bugs.webkit.org/show_bug.cgi?id=196259
<rdar://problem/49240029>

Reviewed by Dean Jackson.

Source/WebCore:

Anonymous renderers don't have associated DOM nodes so they can't have event listeners either. Let's skip them.

Test: fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):

LayoutTests:

* fast/events/touch/ios/content-observation/crash-on-anonymous-renderer-expected.txt: Added.
* fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243502 => 243503)


--- trunk/LayoutTests/ChangeLog	2019-03-26 17:13:30 UTC (rev 243502)
+++ trunk/LayoutTests/ChangeLog	2019-03-26 17:27:05 UTC (rev 243503)
@@ -1,3 +1,14 @@
+2019-03-26  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Skip anonymous renderers when checking for "willRespondToMouseClickEvents"
+        https://bugs.webkit.org/show_bug.cgi?id=196259
+        <rdar://problem/49240029>
+
+        Reviewed by Dean Jackson.
+
+        * fast/events/touch/ios/content-observation/crash-on-anonymous-renderer-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html: Added.
+
 2019-03-26  Shawn Roberts  <[email protected]>
 
         Layout tests fast/events/wheel-event-destroys-overflow.html 

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/crash-on-anonymous-renderer-expected.txt (0 => 243503)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/crash-on-anonymous-renderer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/crash-on-anonymous-renderer-expected.txt	2019-03-26 17:27:05 UTC (rev 243503)
@@ -0,0 +1,3 @@
+PASS if no crash.
+inline text with
+text inside block

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html (0 => 243503)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html	2019-03-26 17:27:05 UTC (rev 243503)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<title>This tests the case when visible content has anonymous renderers.</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+    position: absolute;
+    left: -1000px;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+</style>
+<script>
+async function test() {
+    if (!window.testRunner || !testRunner.runUIScript)
+        return;
+    if (window.internals)
+        internals.settings.setContentChangeObserverEnabled(true);
+
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+
+    let rect = tapthis.getBoundingClientRect();
+    let x = rect.left + rect.width / 2;
+    let y = rect.top + rect.height / 2;
+
+    await tapAtPoint(x, y);
+}
+</script>
+</head>
+<body _onload_="test()">
+<div id=tapthis>PASS if no crash.</div>
+<div id=becomesVisible>inline text with <div>text inside block</div></div>
+<script>
+tapthis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.left = "100px";
+    document.body.offsetHeight;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (243502 => 243503)


--- trunk/Source/WebCore/ChangeLog	2019-03-26 17:13:30 UTC (rev 243502)
+++ trunk/Source/WebCore/ChangeLog	2019-03-26 17:27:05 UTC (rev 243503)
@@ -1,3 +1,18 @@
+2019-03-26  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Skip anonymous renderers when checking for "willRespondToMouseClickEvents"
+        https://bugs.webkit.org/show_bug.cgi?id=196259
+        <rdar://problem/49240029>
+
+        Reviewed by Dean Jackson.
+
+        Anonymous renderers don't have associated DOM nodes so they can't have event listeners either. Let's skip them.
+
+        Test: fast/events/touch/ios/content-observation/crash-on-anonymous-renderer.html
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
+
 2019-03-26  Antoine Quint  <[email protected]>
 
         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (243502 => 243503)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-26 17:13:30 UTC (rev 243502)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-26 17:27:05 UTC (rev 243503)
@@ -502,6 +502,8 @@
     // In case when the visible content already had renderers it's not sufficient to check the "newly visible" element only since it might just be the container for the clickable content.  
     ASSERT(m_element.renderer());
     for (auto& descendant : descendantsOfType<RenderElement>(*element.renderer())) {
+        if (!descendant.element())
+            continue;
         if (descendant.element()->willRespondToMouseClickEvents())
             return true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to