Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[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): Canonical link: https://commits.webkit.org/195119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information