Unreviewed, reverting r261252.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2020 02:14:33 +0000 (02:14 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2020 02:14:33 +0000 (02:14 +0000)
Reland r260684 now that a proper fix has landed in Reader

Reverted changeset:

"REGRESSION (r260684): Reader background is lost after
multitasking"
https://bugs.webkit.org/show_bug.cgi?id=211533
https://trac.webkit.org/changeset/261252

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

Source/WebCore/ChangeLog
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Page.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/WKApplicationStateTrackingView.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in

index 4b51fc7..5e88555 100644 (file)
@@ -1,3 +1,16 @@
+2020-05-07  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, reverting r261252.
+
+        Reland r260684 now that a proper fix has landed in Reader
+
+        Reverted changeset:
+
+        "REGRESSION (r260684): Reader background is lost after
+        multitasking"
+        https://bugs.webkit.org/show_bug.cgi?id=211533
+        https://trac.webkit.org/changeset/261252
+
 2020-05-07  Pinki Gyanchandani  <pgyanchandani@apple.com>
 
         SIGILL @ WebCore::Shape::createRasterShape -- DOS ASAN
index 1b14db2..b40f2b0 100644 (file)
@@ -40,6 +40,7 @@
 #include "InspectorInstrumentation.h"
 #include "JSEventListener.h"
 #include "JSLazyEventListener.h"
+#include "Logging.h"
 #include "Quirks.h"
 #include "ScriptController.h"
 #include "ScriptDisallowedScope.h"
@@ -251,6 +252,15 @@ void EventTarget::fireEventListeners(Event& event, EventInvokePhase phase)
     if (!data)
         return;
 
+    // FIXME: Remove once <rdar://problem/62344280> is fixed.
+    if (is<Document>(scriptExecutionContext())) {
+        auto* page = downcast<Document>(*scriptExecutionContext()).page();
+        if (page && !page->shouldFireEvents()) {
+            RELEASE_LOG_IF(page->isAlwaysOnLoggingAllowed(), Events, "%p - EventTarget::fireEventListeners: Not firing %{public}s event because events are temporarily disabled for this page", this, event.type().string().utf8().data());
+            return;
+        }
+    }
+
     SetForScope<bool> firingEventListenersScope(data->isFiringEventListeners, true);
 
     if (auto* listenersVector = data->eventListenerMap.find(event.type())) {
index 94bb2b4..9049bbe 100644 (file)
@@ -3376,11 +3376,6 @@ void FrameView::sendResizeEventIfNeeded()
     }
 #endif
 
-    if (page && !page->shouldFireResizeEvents()) {
-        FRAMEVIEW_RELEASE_LOG_IF_ALLOWED(Events, "sendResizeEventIfNeeded: Not firing resize events because they are temporarily disabled for this page");
-        return;
-    }
-
     LOG_WITH_STREAM(Events, stream << "FrameView" << this << "sendResizeEventIfNeeded scheduling resize event for document" << frame().document() << ", size " << currentSize);
     frame().document()->setNeedsDOMWindowResizeEvent();
 
index 81d26a5..0a9813a 100644 (file)
@@ -750,8 +750,8 @@ public:
     WEBCORE_EXPORT void injectUserStyleSheet(UserStyleSheet&);
     WEBCORE_EXPORT void removeInjectedUserStyleSheet(UserStyleSheet&);
 
-    bool shouldFireResizeEvents() const { return m_shouldFireResizeEvents; }
-    void setShouldFireResizeEvents(bool shouldFireResizeEvents) { m_shouldFireResizeEvents = shouldFireResizeEvents; }
+    bool shouldFireEvents() const { return m_shouldFireEvents; }
+    void setShouldFireEvents(bool shouldFireEvents) { m_shouldFireEvents = shouldFireEvents; }
 
     bool hasBeenNotifiedToInjectUserScripts() const { return m_hasBeenNotifiedToInjectUserScripts; }
     WEBCORE_EXPORT void notifyToInjectUserScripts();
@@ -1042,7 +1042,7 @@ private:
 
     Vector<UserContentURLPattern> m_corsDisablingPatterns;
     Vector<UserStyleSheet> m_userStyleSheetsPendingInjection;
-    bool m_shouldFireResizeEvents { true };
+    bool m_shouldFireEvents { true };
     bool m_loadsSubresources { true };
     bool m_loadsFromNetwork { true };
     bool m_hasBeenNotifiedToInjectUserScripts { false };
index 0973795..27eaeb9 100644 (file)
@@ -1,3 +1,16 @@
+2020-05-07  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, reverting r261252.
+
+        Reland r260684 now that a proper fix has landed in Reader
+
+        Reverted changeset:
+
+        "REGRESSION (r260684): Reader background is lost after
+        multitasking"
+        https://bugs.webkit.org/show_bug.cgi?id=211533
+        https://trac.webkit.org/changeset/261252
+
 2020-05-07  Megan Gardner  <megan_gardner@apple.com>
 
         Build Fix for MacCatalyst
index eebfba4..337a8f0 100644 (file)
@@ -10121,9 +10121,9 @@ void WebPageProxy::setOverriddenMediaType(const String& mediaType)
     send(Messages::WebPage::SetOverriddenMediaType(mediaType));
 }
 
