[ContentChangeObserver] Stop content change observation explicitly.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2019 19:47:23 +0000 (19:47 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2019 19:47:23 +0000 (19:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200689
<rdar://problem/54274887>

Reviewed by Simon Fraser.

Source/WebCore:

This helps to clean up some temporary state. There are 2 exit points when content observation needs to stop.
1. Soon after the synthetic mouseMove event when we decide not to continue with further observation (see WebPage::handleSyntheticClick)
2. When we asynchronously notify the client about the visible content change after all pending events have been processed.

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::stopContentObservation):
(WebCore::ContentChangeObserver::adjustObservedState):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::stopContentObservation const):
(WebCore::ContentChangeObserver::isObservingContentChanges const):
(WebCore::ContentChangeObserver::observedContentChange const): Deleted.

Source/WebKit:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248685 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/ios/ContentChangeObserver.cpp
Source/WebCore/page/ios/ContentChangeObserver.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

index ba70686..0e8919d 100644 (file)
@@ -1,3 +1,23 @@
+2019-08-14  Zalan Bujtas  <zalan@apple.com>
+
+        [ContentChangeObserver] Stop content change observation explicitly.
+        https://bugs.webkit.org/show_bug.cgi?id=200689
+        <rdar://problem/54274887>
+
+        Reviewed by Simon Fraser.
+
+        This helps to clean up some temporary state. There are 2 exit points when content observation needs to stop.
+        1. Soon after the synthetic mouseMove event when we decide not to continue with further observation (see WebPage::handleSyntheticClick)
+        2. When we asynchronously notify the client about the visible content change after all pending events have been processed.
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::stopContentObservation):
+        (WebCore::ContentChangeObserver::adjustObservedState):
+        * page/ios/ContentChangeObserver.h:
+        (WebCore::ContentChangeObserver::stopContentObservation const):
+        (WebCore::ContentChangeObserver::isObservingContentChanges const):
+        (WebCore::ContentChangeObserver::observedContentChange const): Deleted.
+
 2019-08-14  Youenn Fablet  <youenn@apple.com>
 
         Update Worker::notifyFinished to not use emptySessionID
index 1afd857..8146289 100644 (file)
@@ -372,6 +372,11 @@ void ContentChangeObserver::stopObservingPendingActivities()
     clearObservedTransitions();
 }
 
+void ContentChangeObserver::stopContentObservation()
+{
+    reset();
+}
+
 void ContentChangeObserver::reset()
 {
     stopObservingPendingActivities();
@@ -519,6 +524,7 @@ void ContentChangeObserver::adjustObservedState(Event event)
         ASSERT(m_document.page());
         ASSERT(m_document.frame());
         m_document.page()->chrome().client().didFinishContentChangeObserving(*m_document.frame(), observedContentChange());
+        stopContentObservation();
     };
 
     // These user initiated events trigger content observation (touchStart and mouseMove). 
index 65aae81..af17a3d 100644 (file)
@@ -48,6 +48,7 @@ public:
     ContentChangeObserver(Document&);
 
     WEBCORE_EXPORT void startContentObservationForDuration(Seconds duration);
+    WEBCORE_EXPORT void stopContentObservation();
     WKContentChange observedContentChange() const { return m_observedContentState; }
     WEBCORE_EXPORT static bool isConsideredVisible(const Node&);
     static bool isVisuallyHidden(const Node&);
@@ -229,7 +230,7 @@ inline bool ContentChangeObserver::isObservingContentChanges() const
         || m_mouseMovedEventIsBeingDispatched
         || m_observedDomTimerIsBeingExecuted
         || m_isInObservedStyleRecalc
-        || m_contentObservationTimer.isActive();
+        || isObservationTimeWindowActive();
 }
 
 inline void ContentChangeObserver::setShouldObserveDOMTimerSchedulingAndTransitions(bool observe)
index 54b7977..469900d 100644 (file)
@@ -1,3 +1,14 @@
+2019-08-14  Zalan Bujtas  <zalan@apple.com>
+
+        [ContentChangeObserver] Stop content change observation explicitly.
+        https://bugs.webkit.org/show_bug.cgi?id=200689
+        <rdar://problem/54274887>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleSyntheticClick):
+
 2019-08-14  Youenn Fablet  <youenn@apple.com>
 
         Remove use of emptySessionID from NetworkLoadParameters
index e4c6427..8c43406 100644 (file)
@@ -716,7 +716,7 @@ void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::F
         m_pendingSyntheticClickPointerId = pointerId;
         return;
     }
-
+    contentChangeObserver.stopContentObservation();
     callOnMainThread([protectedThis = makeRefPtr(this), targetNode = Ref<Node>(nodeRespondingToClick), location, modifiers, observedContentChange, pointerId] {
         if (protectedThis->m_isClosed || !protectedThis->corePage())
             return;