[ContentChangeObserver] clearContentChangeObservers should be internal to ContentChan...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 22:31:07 +0000 (22:31 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 22:31:07 +0000 (22:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195066
<rdar://problem/48411682>

Reviewed by Tim Horton.

Source/WebCore:

Now all the empty clearContentChangeObservers() implementations can be removed.

* dom/Document.cpp:
(WebCore::Document::platformSuspendOrStopActiveDOMObjects):
* loader/EmptyClients.h:
* page/ChromeClient.h:
* page/Frame.cpp:
(WebCore::Frame::willDetachPage):
* page/ios/ContentChangeObserver.h:
* page/ios/ContentChangeObserver.mm:
(WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
(WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
(WebCore::ContentChangeObserver::willDetachPage):

Source/WebKit:

* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::clearContentChangeObservers): Deleted.

Source/WebKitLegacy/ios:

* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::clearContentChangeObservers): Deleted.

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/Frame.cpp
Source/WebCore/page/ios/ContentChangeObserver.h
Source/WebCore/page/ios/ContentChangeObserver.mm
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h
Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm

index c833cfa..ea22734 100644 (file)
@@ -1,5 +1,27 @@
 2019-02-26  Zalan Bujtas  <zalan@apple.com>
 
+        [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
+        https://bugs.webkit.org/show_bug.cgi?id=195066
+        <rdar://problem/48411682>
+
+        Reviewed by Tim Horton.
+
+        Now all the empty clearContentChangeObservers() implementations can be removed.
+
+        * dom/Document.cpp:
+        (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
+        * loader/EmptyClients.h:
+        * page/ChromeClient.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::willDetachPage):
+        * page/ios/ContentChangeObserver.h:
+        * page/ios/ContentChangeObserver.mm:
+        (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
+        (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
+        (WebCore::ContentChangeObserver::willDetachPage):
+
+2019-02-26  Zalan Bujtas  <zalan@apple.com>
+
         [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
         https://bugs.webkit.org/show_bug.cgi?id=195062
         <rdar://problem/48409258>
index 5d32070..a79f681 100644 (file)
@@ -2631,13 +2631,8 @@ bool Document::shouldBypassMainWorldContentSecurityPolicy() const
 void Document::platformSuspendOrStopActiveDOMObjects()
 {
 #if PLATFORM(IOS_FAMILY)
-    if (!page() || !frame())
-        return;
-    auto& page = *this->page();
-    if (!page.contentChangeObserver().countOfObservedDOMTimers())
-        return;
-    LOG_WITH_STREAM(ContentObservation, stream << "Document::platformSuspendOrStopActiveDOMObjects: remove registered timers.");
-    page.chrome().client().clearContentChangeObservers(*frame());
+    if (auto* page = this->page())
+        page->contentChangeObserver().didSuspendActiveDOMObjects();
 #endif
 }
 
index 3338b6d..d794efb 100644 (file)
@@ -166,7 +166,6 @@ class EmptyChromeClient : public ChromeClient {
     void didReceiveMobileDocType(bool) final { }
     void setNeedsScrollNotifications(Frame&, bool) final { }
     void observedContentChange(Frame&) final { }
-    void clearContentChangeObservers(Frame&) final { }
     void notifyRevealedSelectionByScrollingFrame(Frame&) final { }
     void didLayout(LayoutType) final { }
     void didStartOverflowScroll() final { }
index 8d6f1d5..3a0dc3b 100644 (file)
@@ -242,7 +242,6 @@ public:
     virtual void didReceiveMobileDocType(bool) = 0;
     virtual void setNeedsScrollNotifications(Frame&, bool) = 0;
     virtual void observedContentChange(Frame&) = 0;
-    virtual void clearContentChangeObservers(Frame&) = 0;
     virtual void notifyRevealedSelectionByScrollingFrame(Frame&) = 0;
 
     enum LayoutType { NormalLayout, Scroll };
index 6e74ec7..6784380 100644 (file)
@@ -838,10 +838,8 @@ void Frame::willDetachPage()
         page()->scrollingCoordinator()->willDestroyScrollableArea(*m_view);
 
 #if PLATFORM(IOS_FAMILY)
-    if (page() && page()->contentChangeObserver().countOfObservedDOMTimers()) {
-        LOG(ContentObservation, "Frame::willDetachPage: remove registered timers.");
-        m_page->chrome().client().clearContentChangeObservers(*this);
-    }
+    if (auto* page = this->page())
+        page->contentChangeObserver().willDetachPage();
 #endif
 
     script().clearScriptObjects();
index e9dc9d0..fbc57b5 100644 (file)
@@ -47,14 +47,14 @@ public:
     void startObservingStyleResolve();
     void stopObservingStyleResolve();
 
+    void didSuspendActiveDOMObjects();
+    void willDetachPage();
+
     WEBCORE_EXPORT void startObservingContentChanges();
     WEBCORE_EXPORT void stopObservingContentChanges();
 
     WEBCORE_EXPORT WKContentChange observedContentChange();
 
-    WEBCORE_EXPORT unsigned countOfObservedDOMTimers();
-    WEBCORE_EXPORT void clearObservedDOMTimers();
-
     class StyleChange {
     public:
         StyleChange(const Element&, ContentChangeObserver&);
@@ -88,6 +88,11 @@ private:
 
     void setObservedContentChange(WKContentChange);
 
+    unsigned countOfObservedDOMTimers();
+    void clearObservedDOMTimers();
+
+    void clearTimersAndReportContentChange();
+
     Page& m_page;
 };
 
index 6223f7d..4db5b5f 100644 (file)
@@ -128,6 +128,25 @@ void ContentChangeObserver::removeDOMTimer(const DOMTimer& timer)
     m_page.chrome().client().observedContentChange(m_page.mainFrame());
 }
 
+void ContentChangeObserver::clearTimersAndReportContentChange()
+{
+    if (!countOfObservedDOMTimers())
+        return;
+    LOG(ContentObservation, "clearTimersAndReportContentChange: remove registered timers and report content change.");
+    clearObservedDOMTimers();
+    m_page.chrome().client().observedContentChange(m_page.mainFrame());
+}
+
+void ContentChangeObserver::didSuspendActiveDOMObjects()
+{
+    clearTimersAndReportContentChange();
+}
+
+void ContentChangeObserver::willDetachPage()
+{
+    clearTimersAndReportContentChange();
+}
+
 void ContentChangeObserver::startObservingContentChanges()
 {
     startObservingDOMTimerScheduling();
index 9d935a8..4c1e5ad 100644 (file)
@@ -1,3 +1,15 @@
+2019-02-26  Zalan Bujtas  <zalan@apple.com>
+
+        [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
+        https://bugs.webkit.org/show_bug.cgi?id=195066
+        <rdar://problem/48411682>
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::clearContentChangeObservers): Deleted.
+
 2019-02-26  Per Arne Vollan  <pvollan@apple.com>
 
         [iOS] Sandbox should allow mach lookups related to media capturing
index 91e6da2..f926a25 100644 (file)
@@ -156,7 +156,6 @@ private:
     void didReceiveMobileDocType(bool) final;
     void setNeedsScrollNotifications(WebCore::Frame&, bool) final;
     void observedContentChange(WebCore::Frame&) final;
-    void clearContentChangeObservers(WebCore::Frame&) final;
     void notifyRevealedSelectionByScrollingFrame(WebCore::Frame&) final;
     bool isStopping() final;
 
index f7f4e93..90327cc 100644 (file)
@@ -68,11 +68,6 @@ void WebChromeClient::observedContentChange(WebCore::Frame&)
     m_page.completePendingSyntheticClickForContentChangeObserver();
 }
 
-void WebChromeClient::clearContentChangeObservers(WebCore::Frame&)
-{
-    notImplemented();
-}
-
 void WebChromeClient::notifyRevealedSelectionByScrollingFrame(WebCore::Frame&)
 {
     m_page.didChangeSelection();
index 1543611..0a0fba3 100644 (file)
@@ -1,3 +1,15 @@
+2019-02-26  Zalan Bujtas  <zalan@apple.com>
+
+        [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
+        https://bugs.webkit.org/show_bug.cgi?id=195066
+        <rdar://problem/48411682>
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (WebChromeClientIOS::clearContentChangeObservers): Deleted.
+
 2019-02-24  Zalan Bujtas  <zalan@apple.com>
 
         Introduce ContentChangeObserver class
index 7f1aa7a..127633e 100644 (file)
@@ -56,7 +56,6 @@ private:
     void didReceiveMobileDocType(bool) final;
     void setNeedsScrollNotifications(WebCore::Frame&, bool) final;
     void observedContentChange(WebCore::Frame&) final;
-    void clearContentChangeObservers(WebCore::Frame&) final;
     WebCore::FloatSize screenSize() const final;
     WebCore::FloatSize availableScreenSize() const final;
     WebCore::FloatSize overrideScreenSize() const final;
index 9e52eb6..88ccec9 100644 (file)
@@ -189,18 +189,6 @@ void WebChromeClientIOS::observedContentChange(WebCore::Frame& frame)
     [[webView() _UIKitDelegateForwarder] webView:webView() didObserveDeferredContentChange:frame.page()->contentChangeObserver().observedContentChange() forFrame:kit(&frame)];
 }
 
-void WebChromeClientIOS::clearContentChangeObservers(WebCore::Frame& frame)
-{
-    if (!frame.page())
-        return;
-    auto& contentChangeObserver = frame.page()->contentChangeObserver();
-    ASSERT(contentChangeObserver.countOfObservedDOMTimers());
-    if (!contentChangeObserver.countOfObservedDOMTimers())
-        return;
-    contentChangeObserver.clearObservedDOMTimers();
-    observedContentChange(frame);
-}
-
 static inline NSString *nameForViewportFitValue(ViewportFit value)
 {
     switch (value) {