haikuwebkit/Source/WebCore/display/DisplayTree.h

67 lines
2.2 KiB
C
Raw Permalink Normal View History

[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
[LFC Display] Introduce type-safe rect types for the display tree https://bugs.webkit.org/show_bug.cgi?id=220214 Reviewed by Alan Bujtas. Introduce AbsoluteFloatRect, UnadjustedAbsoluteFloatRect and ViewFloatRect which are type-safe float rect types for the display tree. AbsoluteFloatRect is relative to document origin. UnadjustedAbsoluteFloatRect is similar, but is computed before scrolling and transforms are taken into account. ViewFloatRect is relative to the view. * WebCore.xcodeproj/project.pbxproj: * display/DisplayGeometryTypes.h: Copied from Source/WebCore/display/css/DisplayReplacedBox.h. (WebCore::Display::intersection): (WebCore::Display::unionRect): * display/DisplayTree.cpp: (WebCore::Display::Tree::setBoxNeedsDisplay const): * display/DisplayTree.h: * display/DisplayTreeBuilder.cpp: * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::setNeedsDisplay): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): (WebCore::Display::Box::absoluteBoxRect const): (WebCore::Display::Box::absolutePaintingExtent const): * display/css/DisplayBoxClip.cpp: (WebCore::Display::BoxClip::pushClip): (WebCore::Display::BoxClip::pushRoundedClip): * display/css/DisplayBoxClip.h: (WebCore::Display::BoxClip::clipRect const): * display/css/DisplayBoxDecorationPainter.cpp: (WebCore::Display::BoxDecorationPainter::paintFillLayer const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): (WebCore::Display::BoxFactory::setupBoxGeometry const): * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): (WebCore::Display::BoxModelBox::clipForDescendants const): (WebCore::Display::BoxModelBox::absolutePaintingExtent const): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): (WebCore::Display::BoxModelBox::absoluteBorderBoxRect const): (WebCore::Display::BoxModelBox::absolutePaddingBoxRect const): (WebCore::Display::BoxModelBox::absoluteContentBoxRect const): (WebCore::Display::BoxModelBox::setAbsolutePaddingBoxRect): (WebCore::Display::BoxModelBox::setAbsoluteContentBoxRect): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: (WebCore::Display::ReplacedBox::replacedContentRect const): (WebCore::Display::ReplacedBox::setReplacedContentRect): * display/css/DisplayStackingItem.h: (WebCore::Display::StackingItem::paintedContentBounds const): (WebCore::Display::StackingItem::paintedBoundsIncludingDescendantItems const): (WebCore::Display::StackingItem::setPaintedContentBounds): (WebCore::Display::StackingItem::setPaintedBoundsIncludingDescendantItems): * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/240523@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-15 15:44:27 +00:00
#include "DisplayGeometryTypes.h"
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
#include <wtf/IsoMalloc.h>
namespace WebCore {
namespace Display {
class Box;
[LFC Display] Store the display tree as a tree of stacking items https://bugs.webkit.org/show_bug.cgi?id=219315 Reviewed by Zalan Bujtas. Currently the display tree is a full tree, crossing stacking context boundaries, and the z-order lists are built at paint time. Change to a tree of StackingItems, where a StackingItem exists for each box that participates in the z-order sorting algorithm (i.e. boxes that are positioned, or have styles that create stacking context). Each StackingItem owns the subtree of Display::Boxes that it paints, and those subtrees are not otherwise connected. The Display::Tree owns the root StackingItem, and each StackingItem owns its child StackingItems. The StackingItem tree is built at display tree building time by storing state in the BuildingState stack. StackingItems are added to the z-order lists of their parent item at creation time; when done processing boxes for a StackingItem, we then sort its z-order lists. Add Box::participatesInZOrderSorting() and a LineBreakBox flag, and call that function instead of the version on Display::Style to work around webkit.org/b/219335 for now. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: * display/DisplayTree.cpp: (WebCore::Display::Tree::Tree): (WebCore::Display::Tree::rootBox const): * display/DisplayTree.h: (WebCore::Display::Tree::rootStackingItem const): (WebCore::Display::Tree::rootBox const): Deleted. * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::build): (WebCore::Display::TreeBuilder::pushStateForBoxDescendants): (WebCore::Display::TreeBuilder::popState): (WebCore::Display::TreeBuilder::insertIntoTree): (WebCore::Display::TreeBuilder::buildInlineDisplayTree): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::displayTreeAsText): (WebCore::Display::outputStackingTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: * display/css/DisplayBox.cpp: (WebCore::Display::Box::participatesInZOrderSorting const): * display/css/DisplayBox.h: (WebCore::Display::Box::isLineBreakBox const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::setupBoxModelBox const): * display/css/DisplayBoxFactory.h: * display/css/DisplayCSSPainter.cpp: (WebCore::Display::CSSPainter::recursivePaintDescendantsForPhase): (WebCore::Display::CSSPainter::paintAtomicallyPaintedBox): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::paintTree): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): Deleted. (WebCore::Display::CSSPainter::participatesInZOrderSorting): Deleted. (WebCore::Display::CSSPainter::collectStackingContextDescendants): Deleted. (WebCore::Display::CSSPainter::recursiveCollectLayers): Deleted. * display/css/DisplayCSSPainter.h: Canonical link: https://commits.webkit.org/232151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-05 18:53:41 +00:00
class ContainerBox;
class StackingItem;
[LFC Display] Give display boxes a back reference to the tree https://bugs.webkit.org/show_bug.cgi?id=220205 Reviewed by Zalan Bujtas. Display box code will need a back pointer to the display tree for things like paint invalidation. Pass a Tree& to box constructors, which requires that the Tree has been constructed before we make any boxes. * display/DisplayTree.cpp: (WebCore::Display::Tree::setRootStackingItem): (WebCore::Display::Tree::Tree): Deleted. * display/DisplayTree.h: (WebCore::Display::Tree::view const): (WebCore::Display::Tree::setView): * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build): * display/DisplayTreeBuilder.h: (WebCore::Display::TreeBuilder::tree const): * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::BoxFactory): (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/232730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-04 18:13:04 +00:00
class View;
[LFC Display] Store the display tree as a tree of stacking items https://bugs.webkit.org/show_bug.cgi?id=219315 Reviewed by Zalan Bujtas. Currently the display tree is a full tree, crossing stacking context boundaries, and the z-order lists are built at paint time. Change to a tree of StackingItems, where a StackingItem exists for each box that participates in the z-order sorting algorithm (i.e. boxes that are positioned, or have styles that create stacking context). Each StackingItem owns the subtree of Display::Boxes that it paints, and those subtrees are not otherwise connected. The Display::Tree owns the root StackingItem, and each StackingItem owns its child StackingItems. The StackingItem tree is built at display tree building time by storing state in the BuildingState stack. StackingItems are added to the z-order lists of their parent item at creation time; when done processing boxes for a StackingItem, we then sort its z-order lists. Add Box::participatesInZOrderSorting() and a LineBreakBox flag, and call that function instead of the version on Display::Style to work around webkit.org/b/219335 for now. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: * display/DisplayTree.cpp: (WebCore::Display::Tree::Tree): (WebCore::Display::Tree::rootBox const): * display/DisplayTree.h: (WebCore::Display::Tree::rootStackingItem const): (WebCore::Display::Tree::rootBox const): Deleted. * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::build): (WebCore::Display::TreeBuilder::pushStateForBoxDescendants): (WebCore::Display::TreeBuilder::popState): (WebCore::Display::TreeBuilder::insertIntoTree): (WebCore::Display::TreeBuilder::buildInlineDisplayTree): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::displayTreeAsText): (WebCore::Display::outputStackingTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: * display/css/DisplayBox.cpp: (WebCore::Display::Box::participatesInZOrderSorting const): * display/css/DisplayBox.h: (WebCore::Display::Box::isLineBreakBox const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::setupBoxModelBox const): * display/css/DisplayBoxFactory.h: * display/css/DisplayCSSPainter.cpp: (WebCore::Display::CSSPainter::recursivePaintDescendantsForPhase): (WebCore::Display::CSSPainter::paintAtomicallyPaintedBox): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::paintTree): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): Deleted. (WebCore::Display::CSSPainter::participatesInZOrderSorting): Deleted. (WebCore::Display::CSSPainter::collectStackingContextDescendants): Deleted. (WebCore::Display::CSSPainter::recursiveCollectLayers): Deleted. * display/css/DisplayCSSPainter.h: Canonical link: https://commits.webkit.org/232151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-05 18:53:41 +00:00
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
class Tree {
WTF_MAKE_FAST_ALLOCATED(Tree);
[LFC Display] Give display boxes a back reference to the tree https://bugs.webkit.org/show_bug.cgi?id=220205 Reviewed by Zalan Bujtas. Display box code will need a back pointer to the display tree for things like paint invalidation. Pass a Tree& to box constructors, which requires that the Tree has been constructed before we make any boxes. * display/DisplayTree.cpp: (WebCore::Display::Tree::setRootStackingItem): (WebCore::Display::Tree::Tree): Deleted. * display/DisplayTree.h: (WebCore::Display::Tree::view const): (WebCore::Display::Tree::setView): * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build): * display/DisplayTreeBuilder.h: (WebCore::Display::TreeBuilder::tree const): * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::BoxFactory): (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/232730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-04 18:13:04 +00:00
friend class TreeBuilder;
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
public:
[LFC Display] Give display boxes a back reference to the tree https://bugs.webkit.org/show_bug.cgi?id=220205 Reviewed by Zalan Bujtas. Display box code will need a back pointer to the display tree for things like paint invalidation. Pass a Tree& to box constructors, which requires that the Tree has been constructed before we make any boxes. * display/DisplayTree.cpp: (WebCore::Display::Tree::setRootStackingItem): (WebCore::Display::Tree::Tree): Deleted. * display/DisplayTree.h: (WebCore::Display::Tree::view const): (WebCore::Display::Tree::setView): * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build): * display/DisplayTreeBuilder.h: (WebCore::Display::TreeBuilder::tree const): * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::BoxFactory): (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/232730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-04 18:13:04 +00:00
Tree();
[LFC Display] Store the display tree as a tree of stacking items https://bugs.webkit.org/show_bug.cgi?id=219315 Reviewed by Zalan Bujtas. Currently the display tree is a full tree, crossing stacking context boundaries, and the z-order lists are built at paint time. Change to a tree of StackingItems, where a StackingItem exists for each box that participates in the z-order sorting algorithm (i.e. boxes that are positioned, or have styles that create stacking context). Each StackingItem owns the subtree of Display::Boxes that it paints, and those subtrees are not otherwise connected. The Display::Tree owns the root StackingItem, and each StackingItem owns its child StackingItems. The StackingItem tree is built at display tree building time by storing state in the BuildingState stack. StackingItems are added to the z-order lists of their parent item at creation time; when done processing boxes for a StackingItem, we then sort its z-order lists. Add Box::participatesInZOrderSorting() and a LineBreakBox flag, and call that function instead of the version on Display::Style to work around webkit.org/b/219335 for now. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: * display/DisplayTree.cpp: (WebCore::Display::Tree::Tree): (WebCore::Display::Tree::rootBox const): * display/DisplayTree.h: (WebCore::Display::Tree::rootStackingItem const): (WebCore::Display::Tree::rootBox const): Deleted. * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::build): (WebCore::Display::TreeBuilder::pushStateForBoxDescendants): (WebCore::Display::TreeBuilder::popState): (WebCore::Display::TreeBuilder::insertIntoTree): (WebCore::Display::TreeBuilder::buildInlineDisplayTree): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::displayTreeAsText): (WebCore::Display::outputStackingTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: * display/css/DisplayBox.cpp: (WebCore::Display::Box::participatesInZOrderSorting const): * display/css/DisplayBox.h: (WebCore::Display::Box::isLineBreakBox const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::setupBoxModelBox const): * display/css/DisplayBoxFactory.h: * display/css/DisplayCSSPainter.cpp: (WebCore::Display::CSSPainter::recursivePaintDescendantsForPhase): (WebCore::Display::CSSPainter::paintAtomicallyPaintedBox): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::paintTree): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): Deleted. (WebCore::Display::CSSPainter::participatesInZOrderSorting): Deleted. (WebCore::Display::CSSPainter::collectStackingContextDescendants): Deleted. (WebCore::Display::CSSPainter::recursiveCollectLayers): Deleted. * display/css/DisplayCSSPainter.h: Canonical link: https://commits.webkit.org/232151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-05 18:53:41 +00:00
~Tree();
[LFC Display] Give display boxes a back reference to the tree https://bugs.webkit.org/show_bug.cgi?id=220205 Reviewed by Zalan Bujtas. Display box code will need a back pointer to the display tree for things like paint invalidation. Pass a Tree& to box constructors, which requires that the Tree has been constructed before we make any boxes. * display/DisplayTree.cpp: (WebCore::Display::Tree::setRootStackingItem): (WebCore::Display::Tree::Tree): Deleted. * display/DisplayTree.h: (WebCore::Display::Tree::view const): (WebCore::Display::Tree::setView): * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build): * display/DisplayTreeBuilder.h: (WebCore::Display::TreeBuilder::tree const): * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::BoxFactory): (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/232730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-04 18:13:04 +00:00
View* view() const { return m_view; }
void setView(View* view) { m_view = view; }
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
[LFC Display] Store the display tree as a tree of stacking items https://bugs.webkit.org/show_bug.cgi?id=219315 Reviewed by Zalan Bujtas. Currently the display tree is a full tree, crossing stacking context boundaries, and the z-order lists are built at paint time. Change to a tree of StackingItems, where a StackingItem exists for each box that participates in the z-order sorting algorithm (i.e. boxes that are positioned, or have styles that create stacking context). Each StackingItem owns the subtree of Display::Boxes that it paints, and those subtrees are not otherwise connected. The Display::Tree owns the root StackingItem, and each StackingItem owns its child StackingItems. The StackingItem tree is built at display tree building time by storing state in the BuildingState stack. StackingItems are added to the z-order lists of their parent item at creation time; when done processing boxes for a StackingItem, we then sort its z-order lists. Add Box::participatesInZOrderSorting() and a LineBreakBox flag, and call that function instead of the version on Display::Style to work around webkit.org/b/219335 for now. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: * display/DisplayTree.cpp: (WebCore::Display::Tree::Tree): (WebCore::Display::Tree::rootBox const): * display/DisplayTree.h: (WebCore::Display::Tree::rootStackingItem const): (WebCore::Display::Tree::rootBox const): Deleted. * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::build): (WebCore::Display::TreeBuilder::pushStateForBoxDescendants): (WebCore::Display::TreeBuilder::popState): (WebCore::Display::TreeBuilder::insertIntoTree): (WebCore::Display::TreeBuilder::buildInlineDisplayTree): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::displayTreeAsText): (WebCore::Display::outputStackingTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: * display/css/DisplayBox.cpp: (WebCore::Display::Box::participatesInZOrderSorting const): * display/css/DisplayBox.h: (WebCore::Display::Box::isLineBreakBox const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::setupBoxModelBox const): * display/css/DisplayBoxFactory.h: * display/css/DisplayCSSPainter.cpp: (WebCore::Display::CSSPainter::recursivePaintDescendantsForPhase): (WebCore::Display::CSSPainter::paintAtomicallyPaintedBox): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::paintTree): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): Deleted. (WebCore::Display::CSSPainter::participatesInZOrderSorting): Deleted. (WebCore::Display::CSSPainter::collectStackingContextDescendants): Deleted. (WebCore::Display::CSSPainter::recursiveCollectLayers): Deleted. * display/css/DisplayCSSPainter.h: Canonical link: https://commits.webkit.org/232151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-05 18:53:41 +00:00
const StackingItem& rootStackingItem() const { return *m_rootStackingItem; }
[LFC Display] Introduce type-safe rect types for the display tree https://bugs.webkit.org/show_bug.cgi?id=220214 Reviewed by Alan Bujtas. Introduce AbsoluteFloatRect, UnadjustedAbsoluteFloatRect and ViewFloatRect which are type-safe float rect types for the display tree. AbsoluteFloatRect is relative to document origin. UnadjustedAbsoluteFloatRect is similar, but is computed before scrolling and transforms are taken into account. ViewFloatRect is relative to the view. * WebCore.xcodeproj/project.pbxproj: * display/DisplayGeometryTypes.h: Copied from Source/WebCore/display/css/DisplayReplacedBox.h. (WebCore::Display::intersection): (WebCore::Display::unionRect): * display/DisplayTree.cpp: (WebCore::Display::Tree::setBoxNeedsDisplay const): * display/DisplayTree.h: * display/DisplayTreeBuilder.cpp: * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::setNeedsDisplay): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): (WebCore::Display::Box::absoluteBoxRect const): (WebCore::Display::Box::absolutePaintingExtent const): * display/css/DisplayBoxClip.cpp: (WebCore::Display::BoxClip::pushClip): (WebCore::Display::BoxClip::pushRoundedClip): * display/css/DisplayBoxClip.h: (WebCore::Display::BoxClip::clipRect const): * display/css/DisplayBoxDecorationPainter.cpp: (WebCore::Display::BoxDecorationPainter::paintFillLayer const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): (WebCore::Display::BoxFactory::setupBoxGeometry const): * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): (WebCore::Display::BoxModelBox::clipForDescendants const): (WebCore::Display::BoxModelBox::absolutePaintingExtent const): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): (WebCore::Display::BoxModelBox::absoluteBorderBoxRect const): (WebCore::Display::BoxModelBox::absolutePaddingBoxRect const): (WebCore::Display::BoxModelBox::absoluteContentBoxRect const): (WebCore::Display::BoxModelBox::setAbsolutePaddingBoxRect): (WebCore::Display::BoxModelBox::setAbsoluteContentBoxRect): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: (WebCore::Display::ReplacedBox::replacedContentRect const): (WebCore::Display::ReplacedBox::setReplacedContentRect): * display/css/DisplayStackingItem.h: (WebCore::Display::StackingItem::paintedContentBounds const): (WebCore::Display::StackingItem::paintedBoundsIncludingDescendantItems const): (WebCore::Display::StackingItem::setPaintedContentBounds): (WebCore::Display::StackingItem::setPaintedBoundsIncludingDescendantItems): * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/240523@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-15 15:44:27 +00:00
const ContainerBox& rootBox() const;
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
[LFC Display] Introduce type-safe rect types for the display tree https://bugs.webkit.org/show_bug.cgi?id=220214 Reviewed by Alan Bujtas. Introduce AbsoluteFloatRect, UnadjustedAbsoluteFloatRect and ViewFloatRect which are type-safe float rect types for the display tree. AbsoluteFloatRect is relative to document origin. UnadjustedAbsoluteFloatRect is similar, but is computed before scrolling and transforms are taken into account. ViewFloatRect is relative to the view. * WebCore.xcodeproj/project.pbxproj: * display/DisplayGeometryTypes.h: Copied from Source/WebCore/display/css/DisplayReplacedBox.h. (WebCore::Display::intersection): (WebCore::Display::unionRect): * display/DisplayTree.cpp: (WebCore::Display::Tree::setBoxNeedsDisplay const): * display/DisplayTree.h: * display/DisplayTreeBuilder.cpp: * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::setNeedsDisplay): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): (WebCore::Display::Box::absoluteBoxRect const): (WebCore::Display::Box::absolutePaintingExtent const): * display/css/DisplayBoxClip.cpp: (WebCore::Display::BoxClip::pushClip): (WebCore::Display::BoxClip::pushRoundedClip): * display/css/DisplayBoxClip.h: (WebCore::Display::BoxClip::clipRect const): * display/css/DisplayBoxDecorationPainter.cpp: (WebCore::Display::BoxDecorationPainter::paintFillLayer const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): (WebCore::Display::BoxFactory::setupBoxGeometry const): * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): (WebCore::Display::BoxModelBox::clipForDescendants const): (WebCore::Display::BoxModelBox::absolutePaintingExtent const): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): (WebCore::Display::BoxModelBox::absoluteBorderBoxRect const): (WebCore::Display::BoxModelBox::absolutePaddingBoxRect const): (WebCore::Display::BoxModelBox::absoluteContentBoxRect const): (WebCore::Display::BoxModelBox::setAbsolutePaddingBoxRect): (WebCore::Display::BoxModelBox::setAbsoluteContentBoxRect): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: (WebCore::Display::ReplacedBox::replacedContentRect const): (WebCore::Display::ReplacedBox::setReplacedContentRect): * display/css/DisplayStackingItem.h: (WebCore::Display::StackingItem::paintedContentBounds const): (WebCore::Display::StackingItem::paintedBoundsIncludingDescendantItems const): (WebCore::Display::StackingItem::setPaintedContentBounds): (WebCore::Display::StackingItem::setPaintedBoundsIncludingDescendantItems): * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/240523@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-15 15:44:27 +00:00
void setBoxNeedsDisplay(Box&, std::optional<UnadjustedAbsoluteFloatRect> subrect = std::nullopt) const;
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
private:
[LFC Display] Give display boxes a back reference to the tree https://bugs.webkit.org/show_bug.cgi?id=220205 Reviewed by Zalan Bujtas. Display box code will need a back pointer to the display tree for things like paint invalidation. Pass a Tree& to box constructors, which requires that the Tree has been constructed before we make any boxes. * display/DisplayTree.cpp: (WebCore::Display::Tree::setRootStackingItem): (WebCore::Display::Tree::Tree): Deleted. * display/DisplayTree.h: (WebCore::Display::Tree::view const): (WebCore::Display::Tree::setView): * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build): * display/DisplayTreeBuilder.h: (WebCore::Display::TreeBuilder::tree const): * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::BoxFactory): (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/232730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-04 18:13:04 +00:00
void setRootStackingItem(std::unique_ptr<StackingItem>&&);
[LFC Display] Store the display tree as a tree of stacking items https://bugs.webkit.org/show_bug.cgi?id=219315 Reviewed by Zalan Bujtas. Currently the display tree is a full tree, crossing stacking context boundaries, and the z-order lists are built at paint time. Change to a tree of StackingItems, where a StackingItem exists for each box that participates in the z-order sorting algorithm (i.e. boxes that are positioned, or have styles that create stacking context). Each StackingItem owns the subtree of Display::Boxes that it paints, and those subtrees are not otherwise connected. The Display::Tree owns the root StackingItem, and each StackingItem owns its child StackingItems. The StackingItem tree is built at display tree building time by storing state in the BuildingState stack. StackingItems are added to the z-order lists of their parent item at creation time; when done processing boxes for a StackingItem, we then sort its z-order lists. Add Box::participatesInZOrderSorting() and a LineBreakBox flag, and call that function instead of the version on Display::Style to work around webkit.org/b/219335 for now. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: * display/DisplayTree.cpp: (WebCore::Display::Tree::Tree): (WebCore::Display::Tree::rootBox const): * display/DisplayTree.h: (WebCore::Display::Tree::rootStackingItem const): (WebCore::Display::Tree::rootBox const): Deleted. * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::build): (WebCore::Display::TreeBuilder::pushStateForBoxDescendants): (WebCore::Display::TreeBuilder::popState): (WebCore::Display::TreeBuilder::insertIntoTree): (WebCore::Display::TreeBuilder::buildInlineDisplayTree): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::displayTreeAsText): (WebCore::Display::outputStackingTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: * display/css/DisplayBox.cpp: (WebCore::Display::Box::participatesInZOrderSorting const): * display/css/DisplayBox.h: (WebCore::Display::Box::isLineBreakBox const): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::setupBoxModelBox const): * display/css/DisplayBoxFactory.h: * display/css/DisplayCSSPainter.cpp: (WebCore::Display::CSSPainter::recursivePaintDescendantsForPhase): (WebCore::Display::CSSPainter::paintAtomicallyPaintedBox): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::paintTree): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): Deleted. (WebCore::Display::CSSPainter::participatesInZOrderSorting): Deleted. (WebCore::Display::CSSPainter::collectStackingContextDescendants): Deleted. (WebCore::Display::CSSPainter::recursiveCollectLayers): Deleted. * display/css/DisplayCSSPainter.h: Canonical link: https://commits.webkit.org/232151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-05 18:53:41 +00:00
std::unique_ptr<StackingItem> m_rootStackingItem;
[LFC Display] Give display boxes a back reference to the tree https://bugs.webkit.org/show_bug.cgi?id=220205 Reviewed by Zalan Bujtas. Display box code will need a back pointer to the display tree for things like paint invalidation. Pass a Tree& to box constructors, which requires that the Tree has been constructed before we make any boxes. * display/DisplayTree.cpp: (WebCore::Display::Tree::setRootStackingItem): (WebCore::Display::Tree::Tree): Deleted. * display/DisplayTree.h: (WebCore::Display::Tree::view const): (WebCore::Display::Tree::setView): * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build): * display/DisplayTreeBuilder.h: (WebCore::Display::TreeBuilder::tree const): * display/css/DisplayBox.cpp: (WebCore::Display::Box::Box): * display/css/DisplayBox.h: (WebCore::Display::Box::Box): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::BoxFactory): (WebCore::Display::BoxFactory::displayBoxForRootBox const): (WebCore::Display::BoxFactory::displayBoxForLayoutBox const): (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayBoxModelBox.cpp: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayBoxModelBox.h: (WebCore::Display::BoxModelBox::BoxModelBox): * display/css/DisplayContainerBox.cpp: (WebCore::Display::ContainerBox::ContainerBox): * display/css/DisplayContainerBox.h: * display/css/DisplayImageBox.cpp: (WebCore::Display::ImageBox::ImageBox): * display/css/DisplayImageBox.h: * display/css/DisplayReplacedBox.cpp: (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: Canonical link: https://commits.webkit.org/232730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-04 18:13:04 +00:00
View* m_view { nullptr };
[LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter https://bugs.webkit.org/show_bug.cgi?id=216752 Reviewed by Zalan Bujtas. Add some Display::Box subclasses to display/css, a Display::Tree class to own the display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is the beginnings of a class that knows how to paint a CSS stacking context. This code other than DisplayCSSPainter is deliberately vague about how much is CSS specific. It's likely that some box classes will be shared with SVG painting. * CMakeLists.txt: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::RootLayerClient::paintContents): (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): (WebCore::Display::LayerController::prepareForDisplay): (WebCore::Display::LayerController::ensureRootLayer): (WebCore::Display::LayerController::updateRootLayerGeometry): * display/DisplayLayerController.h: * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::Tree): * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Tree::rootBox const): * display/DisplayTreeBuilder.cpp: Added. (WebCore::Display::TreeBuilder::TreeBuilder): (WebCore::Display::TreeBuilder::build const): (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): (WebCore::Display::TreeBuilder::displayBoxForRootBox const): (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): (WebCore::Display::outputDisplayBox): (WebCore::Display::outputDisplayTree): (WebCore::Display::showDisplayTree): * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. * display/DisplayView.cpp: (WebCore::Display::View::prepareForDisplay): (WebCore::Display::View::deviceScaleFactor const): * display/DisplayView.h: * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::debugDescription const): * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::Box::Box): (WebCore::Display::Box::style const): (WebCore::Display::Box::borderBoxFrame const): (WebCore::Display::Box::isContainerBox const): (WebCore::Display::Box::isImageBox const): (WebCore::Display::Box::isReplacedBox const): (WebCore::Display::Box::nextSibling const): * display/css/DisplayCSSPainter.cpp: Added. (WebCore::Display::CSSPainter::paintBoxDecorations): (WebCore::Display::CSSPainter::paintBoxContent): (WebCore::Display::CSSPainter::paintBox): (WebCore::Display::CSSPainter::recursivePaintDescendants): (WebCore::Display::CSSPainter::paintStackingContext): (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): (WebCore::Display::CSSPainter::recursiveCollectLayers): (WebCore::Display::CSSPainter::paintTree): * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::ContainerBox): (WebCore::Display::ContainerBox::setFirstChild): (WebCore::Display::ContainerBox::debugDescription const): * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ContainerBox::firstChild const): * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::ImageBox): (WebCore::Display::ImageBox::setImage): (WebCore::Display::ImageBox::debugDescription const): * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ImageBox::image const): * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::ReplacedBox): * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. (WebCore::Display::ReplacedBox::replacedContentRect const): * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. (WebCore::Display::Style::Style): (WebCore::Display::Style::hasBackground const): (WebCore::Display::Style::hasVisibleBorder const): * display/css/DisplayStyle.h: Added. (WebCore::Display::Style::backgroundColor const): (WebCore::Display::Style::hasBackgroundImage const): (WebCore::Display::Style::borderLeft const): (WebCore::Display::Style::borderRight const): (WebCore::Display::Style::borderTop const): (WebCore::Display::Style::borderBottom const): (WebCore::Display::Style::zIndex const): (WebCore::Display::Style::isStackingContext const): (WebCore::Display::Style::isPositioned const): (WebCore::Display::Style::isFloating const): (WebCore::Display::Style::participatesInZOrderSorting const): (WebCore::Display::Style::setIsPositioned): (WebCore::Display::Style::setIsFloating): * layout/displaytree/DisplayBox.cpp: Removed. * layout/displaytree/DisplayBox.h: Removed. * layout/layouttree/LayoutIterator.h: Unified sources build fix. Canonical link: https://commits.webkit.org/229692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 23:39:29 +00:00
};
} // namespace Display
} // namespace WebCore
#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)