Changeset 240912 in webkit
- Timestamp:
- Feb 3, 2019 5:48:13 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r240911 r240912 1 2019-02-03 Simon Fraser <simon.fraser@apple.com> 2 3 Make setNeedsLayout on the root more explicitly about triggering its side-effects 4 https://bugs.webkit.org/show_bug.cgi?id=194198 5 6 Reviewed by Antti Koivisto. 7 8 Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree 9 generally manages its own dirty state. 10 11 Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects 12 of layout, like compositing updates, which are required when view configuration state, like 13 headers, footers and transparency, change. These dependencies are currently implicit and 14 poorly defined. 15 16 Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure 17 rendering updates, vs updates of downstream data strutures like compositing. It's now called 18 setNeedsLayoutAfterViewConfigurationChange(). In addition, expose 19 setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers 20 can trigger the appropriate types of compositing updates on the root layer. 21 22 In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a 23 layout. Withtout this, some callers would dirty the RenderView's layout but rely on some 24 other trigger to make the layout happen. 25 26 This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout 27 but never scheduled it, making banner insertion in MiniBrowser unreliable. 28 29 This patch also removes the aliasing of headerHeight/footerHeight between Page and 30 FrameView. Banners are a property of Page, so FrameView fetches the banner heights 31 from Page. 32 33 * page/FrameView.cpp: 34 (WebCore::FrameView::headerHeight const): 35 (WebCore::FrameView::footerHeight const): 36 (WebCore::FrameView::availableContentSizeChanged): 37 (WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange): 38 (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): 39 (WebCore::FrameView::setNeedsCompositingGeometryUpdate): 40 (WebCore::FrameView::scheduleSelectionUpdate): 41 (WebCore::FrameView::setTransparent): 42 (WebCore::FrameView::setBaseBackgroundColor): 43 (WebCore::FrameView::setAutoSizeFixedMinimumHeight): 44 (WebCore::FrameView::enableAutoSizeMode): 45 (WebCore::FrameView::setHeaderHeight): Deleted. 46 (WebCore::FrameView::setFooterHeight): Deleted. 47 (WebCore::FrameView::setNeedsLayout): Deleted. 48 * page/FrameView.h: 49 * page/FrameViewLayoutContext.cpp: 50 (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange): 51 (WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted. 52 * page/FrameViewLayoutContext.h: 53 * page/Page.cpp: 54 (WebCore::Page::setPageScaleFactor): 55 (WebCore::Page::setHeaderHeight): 56 (WebCore::Page::setFooterHeight): 57 (WebCore::Page::addHeaderWithHeight): Deleted. 58 (WebCore::Page::addFooterWithHeight): Deleted. 59 * page/Page.h: 60 * rendering/RenderLayerCompositor.cpp: 61 (WebCore::RenderLayerCompositor::updateBacking): 62 * testing/Internals.cpp: 63 (WebCore::Internals::resetToConsistentState): 64 (WebCore::Internals::setHeaderHeight): 65 (WebCore::Internals::setFooterHeight): 66 1 67 2019-02-03 John Wilander <wilander@apple.com> 2 68 -
trunk/Source/WebCore/page/FrameView.cpp
r240904 r240912 1048 1048 } 1049 1049 1050 void FrameView::setHeaderHeight(int headerHeight) 1051 { 1052 if (frame().page()) 1053 ASSERT(frame().isMainFrame()); 1054 m_headerHeight = headerHeight; 1055 1056 if (RenderView* renderView = this->renderView()) 1057 renderView->setNeedsLayout(); 1058 } 1059 1060 void FrameView::setFooterHeight(int footerHeight) 1061 { 1062 if (frame().page()) 1063 ASSERT(frame().isMainFrame()); 1064 m_footerHeight = footerHeight; 1065 1066 if (RenderView* renderView = this->renderView()) 1067 renderView->setNeedsLayout(); 1050 int FrameView::headerHeight() const 1051 { 1052 if (!frame().isMainFrame()) 1053 return 0; 1054 Page* page = frame().page(); 1055 return page ? page->headerHeight() : 0; 1056 } 1057 1058 int FrameView::footerHeight() const 1059 { 1060 if (!frame().isMainFrame()) 1061 return 0; 1062 Page* page = frame().page(); 1063 return page ? page->footerHeight() : 0; 1068 1064 } 1069 1065 … … 2674 2670 2675 2671 updateLayoutViewport(); 2676 setNeedsLayout ();2672 setNeedsLayoutAfterViewConfigurationChange(); 2677 2673 ScrollView::availableContentSizeChanged(reason); 2678 2674 } … … 2919 2915 } 2920 2916 2921 void FrameView::setNeedsLayout() 2922 { 2923 layoutContext().setNeedsLayout(); 2917 void FrameView::setNeedsLayoutAfterViewConfigurationChange() 2918 { 2919 layoutContext().setNeedsLayoutAfterViewConfigurationChange(); 2920 } 2921 2922 void FrameView::setNeedsCompositingConfigurationUpdate() 2923 { 2924 RenderView* renderView = this->renderView(); 2925 if (renderView->usesCompositing()) { 2926 if (auto* rootLayer = renderView->layer()) 2927 renderView->layer()->setNeedsCompositingConfigurationUpdate(); 2928 } 2929 } 2930 2931 void FrameView::setNeedsCompositingGeometryUpdate() 2932 { 2933 RenderView* renderView = this->renderView(); 2934 if (renderView->usesCompositing()) { 2935 if (auto* rootLayer = renderView->layer()) 2936 renderView->layer()->setNeedsCompositingGeometryUpdate(); 2937 } 2924 2938 } 2925 2939 … … 2930 2944 // FIXME: We should not need to go through the layout process since selection update does not change dimension/geometry. 2931 2945 // However we can't tell at this point if the tree is stable yet, so let's just schedule a root only layout for now. 2932 setNeedsLayout(); 2933 layoutContext().scheduleLayout(); 2946 setNeedsLayoutAfterViewConfigurationChange(); 2934 2947 } 2935 2948 … … 2953 2966 return; 2954 2967 2955 renderView()->compositor().rootBackgroundColorOrTransparencyChanged();2956 setNeeds Layout();2968 setNeedsLayoutAfterViewConfigurationChange(); 2969 setNeedsCompositingConfigurationUpdate(); 2957 2970 } 2958 2971 … … 2975 2988 2976 2989 recalculateScrollbarOverlayStyle(); 2977 setNeedsLayout(); 2978 2979 renderView()->compositor().rootBackgroundColorOrTransparencyChanged(); 2990 setNeedsLayoutAfterViewConfigurationChange(); 2991 setNeedsCompositingConfigurationUpdate(); 2980 2992 } 2981 2993 … … 3517 3529 m_autoSizeFixedMinimumHeight = fixedMinimumHeight; 3518 3530 3519 setNeedsLayout ();3531 setNeedsLayoutAfterViewConfigurationChange(); 3520 3532 } 3521 3533 … … 4517 4529 m_didRunAutosize = false; 4518 4530 4519 setNeedsLayout ();4531 setNeedsLayoutAfterViewConfigurationChange(); 4520 4532 layoutContext().scheduleLayout(); 4521 4533 if (m_shouldAutoSize) { -
trunk/Source/WebCore/page/FrameView.h
r240904 r240912 118 118 119 119 WEBCORE_EXPORT bool needsLayout() const; 120 WEBCORE_EXPORT void setNeedsLayout(); 120 WEBCORE_EXPORT void setNeedsLayoutAfterViewConfigurationChange(); 121 122 void setNeedsCompositingConfigurationUpdate(); 123 void setNeedsCompositingGeometryUpdate(); 124 121 125 void setViewportConstrainedObjectsNeedLayout(); 122 126 … … 574 578 LayoutPoint scrollPositionRespectingCustomFixedPosition() const; 575 579 576 int headerHeight() const final { return m_headerHeight; } 577 WEBCORE_EXPORT void setHeaderHeight(int); 578 int footerHeight() const final { return m_footerHeight; } 579 WEBCORE_EXPORT void setFooterHeight(int); 580 WEBCORE_EXPORT int headerHeight() const final; 581 WEBCORE_EXPORT int footerHeight() const final; 580 582 581 583 WEBCORE_EXPORT float topContentInset(TopContentInsetType = TopContentInsetType::WebCoreContentInset) const final; -
trunk/Source/WebCore/page/FrameViewLayoutContext.cpp
r240895 r240912 314 314 } 315 315 316 void FrameViewLayoutContext::setNeedsLayout ()316 void FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() 317 317 { 318 318 if (m_disableSetNeedsLayoutCount) { … … 324 324 ASSERT(!renderView->inHitTesting()); 325 325 renderView->setNeedsLayout(); 326 scheduleLayout(); 326 327 } 327 328 } -
trunk/Source/WebCore/page/FrameViewLayoutContext.h
r240901 r240912 51 51 52 52 void layout(); 53 bool needsLayout() const; 53 54 54 void setNeedsLayout(); 55 bool needsLayout() const; 55 // We rely on the side-effects of layout, like compositing updates, to update state in various subsystems 56 // whose dependencies are poorly defined. This call triggers such updates. 57 void setNeedsLayoutAfterViewConfigurationChange(); 56 58 57 59 void scheduleLayout(); -
trunk/Source/WebCore/page/Page.cpp
r240875 r240912 1006 1006 1007 1007 if (!m_settings->delegatesPageScaling()) { 1008 if (auto* renderView = document->renderView()) { 1009 renderView->setNeedsLayout(); 1010 if (renderView->hasLayer() && renderView->layer()->isComposited()) 1011 renderView->layer()->setNeedsCompositingGeometryUpdate(); 1012 } 1008 view->setNeedsLayoutAfterViewConfigurationChange(); 1009 view->setNeedsCompositingGeometryUpdate(); 1013 1010 1014 1011 document->resolveStyle(Document::ResolveStyleType::Rebuild); … … 1969 1966 } 1970 1967 1971 #if ENABLE(RUBBER_BANDING) 1972 void Page::addHeaderWithHeight(int headerHeight) 1973 { 1968 void Page::setHeaderHeight(int headerHeight) 1969 { 1970 if (headerHeight == m_headerHeight) 1971 return; 1972 1974 1973 m_headerHeight = headerHeight; 1975 1974 … … 1982 1981 return; 1983 1982 1984 frameView->setHeaderHeight(m_headerHeight); 1985 renderView->compositor().updateLayerForHeader(m_headerHeight); 1986 } 1987 1988 void Page::addFooterWithHeight(int footerHeight) 1989 { 1983 frameView->setNeedsLayoutAfterViewConfigurationChange(); 1984 frameView->setNeedsCompositingGeometryUpdate(); 1985 } 1986 1987 void Page::setFooterHeight(int footerHeight) 1988 { 1989 if (footerHeight == m_footerHeight) 1990 return; 1991 1990 1992 m_footerHeight = footerHeight; 1991 1993 … … 1998 2000 return; 1999 2001 2000 frameView->setFooterHeight(m_footerHeight); 2001 renderView->compositor().updateLayerForFooter(m_footerHeight); 2002 } 2003 #endif 2002 frameView->setNeedsLayoutAfterViewConfigurationChange(); 2003 frameView->setNeedsCompositingGeometryUpdate(); 2004 } 2004 2005 2005 2006 void Page::incrementNestedRunLoopCount() -
trunk/Source/WebCore/page/Page.h
r240634 r240912 520 520 OptionSet<LayoutMilestone> requestedLayoutMilestones() const { return m_requestedLayoutMilestones; } 521 521 522 #if ENABLE(RUBBER_BANDING) 523 WEBCORE_EXPORT void addHeaderWithHeight(int); 524 WEBCORE_EXPORT void addFooterWithHeight(int); 525 #endif 522 WEBCORE_EXPORT void setHeaderHeight(int); 523 WEBCORE_EXPORT void setFooterHeight(int); 526 524 527 525 int headerHeight() const { return m_headerHeight; } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r240899 r240912 1544 1544 1545 1545 if (layer.isRenderViewLayer() && useCoordinatedScrollingForLayer(layer)) { 1546 auto& frameView = m_renderView.frameView(); 1546 1547 if (auto* scrollingCoordinator = this->scrollingCoordinator()) 1547 scrollingCoordinator->frameViewRootLayerDidChange( m_renderView.frameView());1548 scrollingCoordinator->frameViewRootLayerDidChange(frameView); 1548 1549 #if ENABLE(RUBBER_BANDING) 1549 updateLayerForHeader( page().headerHeight());1550 updateLayerForFooter( page().footerHeight());1550 updateLayerForHeader(frameView.headerHeight()); 1551 updateLayerForFooter(frameView.footerHeight()); 1551 1552 #endif 1552 1553 updateRootContentLayerClipping(); 1553 1554 1554 1555 if (auto* tiledBacking = layer.backing()->tiledBacking()) 1555 tiledBacking->setTopContentInset( m_renderView.frameView().topContentInset());1556 tiledBacking->setTopContentInset(frameView.topContentInset()); 1556 1557 } 1557 1558 -
trunk/Source/WebCore/testing/Internals.cpp
r240644 r240912 450 450 FrameView* mainFrameView = page.mainFrame().view(); 451 451 if (mainFrameView) { 452 mainFrameView->setHeaderHeight(0);453 mainFrameView->setFooterHeight(0);452 page.setHeaderHeight(0); 453 page.setFooterHeight(0); 454 454 page.setTopContentInset(0); 455 455 mainFrameView->setUseFixedLayout(false); … … 2904 2904 return; 2905 2905 2906 document-> view()->setHeaderHeight(height);2906 document->page()->setHeaderHeight(height); 2907 2907 } 2908 2908 … … 2913 2913 return; 2914 2914 2915 document-> view()->setFooterHeight(height);2915 document->page()->setFooterHeight(height); 2916 2916 } 2917 2917 -
trunk/Source/WebKit/ChangeLog
r240909 r240912 1 2019-02-03 Simon Fraser <simon.fraser@apple.com> 2 3 Make setNeedsLayout on the root more explicitly about triggering its side-effects 4 https://bugs.webkit.org/show_bug.cgi?id=194198 5 6 Reviewed by Antti Koivisto. 7 8 Call the newly named functions. 9 10 * WebProcess/Plugins/PDF/PDFPlugin.mm: 11 (WebKit::PDFPlugin::updateScrollbars): 12 * WebProcess/Plugins/PluginView.cpp: 13 (WebKit::PluginView::didInitializePlugin): 14 * WebProcess/WebPage/WebPage.cpp: 15 (WebKit::WebPage::setHeaderBannerHeightForTesting): 16 (WebKit::WebPage::setFooterBannerHeightForTesting): 17 * WebProcess/WebPage/mac/PageBannerMac.mm: 18 (WebKit::PageBanner::addToPage): 19 (WebKit::PageBanner::detachFromPage): 20 (WebKit::PageBanner::hide): 21 1 22 2019-02-03 Ryosuke Niwa <rniwa@webkit.org> 2 23 -
trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
r240211 r240912 736 736 frameView->removeScrollableArea(this); 737 737 738 frameView->setNeedsLayout ();738 frameView->setNeedsLayoutAfterViewConfigurationChange(); 739 739 } 740 740 -
trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp
r240292 r240912 664 664 if (Frame* frame = m_pluginElement->document().frame()) { 665 665 if (FrameView* frameView = frame->view()) 666 frameView->setNeedsLayout ();666 frameView->setNeedsLayoutAfterViewConfigurationChange(); 667 667 } 668 668 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r240909 r240912 2129 2129 void WebPage::setHeaderBannerHeightForTesting(int height) 2130 2130 { 2131 #if ENABLE(RUBBER_BANDING) 2132 corePage()->addHeaderWithHeight(height); 2133 #endif 2131 corePage()->setHeaderHeight(height); 2134 2132 } 2135 2133 2136 2134 void WebPage::setFooterBannerHeightForTesting(int height) 2137 2135 { 2138 #if ENABLE(RUBBER_BANDING) 2139 corePage()->addFooterWithHeight(height); 2140 #endif 2136 corePage()->setFooterHeight(height); 2141 2137 } 2142 2138 -
trunk/Source/WebKit/WebProcess/WebPage/mac/PageBannerMac.mm
r235205 r240912 58 58 switch (m_type) { 59 59 case Header: 60 m_webPage->corePage()-> addHeaderWithHeight(m_height);60 m_webPage->corePage()->setHeaderHeight(m_height); 61 61 break; 62 62 case Footer: 63 m_webPage->corePage()-> addFooterWithHeight(m_height);63 m_webPage->corePage()->setFooterHeight(m_height); 64 64 break; 65 65 case NotSet: … … 87 87 // We can hide the banner by removing the parent layer that hosts it. 88 88 if (m_type == Header) 89 m_webPage->corePage()-> addHeaderWithHeight(0);89 m_webPage->corePage()->setHeaderHeight(0); 90 90 else if (m_type == Footer) 91 m_webPage->corePage()-> addFooterWithHeight(0);91 m_webPage->corePage()->setFooterHeight(0); 92 92 } 93 93 … … 100 100 // We can hide the banner by removing the parent layer that hosts it. 101 101 if (m_type == Header) 102 m_webPage->corePage()-> addHeaderWithHeight(0);102 m_webPage->corePage()->setHeaderHeight(0); 103 103 else if (m_type == Footer) 104 m_webPage->corePage()-> addFooterWithHeight(0);104 m_webPage->corePage()->setFooterHeight(0); 105 105 106 106 m_isHidden = true; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r240909 r240912 1 2019-02-03 Simon Fraser <simon.fraser@apple.com> 2 3 Make setNeedsLayout on the root more explicitly about triggering its side-effects 4 https://bugs.webkit.org/show_bug.cgi?id=194198 5 6 Reviewed by Antti Koivisto. 7 8 Call the newly named functions. 9 10 * WebView/WebFrame.mm: 11 (-[WebFrame setNeedsLayout]): 12 * WebView/WebHTMLView.mm: 13 (-[WebHTMLView setNeedsLayout:]): 14 1 15 2019-02-03 Ryosuke Niwa <rniwa@webkit.org> 2 16 -
trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm
r240355 r240912 1311 1311 WebCore::Frame *frame = core(self); 1312 1312 if (frame->view()) 1313 frame->view()->setNeedsLayout ();1313 frame->view()->setNeedsLayoutAfterViewConfigurationChange(); 1314 1314 } 1315 1315 -
trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
r240355 r240912 3870 3870 return; 3871 3871 if (FrameView* view = frame->view()) 3872 view->setNeedsLayout ();3872 view->setNeedsLayoutAfterViewConfigurationChange(); 3873 3873 } 3874 3874 } -
trunk/Tools/ChangeLog
r240911 r240912 1 2019-02-03 Simon Fraser <simon.fraser@apple.com> 2 3 Make setNeedsLayout on the root more explicitly about triggering its side-effects 4 https://bugs.webkit.org/show_bug.cgi?id=194198 5 6 Reviewed by Antti Koivisto. 7 8 No need to set the banner heights on navigation now, since Page stores them. 9 10 * MiniBrowser/mac/WK2BrowserWindowController.m: 11 (-[WK2BrowserWindowController webView:didFinishNavigation:]): 12 1 13 2019-02-03 John Wilander <wilander@apple.com> 2 14 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r240100 r240912 675 675 { 676 676 LOG(@"didFinishNavigation: %@", navigation); 677 678 // Banner heights don't persist across page loads (oddly, since Page stores them), so reset on every page load.679 if ([[SettingsController shared] isSpaceReservedForBanners]) {680 [_webView _setHeaderBannerHeight:testHeaderBannerHeight];681 [_webView _setFooterBannerHeight:testFooterBannerHeight];682 }683 677 } 684 678
Note: See TracChangeset
for help on using the changeset viewer.