-void WebPageProxy::setShouldFireResizeEvents(bool shouldFireResizeEvents)
+void WebPageProxy::setShouldFireEvents(bool shouldFireEvents)
 {
-    send(Messages::WebPage::SetShouldFireResizeEvents(shouldFireResizeEvents));
+    send(Messages::WebPage::SetShouldFireEvents(shouldFireEvents));
 }
 
 void WebPageProxy::setNeedsDOMWindowResizeEvent()
index acf3493..3b9edc9 100644 (file)
@@ -1738,7 +1738,7 @@ public:
     void grantAccessToPreferenceService();
 #endif
 
-    void setShouldFireResizeEvents(bool);
+    void setShouldFireEvents(bool);
     void setNeedsDOMWindowResizeEvent();
 
     void isNavigatingToAppBoundDomainTesting(CompletionHandler<void(bool)>&&);
index 37adf73..5b6b077 100644 (file)
     if (!page)
         return;
 
-    page->setShouldFireResizeEvents(false);
+    page->setShouldFireEvents(false);
 }
 
 - (void)_didCompleteSnapshotSequence
     if (!page)
         return;
 
-    page->setShouldFireResizeEvents(true);
+    page->setShouldFireEvents(true);
 }
 
 - (BOOL)isBackground
index 62cb38f..0080b0d 100644 (file)
@@ -3313,12 +3313,12 @@ void WebPage::show()
     send(Messages::WebPageProxy::ShowPage());
 }
 
-void WebPage::setShouldFireResizeEvents(bool shouldFireResizeEvents)
+void WebPage::setShouldFireEvents(bool shouldFireEvents)
 {
-    RELEASE_LOG_IF_ALLOWED(Resize, "setShouldFireResizeEvents(%d)", shouldFireResizeEvents);
+    RELEASE_LOG_IF_ALLOWED(Resize, "setShouldFireEvents(%d)", shouldFireEvents);
 
     if (m_page)
-        m_page->setShouldFireResizeEvents(shouldFireResizeEvents);
+        m_page->setShouldFireEvents(shouldFireEvents);
 }
 
 void WebPage::setNeedsDOMWindowResizeEvent()
index 24c9cc7..c08c76b 100644 (file)
@@ -1702,7 +1702,7 @@ private:
     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::SharedBufferDataReference&);
     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
 
-    void setShouldFireResizeEvents(bool);
+    void setShouldFireEvents(bool);
     void setNeedsDOMWindowResizeEvent();
 
     void setIsSuspended(bool);
index fdbd17d..c8c162b 100644 (file)
@@ -603,7 +603,7 @@ GenerateSyntheticEditingCommand(enum:uint8_t WebKit::SyntheticEditingCommandType
 
     UpdateCORSDisablingPatterns(Vector<String> patterns)
 
-    SetShouldFireResizeEvents(bool shouldFireResizeEvents)
+    SetShouldFireEvents(bool shouldFireEvents)
     SetNeedsDOMWindowResizeEvent()
 
     SetHasResourceLoadClient(bool has)