Title: [242635] trunk
Revision
242635
Author
[email protected]
Date
2019-03-07 22:11:40 -0800 (Thu, 07 Mar 2019)

Log Message

Source/WebCore:
[ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
https://bugs.webkit.org/show_bug.cgi?id=195421
<rdar://problem/48682004>

Reviewed by Simon Fraser.

Visibility change might be triggered synchronously while dispatching mouseMoved event.

Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::mouseMovedDidStart):
(WebCore::ContentChangeObserver::mouseMovedDidFinish):
(WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::isObservingContentChanges const):

LayoutTests:
[ContentChangeObserver] Check if visibility change happens while dispatching mouseMoved
https://bugs.webkit.org/show_bug.cgi?id=195421
<rdar://problem/48682004>

Reviewed by Simon Fraser.

* fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242634 => 242635)


--- trunk/LayoutTests/ChangeLog	2019-03-08 06:08:59 UTC (rev 242634)
+++ trunk/LayoutTests/ChangeLog	2019-03-08 06:11:40 UTC (rev 242635)
@@ -1,5 +1,16 @@
 2019-03-07  Zalan Bujtas  <[email protected]>
 
+        [ContentChangeObserver] Check if visibility change happens while dispatching mouseMoved
+        https://bugs.webkit.org/show_bug.cgi?id=195421
+        <rdar://problem/48682004>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html: Added.
+
+2019-03-07  Zalan Bujtas  <[email protected]>
+
         [ContentChangeObserver] Check if max-height change triggers visible content change.
         https://bugs.webkit.org/show_bug.cgi?id=195417
         <rdar://problem/48680631>

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved-expected.txt (0 => 242635)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved-expected.txt	2019-03-08 06:11:40 UTC (rev 242635)
@@ -0,0 +1,2 @@
+PASS if 'clicked' text is not shown below.
+

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html (0 => 242635)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html	2019-03-08 06:11:40 UTC (rev 242635)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<title>This tests the case when visible content change happens on touchstart</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+    display: none;
+    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 'clicked' text is not shown below.</div>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mouseover", function( event ) {
+    becomesVisible.style.display = "block";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (242634 => 242635)


--- trunk/Source/WebCore/ChangeLog	2019-03-08 06:08:59 UTC (rev 242634)
+++ trunk/Source/WebCore/ChangeLog	2019-03-08 06:11:40 UTC (rev 242635)
@@ -1,5 +1,24 @@
 2019-03-07  Zalan Bujtas  <[email protected]>
 
+        [ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
+        https://bugs.webkit.org/show_bug.cgi?id=195421
+        <rdar://problem/48682004>
+
+        Reviewed by Simon Fraser.
+
+        Visibility change might be triggered synchronously while dispatching mouseMoved event.
+
+        Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::mouseMovedDidStart):
+        (WebCore::ContentChangeObserver::mouseMovedDidFinish):
+        (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
+        * page/ios/ContentChangeObserver.h:
+        (WebCore::ContentChangeObserver::isObservingContentChanges const):
+
+2019-03-07  Zalan Bujtas  <[email protected]>
+
         [ContentChangeObserver] Check if max-height change triggers visible content change.
         https://bugs.webkit.org/show_bug.cgi?id=195417
         <rdar://problem/48680631>

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (242634 => 242635)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-08 06:08:59 UTC (rev 242634)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-08 06:11:40 UTC (rev 242635)
@@ -183,18 +183,21 @@
 
 void ContentChangeObserver::mouseMovedDidStart()
 {
-#if !ASSERT_DISABLED
-    m_mouseMovedIsBeingDispatched = true;
-#endif
+    if (!m_document.settings().contentChangeObserverEnabled())
+        return;
+    LOG(ContentObservation, "mouseMovedDidStart: mouseMoved started.");
+    m_mouseMovedEventIsBeingDispatched = true;
     adjustObservedState(Event::StartedMouseMovedEventDispatching);
 }
 
 void ContentChangeObserver::mouseMovedDidFinish()
 {
+    if (!m_mouseMovedEventIsBeingDispatched)
+        return;
+    ASSERT(m_document.settings().contentChangeObserverEnabled());
+    LOG(ContentObservation, "mouseMovedDidFinish: mouseMoved finished.");
     adjustObservedState(Event::EndedMouseMovedEventDispatching);
-#if !ASSERT_DISABLED
-    m_mouseMovedIsBeingDispatched = false;
-#endif
+    m_mouseMovedEventIsBeingDispatched = false;
 }
 
 WKContentChange ContentChangeObserver::observedContentChange() const
@@ -219,7 +222,7 @@
 #if !ASSERT_DISABLED
 bool ContentChangeObserver::isNotifyContentChangeAllowed() const
 {
-    return m_document.settings().contentChangeObserverEnabled() && !m_mouseMovedIsBeingDispatched;
+    return m_document.settings().contentChangeObserverEnabled() && !m_mouseMovedEventIsBeingDispatched;
 }
 #endif
 

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (242634 => 242635)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-08 06:08:59 UTC (rev 242634)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-08 06:11:40 UTC (rev 242635)
@@ -119,7 +119,7 @@
     void setShouldObserveNextStyleRecalc(bool);
     bool isObservingStyleRecalc() const { return m_isObservingStyleRecalc; }
 
-    bool isObservingContentChanges() const { return m_touchEventIsBeingDispatched || m_domTimerIsBeingExecuted || m_styleRecalcIsBeingExecuted || m_contentObservationTimer.isActive(); }
+    bool isObservingContentChanges() const { return m_mouseMovedEventIsBeingDispatched || m_touchEventIsBeingDispatched || m_domTimerIsBeingExecuted || m_styleRecalcIsBeingExecuted || m_contentObservationTimer.isActive(); }
 
     void cancelPendingActivities();
 
@@ -162,9 +162,7 @@
     bool m_isObservingDOMTimerScheduling { false };
     bool m_domTimerIsBeingExecuted { false };
     bool m_isMouseMovedPrecededByTouch { false };
-#if !ASSERT_DISABLED
-    bool m_mouseMovedIsBeingDispatched { false };
-#endif
+    bool m_mouseMovedEventIsBeingDispatched { false };
 };
 
 inline void ContentChangeObserver::setHasNoChangeState()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to