Title: [295316] branches/safari-613-branch/Source/WebCore
- Revision
- 295316
- Author
- [email protected]
- Date
- 2022-06-06 19:30:09 -0700 (Mon, 06 Jun 2022)
Log Message
Cherry-pick 694fbb13c1b6. rdar://problem/92081556
afterprint event should be scheduled on event loop
https://bugs.webkit.org/show_bug.cgi?id=239883
Patch by Alex Christensen <[email protected]> on 2022-04-28
Reviewed by Chris Dumez.
* page/Page.cpp:
(WebCore::dispatchPrintEvent):
(WebCore::Page::dispatchBeforePrintEvent):
(WebCore::Page::dispatchAfterPrintEvent):
Canonical link: https://commits.webkit.org/250112@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (295315 => 295316)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-06-07 02:30:06 UTC (rev 295315)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-06-07 02:30:09 UTC (rev 295316)
@@ -1,3 +1,15 @@
+2022-04-28 Alex Christensen <[email protected]>
+
+ afterprint event should be scheduled on event loop
+ https://bugs.webkit.org/show_bug.cgi?id=239883
+
+ Reviewed by Chris Dumez.
+
+ * page/Page.cpp:
+ (WebCore::dispatchPrintEvent):
+ (WebCore::Page::dispatchBeforePrintEvent):
+ (WebCore::Page::dispatchAfterPrintEvent):
+
2022-04-28 Patrick Griffis <[email protected]>
CSP: Fix mixing strict-dynamic and unsafe-inline policies
Modified: branches/safari-613-branch/Source/WebCore/page/Page.cpp (295315 => 295316)
--- branches/safari-613-branch/Source/WebCore/page/Page.cpp 2022-06-07 02:30:06 UTC (rev 295315)
+++ branches/safari-613-branch/Source/WebCore/page/Page.cpp 2022-06-07 02:30:09 UTC (rev 295316)
@@ -3518,7 +3518,8 @@
}
#endif // ENABLE(WHEEL_EVENT_LATCHING)
-static void dispatchPrintEvent(Frame& mainFrame, const AtomString& eventType)
+enum class DispatchedOnDocumentEventLoop : bool { No, Yes };
+static void dispatchPrintEvent(Frame& mainFrame, const AtomString& eventType, DispatchedOnDocumentEventLoop dispatchedOnDocumentEventLoop)
{
Vector<Ref<Frame>> frames;
for (auto* frame = &mainFrame; frame; frame = frame->tree().traverseNext())
@@ -3525,19 +3526,26 @@
frames.append(*frame);
for (auto& frame : frames) {
- if (auto* window = frame->window())
- window->dispatchEvent(Event::create(eventType, Event::CanBubble::No, Event::IsCancelable::No), window->document());
+ if (RefPtr window = frame->window()) {
+ auto dispatchEvent = [window = WTFMove(window), eventType] {
+ window->dispatchEvent(Event::create(eventType, Event::CanBubble::No, Event::IsCancelable::No), window->document());
+ };
+ if (dispatchedOnDocumentEventLoop == DispatchedOnDocumentEventLoop::No)
+ return dispatchEvent();
+ if (auto* document = frame->document())
+ document->eventLoop().queueTask(TaskSource::DOMManipulation, WTFMove(dispatchEvent));
+ }
}
}
void Page::dispatchBeforePrintEvent()
{
- dispatchPrintEvent(m_mainFrame, eventNames().beforeprintEvent);
+ dispatchPrintEvent(m_mainFrame, eventNames().beforeprintEvent, DispatchedOnDocumentEventLoop::No);
}
void Page::dispatchAfterPrintEvent()
{
- dispatchPrintEvent(m_mainFrame, eventNames().afterprintEvent);
+ dispatchPrintEvent(m_mainFrame, eventNames().afterprintEvent, DispatchedOnDocumentEventLoop::Yes);
}
#if ENABLE(APPLE_PAY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes