Changeset 267688 in webkit
- Timestamp:
- Sep 27, 2020, 5:23:07 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/Page.cpp (modified) (6 diffs)
-
WebCore/page/Page.h (modified) (4 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebView.mm (modified) (3 diffs)
-
WebKitLegacy/win/ChangeLog (modified) (1 diff)
-
WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp (modified) (1 diff)
-
WebKitLegacy/win/WebView.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267666 r267688 1 2020-09-24 Simon Fraser <simon.fraser@apple.com> 2 3 WebKitLegacy should call Page::finalizeRenderingUpdate() 4 https://bugs.webkit.org/show_bug.cgi?id=216958 5 6 Reviewed by Tim Horton. 7 8 Convert Page::m_inUpdateRendering to an enum which tracks the phase, which will be 9 used in a later patch to prevent extra update scheduling (webkit.org/b/216726). 10 Page has to track RenderingUpdatePhase as a stack to handle the re-entrancy when layout tests 11 call notifyDone() inside of the JS callbacks; the stack only has one entry outside of testing. 12 13 Add isolatedUpdateRendering(), which is for callers who aren't going to call finalizeRenderingUpdate(), 14 and use it for SVGImage updates. 15 16 * page/Page.cpp: 17 (WebCore::Page::updateRendering): 18 (WebCore::Page::isolatedUpdateRendering): 19 (WebCore::Page::doAfterUpdateRendering): 20 (WebCore::Page::finalizeRenderingUpdate): 21 * page/Page.h: 22 1 23 2020-09-27 Zalan Bujtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/page/Page.cpp
r267611 r267688 1442 1442 void Page::updateRendering() 1443 1443 { 1444 // This function is not reentrant, e.g. a rAF callback may force repaint. 1445 if (m_inUpdateRendering) { 1444 m_updateRenderingPhaseStack.append(RenderingUpdatePhase::InUpdateRendering); 1445 1446 // This function is not reentrant, e.g. a rAF callback may trigger a forces repaint in testing. 1447 // This is why we track updateRenderingPhase as a stack. 1448 if (m_updateRenderingPhaseStack.size() > 1) { 1446 1449 layoutIfNeeded(); 1447 1450 return; 1448 1451 } 1449 1452 1450 SetForScope<bool> inUpdateRendering(m_inUpdateRendering, true);1451 1453 m_lastRenderingUpdateTimestamp = MonotonicTime::now(); 1452 1454 … … 1510 1512 for (auto& image : document.cachedResourceLoader().allCachedSVGImages()) { 1511 1513 if (auto* page = image->internalPage()) 1512 page-> updateRendering();1514 page->isolatedUpdateRendering(); 1513 1515 } 1514 1516 }); 1517 1518 ASSERT(m_updateRenderingPhaseStack.last() == RenderingUpdatePhase::InUpdateRendering); 1515 1519 1516 1520 for (auto& document : initialDocuments) { … … 1530 1534 if (!isSVGImagePage) 1531 1535 tracePoint(RenderingUpdateEnd); 1536 1537 ASSERT(m_updateRenderingPhaseStack.last() == RenderingUpdatePhase::InUpdateRendering); 1538 } 1539 1540 void Page::isolatedUpdateRendering() 1541 { 1542 updateRendering(); 1543 m_updateRenderingPhaseStack.removeLast(); 1532 1544 } 1533 1545 1534 1546 void Page::doAfterUpdateRendering() 1535 1547 { 1548 ASSERT(m_updateRenderingPhaseStack.last() == RenderingUpdatePhase::InUpdateRendering); 1549 1536 1550 // Code here should do once-per-frame work that needs to be done before painting, and requires 1537 1551 // layout to be up-to-date. It should not run script, trigger layout, or dirty layout. … … 1587 1601 } 1588 1602 #endif 1603 1604 ASSERT(m_updateRenderingPhaseStack.last() == RenderingUpdatePhase::InUpdateRendering); 1589 1605 } 1590 1606 1591 1607 void Page::finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags> flags) 1592 1608 { 1609 ASSERT(m_updateRenderingPhaseStack.last() == RenderingUpdatePhase::InUpdateRendering); 1610 1593 1611 auto* view = mainFrame().view(); 1594 1612 if (!view) … … 1598 1616 view->invalidateImagesWithAsyncDecodes(); 1599 1617 1618 m_updateRenderingPhaseStack.last() = RenderingUpdatePhase::LayerFlushing; 1619 1600 1620 view->flushCompositingStateIncludingSubframes(); 1621 1622 m_updateRenderingPhaseStack.last() = RenderingUpdatePhase::PostLayerFlush; 1601 1623 1602 1624 #if ENABLE(ASYNC_SCROLLING) … … 1609 1631 } 1610 1632 #endif 1633 1634 m_updateRenderingPhaseStack.removeLast(); 1611 1635 } 1612 1636 -
trunk/Source/WebCore/page/Page.h
r267611 r267688 489 489 WEBCORE_EXPORT void layoutIfNeeded(); 490 490 WEBCORE_EXPORT void updateRendering(); 491 491 // A call to updateRendering() that is not followed by a call to finalizeRenderingUpdate(). 492 WEBCORE_EXPORT void isolatedUpdateRendering(); 492 493 WEBCORE_EXPORT void finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags>); 493 494 … … 781 782 782 783 private: 784 enum class RenderingUpdatePhase : uint8_t { 785 Outside, 786 InUpdateRendering, 787 LayerFlushing, 788 PostLayerFlush 789 }; 790 783 791 struct Navigation { 784 792 RegistrableDomain domain; … … 1018 1026 bool m_mediaPlaybackIsSuspended { false }; 1019 1027 bool m_mediaBufferingIsSuspended { false }; 1020 bool m_inUpdateRendering { false };1021 1028 bool m_hasResourceLoadClient { false }; 1022 1029 bool m_delegatesScaling { false }; … … 1025 1032 bool m_isEditableRegionEnabled { false }; 1026 1033 #endif 1034 1035 Vector<RenderingUpdatePhase, 2> m_updateRenderingPhaseStack; 1027 1036 1028 1037 UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { UserInterfaceLayoutDirection::LTR }; -
trunk/Source/WebKit/ChangeLog
r267655 r267688 1 2020-09-25 Simon Fraser <simon.fraser@apple.com> 2 3 WebKitLegacy should call Page::finalizeRenderingUpdate() 4 https://bugs.webkit.org/show_bug.cgi?id=216958 5 6 Reviewed by Tim Horton. 7 8 dynamicViewportSizeUpdate() needs to call isolatedUpdateRendering() because it isn't followed 9 by a finalizeRenderingUpdate(). 10 11 * WebProcess/WebPage/ios/WebPageIOS.mm: 12 (WebKit::WebPage::dynamicViewportSizeUpdate): 13 1 14 2020-09-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r267363 r267688 3442 3442 frameView.setScrollOffset(roundedUnobscuredContentRectPosition); 3443 3443 3444 m_page-> updateRendering();3444 m_page->isolatedUpdateRendering(); 3445 3445 3446 3446 #if ENABLE(VIEWPORT_RESIZING) -
trunk/Source/WebKitLegacy/mac/ChangeLog
r267641 r267688 1 2020-09-24 Simon Fraser <simon.fraser@apple.com> 2 3 WebKitLegacy should call Page::finalizeRenderingUpdate() 4 https://bugs.webkit.org/show_bug.cgi?id=216958 5 6 Reviewed by Tim Horton. 7 8 This is a precursor to fixing webkit.org/b/216726. Page needs to track the phase 9 of updateRendering that we are in, and to ease this tracking, WebKitLegacy needs to call 10 Page::finalizeRenderingUpdate() so the state is tracked. 11 12 Rename -_viewWillDrawInternal to -_updateRendering, and have it call updateRendering() 13 and finalizeRenderingUpdate(). We can also move in the call to -_synchronizeCustomFixedPositionLayoutRect 14 which both call sites do. 15 16 Since updateRendering() is guaranteed to update layout, we know -_flushCompositingChanges would have 17 never returned NO here, so we can remove the condition in LayerFlushController::flushLayers(). 18 19 -[WebHTMLView viewWillDraw] also does a similar -_web_updateLayoutAndStyleIfNeededRecursive 20 then -_flushCompositingChanges but this is called from AppKit with a timing that we don't control; 21 it may be redundant with -[WebView _updateRendering] but I leave that behavior unchanged. 22 23 * WebView/WebView.mm: 24 (-[WebView _updateRendering]): 25 (-[WebView _forceRepaintForTesting]): 26 (LayerFlushController::flushLayers): 27 (-[WebView _viewWillDrawInternal]): Deleted. 28 1 29 2020-09-26 Sam Weinig <weinig@apple.com> 2 30 -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r267641 r267688 1790 1790 } 1791 1791 1792 - (void)_viewWillDrawInternal 1793 { 1794 if (_private->page) 1792 - (void)_updateRendering 1793 { 1794 #if PLATFORM(IOS_FAMILY) 1795 // Ensure fixed positions layers are where they should be. 1796 [self _synchronizeCustomFixedPositionLayoutRect]; 1797 #endif 1798 1799 if (_private->page) { 1795 1800 _private->page->updateRendering(); 1801 _private->page->finalizeRenderingUpdate({ }); 1802 } 1796 1803 } 1797 1804 … … 4814 4821 - (void)_forceRepaintForTesting 4815 4822 { 4816 #if PLATFORM(IOS_FAMILY) 4817 // Ensure fixed positions layers are where they should be. 4818 [self _synchronizeCustomFixedPositionLayoutRect]; 4819 #endif 4820 4821 [self _viewWillDrawInternal]; 4822 [self _flushCompositingChanges]; 4823 [self _updateRendering]; 4823 4824 [CATransaction flush]; 4824 4825 [CATransaction synchronize]; … … 9258 9259 #endif // PLATFORM(MAC) 9259 9260 9260 #if PLATFORM(IOS_FAMILY) 9261 // Ensure fixed positions layers are where they should be. 9262 [m_webView _synchronizeCustomFixedPositionLayoutRect]; 9263 #endif 9264 9265 [m_webView _viewWillDrawInternal]; 9266 9267 if ([m_webView _flushCompositingChanges]) { 9261 [m_webView _updateRendering]; 9262 9268 9263 #if PLATFORM(MAC) 9269 // AppKit may have disabled screen updates, thinking an upcoming window flush will re-enable them. 9270 // In case setNeedsDisplayInRect() has prevented the window from needing to be flushed, re-enable screen 9271 // updates here. 9272 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 9273 if (![window isFlushWindowDisabled]) 9274 ALLOW_DEPRECATED_DECLARATIONS_END 9275 [window _enableScreenUpdatesIfNeeded]; 9276 #endif 9277 9278 return true; 9279 } 9280 9281 return false; 9264 // AppKit may have disabled screen updates, thinking an upcoming window flush will re-enable them. 9265 // In case setNeedsDisplayInRect() has prevented the window from needing to be flushed, re-enable screen 9266 // updates here. 9267 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 9268 if (![window isFlushWindowDisabled]) 9269 [window _enableScreenUpdatesIfNeeded]; 9270 ALLOW_DEPRECATED_DECLARATIONS_END 9271 #endif 9272 9273 return true; 9282 9274 } 9283 9275 -
trunk/Source/WebKitLegacy/win/ChangeLog
r267592 r267688 1 2020-09-25 Simon Fraser <simon.fraser@apple.com> 2 3 WebKitLegacy should call Page::finalizeRenderingUpdate() 4 https://bugs.webkit.org/show_bug.cgi?id=216958 5 6 Reviewed by Tim Horton. 7 8 Windows doesn't call finalizeRenderingUpdate() so needs to use isolatedUpdateRendering(). 9 10 * WebCoreSupport/AcceleratedCompositingContext.cpp: 11 (AcceleratedCompositingContext::flushAndRenderLayers): 12 * WebView.cpp: 13 (WebView::paint): 14 (WebView::flushPendingGraphicsLayerChangesSoon): 15 (WebView::flushPendingGraphicsLayerChanges): 16 1 17 2020-09-25 Antoine Quint <graouts@webkit.org> 2 18 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp
r261577 r267688 298 298 return; 299 299 300 core(&m_webView)-> updateRendering();300 core(&m_webView)->isolatedUpdateRendering(); 301 301 302 302 if (!enabled()) -
trunk/Source/WebKitLegacy/win/WebView.cpp
r267592 r267688 1286 1286 LOCAL_GDI_COUNTER(0, __FUNCTION__); 1287 1287 1288 m_page-> updateRendering();1288 m_page->isolatedUpdateRendering(); 1289 1289 1290 1290 if (paintCompositedContentToHDC(dc)) { … … 7212 7212 #if USE(CA) 7213 7213 if (!m_layerTreeHost) { 7214 m_page-> updateRendering();7214 m_page->isolatedUpdateRendering(); 7215 7215 return; 7216 7216 } … … 7218 7218 #elif USE(TEXTURE_MAPPER_GL) 7219 7219 if (!isAcceleratedCompositing()) { 7220 m_page-> updateRendering();7220 m_page->isolatedUpdateRendering(); 7221 7221 return; 7222 7222 } … … 7445 7445 return; 7446 7446 7447 m_page-> updateRendering();7447 m_page->isolatedUpdateRendering(); 7448 7448 7449 7449 // Updating layout might have taken us out of compositing mode.
Note:
See TracChangeset
for help on using the changeset viewer.