Title: [242689] trunk
Revision
242689
Author
[email protected]
Date
2019-03-10 13:08:54 -0700 (Sun, 10 Mar 2019)

Log Message

[ContentChangeObserver] Fix failing test cases
https://bugs.webkit.org/show_bug.cgi?id=195524
<rdar://problem/48745101>

Reviewed by Simon Fraser.

Source/WebCore:

1. Do not start DOM timer install observation when we already detected change at touchstart.
2. hasPendingActivity() should only care about ContentChangeObserver flags.
3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
when a timer gets intalled and removed right away).

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::adjustObservedState):
(WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::hasPendingActivity const):
(WebCore::ContentChangeObserver::isObservationTimeWindowActive const):

LayoutTests:

They've been failing ever since the 32ms fixed time window was introduced.

* fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html:
* fast/events/touch/ios/content-observation/stuck-with-hover-state.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242688 => 242689)


--- trunk/LayoutTests/ChangeLog	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/LayoutTests/ChangeLog	2019-03-10 20:08:54 UTC (rev 242689)
@@ -1,3 +1,16 @@
+2019-03-10  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Fix failing test cases
+        https://bugs.webkit.org/show_bug.cgi?id=195524
+        <rdar://problem/48745101>
+
+        Reviewed by Simon Fraser.
+
+        They've been failing ever since the 32ms fixed time window was introduced. 
+
+        * fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html:
+        * fast/events/touch/ios/content-observation/stuck-with-hover-state.html:
+
 2019-03-10  Simon Fraser  <[email protected]>
 
         Mark two tests as failing after r242624

Modified: trunk/LayoutTests/fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html (242688 => 242689)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html	2019-03-10 20:08:54 UTC (rev 242689)
@@ -25,7 +25,7 @@
 
 	await tapAtPoint(x, y);
 
-    testRunner.notifyDone();
+    setTimeout("testRunner.notifyDone()", 50);
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/events/touch/ios/content-observation/stuck-with-hover-state.html (242688 => 242689)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/stuck-with-hover-state.html	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/stuck-with-hover-state.html	2019-03-10 20:08:54 UTC (rev 242689)
@@ -25,7 +25,7 @@
 
 	await tapAtPoint(x, y);
 
-    testRunner.notifyDone();
+    setTimeout("testRunner.notifyDone()", 50);
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html (242688 => 242689)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html	2019-03-10 20:08:54 UTC (rev 242689)
@@ -50,8 +50,7 @@
     setTimeout(function() {
         becomesVisible.style.visibility = "visible";
         document.body.offsetHeight;
-        if (window.testRunner)
-            setTimeout(testRunner.notifyDone(), 0);
+        setTimeout("testRunner.notifyDone()", 0);
     }, 20);
 }, false);
 

Modified: trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html (242688 => 242689)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html	2019-03-10 20:08:54 UTC (rev 242689)
@@ -50,8 +50,7 @@
         setTimeout(function() {
             becomesVisible.style.visibility = "visible";
             document.body.offsetHeight;
-            if (window.testRunner)
-                setTimeout(testRunner.notifyDone(), 0);
+            setTimeout("testRunner.notifyDone()", 0);
         }, 10);
     }, 0);
 }, false);

Modified: trunk/Source/WebCore/ChangeLog (242688 => 242689)


--- trunk/Source/WebCore/ChangeLog	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/Source/WebCore/ChangeLog	2019-03-10 20:08:54 UTC (rev 242689)
@@ -1,3 +1,23 @@
+2019-03-10  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Fix failing test cases
+        https://bugs.webkit.org/show_bug.cgi?id=195524
+        <rdar://problem/48745101>
+
+        Reviewed by Simon Fraser.
+
+        1. Do not start DOM timer install observation when we already detected change at touchstart.
+        2. hasPendingActivity() should only care about ContentChangeObserver flags.
+        3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
+        when a timer gets intalled and removed right away).
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::adjustObservedState):
+        (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
+        * page/ios/ContentChangeObserver.h:
+        (WebCore::ContentChangeObserver::hasPendingActivity const):
+        (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
+
 2019-03-10  Simon Fraser  <[email protected]>
 
         ScrollingTree should have the final say on where layers go

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (242688 => 242689)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-10 20:08:54 UTC (rev 242689)
@@ -225,13 +225,6 @@
     return observedContentChange() == WKContentNoChange && !hasPendingActivity();
 }
 
-#if !ASSERT_DISABLED
-bool ContentChangeObserver::isNotifyContentChangeAllowed() const
-{
-    return m_document.settings().contentChangeObserverEnabled() && !m_mouseMovedEventIsBeingDispatched;
-}
-#endif
-
 void ContentChangeObserver::adjustObservedState(Event event)
 {
     auto adjustStateAndNotifyContentChangeIfNeeded = [&] {
@@ -239,12 +232,16 @@
         if (observedContentChange() == WKContentIndeterminateChange && !hasPendingActivity())
             setHasNoChangeState();
 
+        // Do not notify the client unless we couldn't make the decision synchronously.
+        if (m_mouseMovedEventIsBeingDispatched) {
+            LOG(ContentObservation, "adjustStateAndNotifyContentChangeIfNeeded: in mouseMoved call. No need to notify the client.");
+            return;
+        }
         if (!hasDeterminateState()) {
-            LOG(ContentObservation, "notifyContentChangeIfNeeded: not in a determined state yet.");
+            LOG(ContentObservation, "adjustStateAndNotifyContentChangeIfNeeded: not in a determined state yet.");
             return;
         }
-        LOG_WITH_STREAM(ContentObservation, stream << "notifyContentChangeIfNeeded: sending observedContentChange ->" << observedContentChange());
-        ASSERT(isNotifyContentChangeAllowed());
+        LOG_WITH_STREAM(ContentObservation, stream << "adjustStateAndNotifyContentChangeIfNeeded: sending observedContentChange ->" << observedContentChange());
         ASSERT(m_document.page());
         ASSERT(m_document.frame());
         m_document.page()->chrome().client().observedContentChange(*m_document.frame());
@@ -265,9 +262,10 @@
         if (!isBetweenTouchEndAndMouseMoved()) {
             setHasNoChangeState();
             clearObservedDOMTimers();
-        }
+            setShouldObserveDOMTimerScheduling(true);
+        } else
+            setShouldObserveDOMTimerScheduling(!hasVisibleChangeState());
         setIsBetweenTouchEndAndMouseMoved(false);
-        setShouldObserveDOMTimerScheduling(true);
         break;
     case Event::EndedMouseMovedEventDispatching:
         setShouldObserveDOMTimerScheduling(false);

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (242688 => 242689)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-10 18:10:43 UTC (rev 242688)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-10 20:08:54 UTC (rev 242689)
@@ -139,11 +139,8 @@
     void setIsBetweenTouchEndAndMouseMoved(bool isBetween) { m_isBetweenTouchEndAndMouseMoved = isBetween; }
     bool isBetweenTouchEndAndMouseMoved() const { return m_isBetweenTouchEndAndMouseMoved; }
 
-    bool hasPendingActivity() const { return hasObservedDOMTimer() || m_document.hasPendingStyleRecalc() || isObservationTimeWindowActive(); }
+    bool hasPendingActivity() const { return hasObservedDOMTimer() || m_isWaitingForStyleRecalc || isObservationTimeWindowActive(); }
     bool isObservationTimeWindowActive() const { return m_contentObservationTimer.isActive(); }
-#if !ASSERT_DISABLED
-    bool isNotifyContentChangeAllowed() const;
-#endif
 
     void completeDurationBasedContentObservation();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to