Unreviewed, rolling out r242210.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2019 19:58:11 +0000 (19:58 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2019 19:58:11 +0000 (19:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195179

it broke hover menus on losaltosonline.com (Requested by zalan
on #webkit).

Reverted changeset:

"[ContentChangeObserver] Move timer removal code from
DOMWindow::clearTimeout to DOMTimer::removeById"
https://bugs.webkit.org/show_bug.cgi?id=195143
https://trac.webkit.org/changeset/242210

Patch by Commit Queue <commit-queue@webkit.org> on 2019-02-28

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

Source/WebCore/ChangeLog
Source/WebCore/page/DOMTimer.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/ios/ContentChangeObserver.cpp
Source/WebCore/page/ios/ContentChangeObserver.h

index aca92d8..bcaf68d 100644 (file)
@@ -1,3 +1,18 @@
+2019-02-28  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r242210.
+        https://bugs.webkit.org/show_bug.cgi?id=195179
+
+        it broke hover menus on losaltosonline.com (Requested by zalan
+        on #webkit).
+
+        Reverted changeset:
+
+        "[ContentChangeObserver] Move timer removal code from
+        DOMWindow::clearTimeout to DOMTimer::removeById"
+        https://bugs.webkit.org/show_bug.cgi?id=195143
+        https://trac.webkit.org/changeset/242210
+
 2019-02-28  Zalan Bujtas  <zalan@apple.com>
 
         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
index 0d89fe7..7737e7c 100644 (file)
@@ -236,14 +236,6 @@ void DOMTimer::removeById(ScriptExecutionContext& context, int timeoutId)
     if (timeoutId <= 0)
         return;
 
-#if PLATFORM(IOS_FAMILY)
-    if (is<Document>(context) && downcast<Document>(context).page()) {
-        auto& document = downcast<Document>(context);
-        if (auto* timer = document.findTimeout(timeoutId))
-            document.page()->contentChangeObserver().didRemoveDOMTimer(*timer);
-    }
-#endif
-
     if (NestedTimersMap* nestedTimers = NestedTimersMap::instanceForContext(context))
         nestedTimers->remove(timeoutId);
 
index dfa1124..a9116d2 100644 (file)
 #include "PointerLockController.h"
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+#include "ContentChangeObserver.h"
+#endif
+
 namespace WebCore {
 using namespace Inspector;
 
@@ -1679,6 +1683,18 @@ ExceptionOr<int> DOMWindow::setTimeout(JSC::ExecState& state, std::unique_ptr<Sc
 
 void DOMWindow::clearTimeout(int timeoutId)
 {
+#if PLATFORM(IOS_FAMILY)
+    auto handleObservedTimerCancelIfNeeded = [&] {
+        if (!frame() || !frame()->document() || !frame()->document()->page())
+            return;
+        if (timeoutId <= 0)
+            return;
+        auto& document = *frame()->document();
+        if (auto* timer = document.findTimeout(timeoutId))
+            document.page()->contentChangeObserver().removeDOMTimer(*timer);
+    };
+    handleObservedTimerCancelIfNeeded();
+#endif
     ScriptExecutionContext* context = scriptExecutionContext();
     if (!context)
         return;
index 9c377e0..46f86f8 100644 (file)
@@ -117,7 +117,7 @@ void ContentChangeObserver::stopObservingStyleResolve()
     m_page.chrome().client().observedContentChange(m_page.mainFrame());
 }
 
-void ContentChangeObserver::didRemoveDOMTimer(const DOMTimer& timer)
+void ContentChangeObserver::removeDOMTimer(const DOMTimer& timer)
 {
     if (!containsObservedDOMTimer(timer))
         return;
index 72dd35a..d6795df 100644 (file)
@@ -39,7 +39,7 @@ public:
     ContentChangeObserver(Page&);
 
     void didInstallDOMTimer(const DOMTimer&, Seconds timeout, bool singleShot);
-    void didRemoveDOMTimer(const DOMTimer&);
+    void removeDOMTimer(const DOMTimer&);
     void startObservingDOMTimerExecute(const DOMTimer&);
     void stopObservingDOMTimerExecute(const DOMTimer&);