Make setNeedsLayout on the root more explicitly about triggering its side-effects
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Feb 2019 01:48:13 +0000 (01:48 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Feb 2019 01:48:13 +0000 (01:48 +0000)
commit90fa55623b041d373bbde7b883babfda87f9817b
treee510bb03cb15e61059145757763fc112bbfecc8a
parenta84f85e72a83d39ad2d6428098244ce0618b20a2
Make setNeedsLayout on the root more explicitly about triggering its side-effects
https://bugs.webkit.org/show_bug.cgi?id=194198

Reviewed by Antti Koivisto.

Source/WebCore:

Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree
generally manages its own dirty state.

Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects
of layout, like compositing updates, which are required when view configuration state, like
headers, footers and transparency, change. These dependencies are currently implicit and
poorly defined.

Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure
rendering updates, vs updates of downstream data strutures like compositing. It's now called
setNeedsLayoutAfterViewConfigurationChange(). In addition, expose
setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers
can trigger the appropriate types of compositing updates on the root layer.

In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a
layout. Withtout this, some callers would dirty the RenderView's layout but rely on some
other trigger to make the layout happen.

This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout
but never scheduled it, making banner insertion in MiniBrowser unreliable.

This patch also removes the aliasing of headerHeight/footerHeight between Page and
FrameView. Banners are a property of Page, so FrameView fetches the banner heights
from Page.

* page/FrameView.cpp:
(WebCore::FrameView::headerHeight const):
(WebCore::FrameView::footerHeight const):
(WebCore::FrameView::availableContentSizeChanged):
(WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange):
(WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
(WebCore::FrameView::setNeedsCompositingGeometryUpdate):
(WebCore::FrameView::scheduleSelectionUpdate):
(WebCore::FrameView::setTransparent):
(WebCore::FrameView::setBaseBackgroundColor):
(WebCore::FrameView::setAutoSizeFixedMinimumHeight):
(WebCore::FrameView::enableAutoSizeMode):
(WebCore::FrameView::setHeaderHeight): Deleted.
(WebCore::FrameView::setFooterHeight): Deleted.
(WebCore::FrameView::setNeedsLayout): Deleted.
* page/FrameView.h:
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
(WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted.
* page/FrameViewLayoutContext.h:
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor):
(WebCore::Page::setHeaderHeight):
(WebCore::Page::setFooterHeight):
(WebCore::Page::addHeaderWithHeight): Deleted.
(WebCore::Page::addFooterWithHeight): Deleted.
* page/Page.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setHeaderHeight):
(WebCore::Internals::setFooterHeight):

Source/WebKit:

Call the newly named functions.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::updateScrollbars):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::didInitializePlugin):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setHeaderBannerHeightForTesting):
(WebKit::WebPage::setFooterBannerHeightForTesting):
* WebProcess/WebPage/mac/PageBannerMac.mm:
(WebKit::PageBanner::addToPage):
(WebKit::PageBanner::detachFromPage):
(WebKit::PageBanner::hide):

Source/WebKitLegacy/mac:

Call the newly named functions.

* WebView/WebFrame.mm:
(-[WebFrame setNeedsLayout]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView setNeedsLayout:]):

Tools:

No need to set the banner heights on navigation now, since Page stores them.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController webView:didFinishNavigation:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/FrameViewLayoutContext.cpp
Source/WebCore/page/FrameViewLayoutContext.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/mac/PageBannerMac.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebFrame.mm
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
Tools/ChangeLog
Tools/MiniBrowser/mac/WK2BrowserWindowController.m