[FrameView::layout cleanup] Move core layout logic to a separate class.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Oct 2017 15:24:58 +0000 (15:24 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Oct 2017 15:24:58 +0000 (15:24 +0000)
commitfd1df3b01e5aa2e0fc8b9bd7ac09913efb17cc09
tree8ea955b5c23f3591d65ed3b57d20bdb2aa53d064
parent9b3f77cbae4544016515ab3db8390da2b768bf5e
[FrameView::layout cleanup] Move core layout logic to a separate class.
https://bugs.webkit.org/show_bug.cgi?id=178771
<rdar://problem/35166542>

Reviewed by Simon Fraser.

Move layout code out from FrameView to LayoutContext.

Source/WebCore:

LayoutContext holds all the layout related logic (scheduling, needsLayout, handling layout states),
while scrolling, view sizing methods stay in FrameView.
Having a dedicated LayoutContext allows to structure the code better.

Covered by existing tests.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::rendererNeedsDeferredUpdate):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::updateBackingStore):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement const):
(WebCore::AccessibilityRenderObject::layoutCount const):
* dom/Document.cpp:
(WebCore::Document::setVisualUpdatesAllowed):
(WebCore::Document::resolveStyle):
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::updateLayout):
(WebCore::Document::updateLayoutIfDimensionsOutOfDate):
(WebCore::Document::implicitClose):
(WebCore::Document::isLayoutTimerActive):
* dom/Element.cpp:
(WebCore::Element::absoluteEventHandlerBounds):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelection):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::didAttachRenderers):
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::update):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopForUserCancel):
* page/Frame.cpp:
(WebCore::Frame::setView):
(WebCore::Frame::clearTimers):
(WebCore::Frame::setPageAndTextZoomFactors):
(WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::~FrameView):
(WebCore::FrameView::reset):
(WebCore::FrameView::resetScrollbars):
(WebCore::FrameView::didFirstLayout const):
(WebCore::FrameView::willDestroyRenderTree):
(WebCore::FrameView::didDestroyRenderTree):
(WebCore::FrameView::setContentsSize):
(WebCore::FrameView::calculateScrollbarModesForLayout):
(WebCore::FrameView::updateCompositingLayersAfterStyleChange):
(WebCore::FrameView::topContentInsetDidChange):
(WebCore::FrameView::forceLayoutParentViewIfNeeded):
(WebCore::FrameView::adjustScrollbarsForLayout):
(WebCore::FrameView::willDoLayout): This takes care of the view related task right before entering render tree layout.
(WebCore::FrameView::didLayout): post layout tasks.
(WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
(WebCore::FrameView::updateLayoutViewport):
(WebCore::FrameView::maintainScrollPositionAtAnchor):
(WebCore::FrameView::updateLayerPositionsAfterScrolling):
(WebCore::FrameView::updateCompositingLayersAfterScrolling):
(WebCore::FrameView::availableContentSizeChanged):
(WebCore::FrameView::updateContentsSize):
(WebCore::FrameView::needsLayout const):
(WebCore::FrameView::setNeedsLayout):
(WebCore::FrameView::scheduleSelectionUpdate):
(WebCore::FrameView::updateEmbeddedObjects):
(WebCore::FrameView::flushAnyPendingPostLayoutTasks):
(WebCore::FrameView::flushPostLayoutTasksQueue):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::sendResizeEventIfNeeded):
(WebCore::FrameView::autoSizeIfEnabled):
(WebCore::FrameView::paintControlTints):
(WebCore::FrameView::paintContents):
(WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):
(WebCore::FrameView::enableAutoSizeMode):
(WebCore::FrameView::forceLayout):
(WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer): Deleted.
(WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer): Deleted.
(WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree): Deleted.
(): Deleted.
(WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker): Deleted.
(WebCore::applyTextSizingIfNeeded): Deleted.
(WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
(WebCore::FrameView::updateStyleForLayout): Deleted.
(WebCore::FrameView::canPerformLayout const): Deleted.
(WebCore::FrameView::layout): Deleted.
(WebCore::FrameView::runOrSchedulePostLayoutTasks): Deleted.
(WebCore::FrameView::convertSubtreeLayoutToFullLayout): Deleted.
(WebCore::FrameView::layoutTimerFired): Deleted.
(WebCore::FrameView::scheduleRelayout): Deleted.
(WebCore::isObjectAncestorContainerOf): Deleted.
(WebCore::FrameView::scheduleRelayoutOfSubtree): Deleted.
(WebCore::FrameView::layoutPending const): Deleted.
(WebCore::FrameView::unscheduleRelayout): Deleted.
(WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded): Deleted.
* page/FrameView.h:
* page/LayoutContext.cpp: Added.
(WebCore::isObjectAncestorContainerOf):
(WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
(WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
(WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree):
(WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
(WebCore::LayoutScope::LayoutScope):
(WebCore::LayoutScope::~LayoutScope):
(WebCore::LayoutContext::LayoutContext):
(WebCore::LayoutContext::layout):
(WebCore::LayoutContext::runOrScheduleAsynchronousTasks):
(WebCore::LayoutContext::runAsynchronousTasks):
(WebCore::LayoutContext::flushAsynchronousTasks):
(WebCore::LayoutContext::reset):
(WebCore::LayoutContext::needsLayout const):
(WebCore::LayoutContext::setNeedsLayout):
(WebCore::LayoutContext::enableSetNeedsLayout):
(WebCore::LayoutContext::disableSetNeedsLayout):
(WebCore::LayoutContext::scheduleLayout):
(WebCore::LayoutContext::unscheduleLayout):
(WebCore::LayoutContext::scheduleSubtreeLayout):
(WebCore::LayoutContext::layoutTimerFired):
(WebCore::LayoutContext::convertSubtreeLayoutToFullLayout):
(WebCore::LayoutContext::setSubtreeLayoutRoot):
(WebCore::LayoutContext::canPerformLayout const):
(WebCore::LayoutContext::applyTextSizingIfNeeded):
(WebCore::LayoutContext::updateStyleForLayout):
(WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
(WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded):
(WebCore::LayoutContext::frame const):
(WebCore::LayoutContext::view const):
(WebCore::LayoutContext::renderView const):
(WebCore::LayoutContext::document const):
* page/LayoutContext.h: Added.
(WebCore::LayoutContext::startDisallowingLayout):
(WebCore::LayoutContext::endDisallowingLayout):
(WebCore::LayoutContext::layoutPhase const):
(WebCore::LayoutContext::isLayoutNested const):
(WebCore::LayoutContext::layoutCount const):
(WebCore::LayoutContext::isLayoutPending const):
(WebCore::LayoutContext::isInLayout const):
(WebCore::LayoutContext::isInRenderTreeLayout const):
(WebCore::LayoutContext::inPaintableState const):
(WebCore::LayoutContext::subtreeLayoutRoot const):
(WebCore::LayoutContext::clearSubtreeLayoutRoot):
(WebCore::LayoutContext::resetFirstLayoutFlag):
(WebCore::LayoutContext::didFirstLayout const):
(WebCore::LayoutContext::setNeedsFullRepaint):
(WebCore::LayoutContext::needsFullRepaint const):
(WebCore::LayoutContext::layoutDisallowed const):
(WebCore::LayoutContext::isLayoutSchedulingEnabled const):
(WebCore::LayoutContext::inAsynchronousTasks const):
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::insertPositionedObject):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::imageChanged):
(WebCore::RenderBox::computeLogicalWidthInFragment const):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::clearSubtreeLayoutRootIfNeeded const):
(WebCore::RenderElement::checkForRepaintDuringLayout const):
* rendering/RenderFrameBase.cpp:
(WebCore::RenderFrameBase::performLayoutWithFlattening):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):
* rendering/RenderObject.cpp:
(WebCore::scheduleRelayoutForSubtree):
* rendering/RenderTreeAsText.cpp:
(WebCore::write):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::updatePlayer):
* rendering/RenderView.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::updateWidgetPosition):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):
* testing/Internals.cpp:
(WebCore::Internals::layoutCount const):

Source/WebKitLegacy/mac:

* WebView/WebClipView.mm:
(-[WebClipView _immediateScrollToPoint:]):
* WebView/WebFrame.mm:
(-[WebFrame layoutCount]):

Source/WebKitLegacy/win:

* WebFrame.cpp:
(WebFrame::layout):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
36 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/LayoutContext.cpp [new file with mode: 0644]
Source/WebCore/page/LayoutContext.h [new file with mode: 0644]
Source/WebCore/page/Page.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderFrameBase.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderTreeAsText.cpp
Source/WebCore/rendering/RenderVideo.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebClipView.mm
Source/WebKitLegacy/mac/WebView/WebFrame.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebFrame.cpp