Changeset 251867 in webkit
- Timestamp:
- Oct 31, 2019 12:26:10 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251865 r251867 1 2019-10-31 Ryosuke Niwa <rniwa@webkit.org> 2 3 Integrate resize event with HTML5 event loop 4 https://bugs.webkit.org/show_bug.cgi?id=202964 5 6 Reviewed by Geoffrey Garen and Simon Fraser. 7 8 Added a regression test and fixed an existing test to work with the new behavior. 9 10 * fast/events/resize-subframe-in-rendering-update-expected.txt: Added. 11 * fast/events/resize-subframe-in-rendering-update.html: Added. 12 * fast/shadow-dom/trusted-event-scoped-flags.html: 13 1 14 2019-10-31 Truitt Savell <tsavell@apple.com> 2 15 -
trunk/LayoutTests/fast/shadow-dom/trusted-event-scoped-flags.html
r251567 r251867 111 111 112 112 iframe.onload = function () { 113 iframe.contentDocument.body.getBoundingClientRect(); 114 log(iframe.contentWindow, "resize"); 115 setTimeout(function () { 116 iframe.style.width = '200px'; 117 iframe.style.height = '200px'; 118 iframe.contentDocument.body.getBoundingClientRect(); 113 requestAnimationFrame(function () { 119 114 setTimeout(function () { 120 checkFlags('', {eventType: 'resize', composed: false}); 121 finishJSTest(); 115 iframe.contentDocument.body.getBoundingClientRect(); 116 log(iframe.contentWindow, "resize"); 117 iframe.style.width = '200px'; 118 iframe.style.height = '200px'; 119 iframe.contentDocument.body.getBoundingClientRect(); 120 requestAnimationFrame(function () { 121 checkFlags('', {eventType: 'resize', composed: false}); 122 finishJSTest(); 123 }); 122 124 }, 0); 123 } , 0);125 }); 124 126 } 125 127 -
trunk/Source/WebCore/ChangeLog
r251866 r251867 1 2019-10-31 Ryosuke Niwa <rniwa@webkit.org> 2 3 Integrate resize event with HTML5 event loop 4 https://bugs.webkit.org/show_bug.cgi?id=202964 5 6 Reviewed by Geoffrey Garen and Simon Fraser. 7 8 Dispatch resize events in "run the resize steps" during the "update the rendering": 9 https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering 10 11 Existing code in WebCore which was dispatching or scheduling dispatching of resize events now simply sets 12 a flag on document and schedules a rendering update. In Page::updateRendering, we fire resize events on 13 any documents with this flag set. 14 15 Test: fast/events/resize-subframe-in-rendering-update.html 16 17 * css/CSSFontSelector.cpp: 18 (WebCore::CSSFontSelector::beginLoadTimerFired): Fixed the flakiness in SVG animation tests observed 19 after this patch was landed previously. The issue was that this code was calling FrameLoader's 20 checkLoadComplete before checkCompleted. checkCompleted starts SVG animations in Document::implicitClose 21 whereas checkLoadComplete can cause DumpRenderTree to end the test. As a result, depending on when this 22 function was called relative to other work being done in the main thread, DumpRenderTree could prematurely 23 end and dump the test result even though SVG animation would have immediately started in either scenario. 24 Unfortunately I couldn't come up with a new deterministic test for this issue since the exact condition 25 under which this problem comes up seems quite racy (which makes sense given this only manifested as flaky 26 failures in existing tests). 27 * dom/Document.cpp: 28 (WebCore::Document::setNeedsDOMWindowResizeEvent): Added. 29 (WebCore::Document::setNeedsVisualViewportResize): Added. 30 (WebCore::Document::runResizeSteps): Added. https://drafts.csswg.org/cssom-view/#run-the-resize-steps 31 * dom/Document.h: 32 * page/FrameView.cpp: 33 (WebCore::FrameView::sendResizeEventIfNeeded): Now sets m_needsDOMWindowResizeEvent on Document instead of 34 enqueuing a resize event. 35 * page/Page.cpp: 36 (WebCore::Page::updateRendering): Call runResizeSteps on each document. 37 (WebCore::Page::collectDocuments): Added. 38 * page/Page.h: 39 * page/VisualViewport.cpp: 40 (WebCore::VisualViewport::enqueueResizeEvent): 41 1 42 2019-10-31 Jer Noble <jer.noble@apple.com> 2 43 -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r251508 r251867 398 398 cachedResourceLoader.decrementRequestCount(*fontHandle); 399 399 } 400 // FIXME: Use SubresourceLoader instead. 401 // Call FrameLoader::loadDone before FrameLoader::subresourceLoadDone to match the order in SubresourceLoader::notifyDone. 402 cachedResourceLoader.loadDone(LoadCompletionType::Finish); 400 403 // Ensure that if the request count reaches zero, the frame loader will know about it. 401 404 // New font loads may be triggered by layout after the document load is complete but before we have dispatched … … 403 406 if (m_document && m_document->frame()) 404 407 m_document->frame()->loader().checkLoadComplete(); 405 cachedResourceLoader.loadDone(LoadCompletionType::Finish);406 408 } 407 409 -
trunk/Source/WebCore/dom/Document.cpp
r251792 r251867 224 224 #include "VisibilityChangeClient.h" 225 225 #include "VisitedLinkState.h" 226 #include "VisualViewport.h" 226 227 #include "WebAnimation.h" 227 228 #include "WheelEvent.h" … … 3960 3961 } 3961 3962 3963 void Document::setNeedsDOMWindowResizeEvent() 3964 { 3965 m_needsDOMWindowResizeEvent = true; 3966 scheduleTimedRenderingUpdate(); 3967 } 3968 3969 void Document::setNeedsVisualViewportResize() 3970 { 3971 m_needsVisualViewportResizeEvent = true; 3972 scheduleTimedRenderingUpdate(); 3973 } 3974 3975 // https://drafts.csswg.org/cssom-view/#run-the-resize-steps 3976 void Document::runResizeSteps() 3977 { 3978 // FIXME: The order of dispatching is not specified: https://github.com/WICG/visual-viewport/issues/65. 3979 if (m_needsDOMWindowResizeEvent) { 3980 LOG_WITH_STREAM(Events, stream << "Document" << this << "sending resize events to window"); 3981 m_needsDOMWindowResizeEvent = false; 3982 dispatchWindowEvent(Event::create(eventNames().resizeEvent, Event::CanBubble::No, Event::IsCancelable::No)); 3983 } 3984 if (m_needsVisualViewportResizeEvent) { 3985 LOG_WITH_STREAM(Events, stream << "Document" << this << "sending resize events to visualViewport"); 3986 m_needsVisualViewportResizeEvent = false; 3987 if (auto* window = domWindow()) 3988 window->visualViewport().dispatchEvent(Event::create(eventNames().resizeEvent, Event::CanBubble::No, Event::IsCancelable::No)); 3989 } 3990 } 3991 3962 3992 void Document::addAudioProducer(MediaProducer& audioProducer) 3963 3993 { -
trunk/Source/WebCore/dom/Document.h
r251792 r251867 1361 1361 void updateViewportUnitsOnResize(); 1362 1362 1363 void setNeedsDOMWindowResizeEvent(); 1364 void setNeedsVisualViewportResize(); 1365 void runResizeSteps(); 1366 1363 1367 WEBCORE_EXPORT void addAudioProducer(MediaProducer&); 1364 1368 WEBCORE_EXPORT void removeAudioProducer(MediaProducer&); … … 2014 2018 2015 2019 bool m_hasStyleWithViewportUnits { false }; 2020 bool m_needsDOMWindowResizeEvent { false }; 2021 bool m_needsVisualViewportResizeEvent { false }; 2016 2022 bool m_isTimerThrottlingEnabled { false }; 2017 2023 bool m_isSuspended { false }; -
trunk/Source/WebCore/page/FrameView.cpp
r251640 r251867 3423 3423 #endif 3424 3424 3425 LOG_WITH_STREAM(Events, stream << "FrameView" << this << "sendResizeEventIfNeeded scheduling resize event for document" << frame().document() << ", size " << currentSize); 3426 frame().document()->setNeedsDOMWindowResizeEvent(); 3427 3425 3428 bool isMainFrame = frame().isMainFrame(); 3426 bool canSendResizeEventSynchronously = isMainFrame && !m_shouldAutoSize;3427 3428 LOG(Events, "FrameView %p sendResizeEventIfNeeded sending resize event, size %dx%d (canSendResizeEventSynchronously %d)", this, currentSize.width(), currentSize.height(), canSendResizeEventSynchronously);3429 3430 Ref<Event> resizeEvent = Event::create(eventNames().resizeEvent, Event::CanBubble::No, Event::IsCancelable::No);3431 if (canSendResizeEventSynchronously)3432 frame().document()->dispatchWindowEvent(resizeEvent);3433 else {3434 // FIXME: Queueing this event for an unpredictable time in the future seems3435 // intrinsically racy. By the time this resize event fires, the frame might3436 // be resized again, so we could end up with two resize events for the same size.3437 frame().document()->enqueueWindowEvent(WTFMove(resizeEvent));3438 }3439 3440 3429 if (InspectorInstrumentation::hasFrontends() && isMainFrame) { 3441 3430 if (Page* page = frame().page()) { -
trunk/Source/WebCore/page/Page.cpp
r251737 r251867 1295 1295 SetForScope<bool> change(m_inUpdateRendering, true); 1296 1296 1297 Vector<RefPtr<Document>> documents; 1298 1299 // The requestAnimationFrame callbacks may change the frame hierarchy of the page 1300 forEachDocument([&documents] (Document& document) { 1301 documents.append(&document); 1297 layoutIfNeeded(); 1298 1299 forEachDocument([&] (Document& document) { 1300 document.runResizeSteps(); 1302 1301 }); 1303 1302 1304 // FIXME: Run the resize steps1305 1306 1303 // FIXME: Run the scroll steps 1307 1304 1308 1305 // FIXME: Evaluate media queries and report changes. 1309 1306 1307 Vector<Ref<Document>> documents = collectDocuments(); // The requestAnimationFrame callbacks may change the frame hierarchy of the page 1310 1308 for (auto& document : documents) { 1311 1309 DOMHighResTimeStamp timestamp = document->domWindow()->nowTimestamp();
Note: See TracChangeset
for help on using the changeset viewer.