Changeset 267509 in webkit
- Timestamp:
- Sep 23, 2020, 4:39:29 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 added
- 2 deleted
- 10 edited
- 13 copied
-
CMakeLists.txt (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
Headers.cmake (modified) (2 diffs)
-
Sources.txt (modified) (2 diffs)
-
WebCore.xcodeproj/project.pbxproj (modified) (7 diffs)
-
display/DisplayLayerController.cpp (modified) (5 diffs)
-
display/DisplayLayerController.h (modified) (5 diffs)
-
display/DisplayTree.cpp (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (1 diff)
-
display/DisplayTree.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (1 diff)
-
display/DisplayTreeBuilder.cpp (added)
-
display/DisplayTreeBuilder.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (1 diff)
-
display/DisplayView.cpp (modified) (3 diffs)
-
display/DisplayView.h (modified) (1 diff)
-
display/css (added)
-
display/css/DisplayBox.cpp (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (2 diffs)
-
display/css/DisplayBox.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (3 diffs)
-
display/css/DisplayCSSPainter.cpp (added)
-
display/css/DisplayCSSPainter.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (2 diffs)
-
display/css/DisplayContainerBox.cpp (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (1 diff)
-
display/css/DisplayContainerBox.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (3 diffs)
-
display/css/DisplayImageBox.cpp (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (1 diff)
-
display/css/DisplayImageBox.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (2 diffs)
-
display/css/DisplayReplacedBox.cpp (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (1 diff)
-
display/css/DisplayReplacedBox.h (copied) (copied from trunk/Source/WebCore/display/DisplayView.h ) (2 diffs)
-
display/css/DisplayStyle.cpp (copied) (copied from trunk/Source/WebCore/display/DisplayView.cpp ) (2 diffs)
-
display/css/DisplayStyle.h (added)
-
layout/displaytree/DisplayBox.cpp (deleted)
-
layout/displaytree/DisplayBox.h (deleted)
-
layout/layouttree/LayoutIterator.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r267497 r267509 86 86 "${WEBCORE_DIR}/cssjit" 87 87 "${WEBCORE_DIR}/display" 88 "${WEBCORE_DIR}/display/css" 88 89 "${WEBCORE_DIR}/dom" 89 90 "${WEBCORE_DIR}/dom/messageports" -
trunk/Source/WebCore/ChangeLog
r267507 r267509 1 2020-09-20 Simon Fraser <simon.fraser@apple.com> 2 3 [LFC Display] Add the beginnings of a CSS display box hierarchy and CSS painter 4 https://bugs.webkit.org/show_bug.cgi?id=216752 5 6 Reviewed by Zalan Bujtas. 7 8 Add some Display::Box subclasses to display/css, a Display::Tree class to own the 9 display tree, and a DisplayTreeBuilder. Also add css/DisplayCSSPainter which is 10 the beginnings of a class that knows how to paint a CSS stacking context. 11 12 This code other than DisplayCSSPainter is deliberately vague about how much is 13 CSS specific. It's likely that some box classes will be shared with SVG painting. 14 15 * CMakeLists.txt: 16 * Headers.cmake: 17 * Sources.txt: 18 * WebCore.xcodeproj/project.pbxproj: 19 * display/DisplayLayerController.cpp: 20 (WebCore::Display::LayerController::RootLayerClient::paintContents): 21 (WebCore::Display::LayerController::RootLayerClient::deviceScaleFactor const): 22 (WebCore::Display::LayerController::prepareForDisplay): 23 (WebCore::Display::LayerController::ensureRootLayer): 24 (WebCore::Display::LayerController::updateRootLayerGeometry): 25 * display/DisplayLayerController.h: 26 * display/DisplayTree.cpp: Copied from Source/WebCore/display/DisplayView.h. 27 (WebCore::Display::Tree::Tree): 28 * display/DisplayTree.h: Copied from Source/WebCore/display/DisplayView.h. 29 (WebCore::Display::Tree::rootBox const): 30 * display/DisplayTreeBuilder.cpp: Added. 31 (WebCore::Display::TreeBuilder::TreeBuilder): 32 (WebCore::Display::TreeBuilder::build const): 33 (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const): 34 (WebCore::Display::TreeBuilder::displayBoxForRootBox const): 35 (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const): 36 (WebCore::Display::outputDisplayBox): 37 (WebCore::Display::outputDisplayTree): 38 (WebCore::Display::showDisplayTree): 39 * display/DisplayTreeBuilder.h: Copied from Source/WebCore/display/DisplayView.h. 40 * display/DisplayView.cpp: 41 (WebCore::Display::View::prepareForDisplay): 42 (WebCore::Display::View::deviceScaleFactor const): 43 * display/DisplayView.h: 44 * display/css/DisplayBox.cpp: Copied from Source/WebCore/display/DisplayView.h. 45 (WebCore::Display::Box::Box): 46 (WebCore::Display::Box::setNextSibling): 47 (WebCore::Display::Box::debugDescription const): 48 * display/css/DisplayBox.h: Copied from Source/WebCore/display/DisplayView.h. 49 (WebCore::Display::Box::Box): 50 (WebCore::Display::Box::style const): 51 (WebCore::Display::Box::borderBoxFrame const): 52 (WebCore::Display::Box::isContainerBox const): 53 (WebCore::Display::Box::isImageBox const): 54 (WebCore::Display::Box::isReplacedBox const): 55 (WebCore::Display::Box::nextSibling const): 56 * display/css/DisplayCSSPainter.cpp: Added. 57 (WebCore::Display::CSSPainter::paintBoxDecorations): 58 (WebCore::Display::CSSPainter::paintBoxContent): 59 (WebCore::Display::CSSPainter::paintBox): 60 (WebCore::Display::CSSPainter::recursivePaintDescendants): 61 (WebCore::Display::CSSPainter::paintStackingContext): 62 (WebCore::Display::CSSPainter::isStackingContextPaintingBoundary): 63 (WebCore::Display::CSSPainter::recursiveCollectLayers): 64 (WebCore::Display::CSSPainter::paintTree): 65 * display/css/DisplayCSSPainter.h: Copied from Source/WebCore/display/DisplayView.h. 66 * display/css/DisplayContainerBox.cpp: Copied from Source/WebCore/display/DisplayView.h. 67 (WebCore::Display::ContainerBox::ContainerBox): 68 (WebCore::Display::ContainerBox::setFirstChild): 69 (WebCore::Display::ContainerBox::debugDescription const): 70 * display/css/DisplayContainerBox.h: Copied from Source/WebCore/display/DisplayView.h. 71 (WebCore::Display::ContainerBox::firstChild const): 72 * display/css/DisplayImageBox.cpp: Copied from Source/WebCore/display/DisplayView.h. 73 (WebCore::Display::ImageBox::ImageBox): 74 (WebCore::Display::ImageBox::setImage): 75 (WebCore::Display::ImageBox::debugDescription const): 76 * display/css/DisplayImageBox.h: Copied from Source/WebCore/display/DisplayView.h. 77 (WebCore::Display::ImageBox::image const): 78 * display/css/DisplayReplacedBox.cpp: Copied from Source/WebCore/display/DisplayView.h. 79 (WebCore::Display::ReplacedBox::ReplacedBox): 80 * display/css/DisplayReplacedBox.h: Copied from Source/WebCore/display/DisplayView.h. 81 (WebCore::Display::ReplacedBox::replacedContentRect const): 82 * display/css/DisplayStyle.cpp: Copied from Source/WebCore/display/DisplayView.cpp. 83 (WebCore::Display::Style::Style): 84 (WebCore::Display::Style::hasBackground const): 85 (WebCore::Display::Style::hasVisibleBorder const): 86 * display/css/DisplayStyle.h: Added. 87 (WebCore::Display::Style::backgroundColor const): 88 (WebCore::Display::Style::hasBackgroundImage const): 89 (WebCore::Display::Style::borderLeft const): 90 (WebCore::Display::Style::borderRight const): 91 (WebCore::Display::Style::borderTop const): 92 (WebCore::Display::Style::borderBottom const): 93 (WebCore::Display::Style::zIndex const): 94 (WebCore::Display::Style::isStackingContext const): 95 (WebCore::Display::Style::isPositioned const): 96 (WebCore::Display::Style::isFloating const): 97 (WebCore::Display::Style::participatesInZOrderSorting const): 98 (WebCore::Display::Style::setIsPositioned): 99 (WebCore::Display::Style::setIsFloating): 100 * layout/displaytree/DisplayBox.cpp: Removed. 101 * layout/displaytree/DisplayBox.h: Removed. 102 * layout/layouttree/LayoutIterator.h: Unified sources build fix. 103 1 104 2020-09-23 Chris Dumez <cdumez@apple.com> 2 105 -
trunk/Source/WebCore/Headers.cmake
r267328 r267509 363 363 364 364 display/DisplayLayerController.h 365 display/DisplayTree.h 366 display/DisplayTreeBuilder.h 365 367 display/DisplayView.h 368 369 display/css/DisplayBox.h 370 display/css/DisplayCSSPainter.h 371 display/css/DisplayContainerBox.h 372 display/css/DisplayImageBox.h 373 display/css/DisplayReplacedBox.h 374 display/css/DisplayStyle.h 366 375 367 376 dom/ActiveDOMCallback.h … … 697 706 layout/MarginTypes.h 698 707 699 layout/displaytree/DisplayBox.h700 708 layout/displaytree/DisplayInlineContent.h 701 709 layout/displaytree/DisplayLine.h -
trunk/Source/WebCore/Sources.txt
r267468 r267509 795 795 css/typedom/TypedOMCSSUnparsedValue.cpp 796 796 cssjit/SelectorCompiler.cpp 797 display/css/DisplayBox.cpp 798 display/css/DisplayContainerBox.cpp 799 display/css/DisplayCSSPainter.cpp 800 display/css/DisplayImageBox.cpp 801 display/css/DisplayReplacedBox.cpp 802 display/css/DisplayStyle.cpp 797 803 display/DisplayLayerController.cpp 804 display/DisplayTree.cpp 805 display/DisplayTreeBuilder.cpp 798 806 display/DisplayView.cpp 799 807 dom/AbortController.cpp … … 1435 1443 layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp 1436 1444 layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContextQuirks.cpp 1437 layout/displaytree/DisplayBox.cpp1438 1445 layout/displaytree/DisplayInlineContent.cpp 1439 1446 layout/displaytree/DisplayPainter.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r267491 r267509 392 392 119340A31FEE024000935F1E /* RenderTreeBuilderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */; }; 393 393 1199FA46208E35A3002358CC /* LayoutContainerBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA44208E35A3002358CC /* LayoutContainerBox.h */; settings = {ATTRIBUTES = (Private, ); }; }; 394 1199FA5B208E3C7F002358CC /* DisplayBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA59208E3C7F002358CC /* DisplayBox.h */; settings = {ATTRIBUTES = (Private, ); }; };395 394 11CB2789203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 11CB2787203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h */; }; 396 395 11E067EE1E6246E500162D16 /* SimpleLineLayoutCoverage.h in Headers */ = {isa = PBXBuildFile; fileRef = 11E067ED1E6246E500162D16 /* SimpleLineLayoutCoverage.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 6091 6090 0FFD4D5E18651FA300512F6E /* AsyncScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncScrollingCoordinator.cpp; sourceTree = "<group>"; }; 6092 6091 0FFD4D5F18651FA300512F6E /* AsyncScrollingCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncScrollingCoordinator.h; sourceTree = "<group>"; }; 6092 0FFF1B72251BC6570098795A /* DisplayBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayBox.cpp; sourceTree = "<group>"; }; 6093 0FFF1B73251BC6570098795A /* DisplayStyle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayStyle.h; sourceTree = "<group>"; }; 6094 0FFF1B74251BC6570098795A /* DisplayContainerBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayContainerBox.cpp; sourceTree = "<group>"; }; 6095 0FFF1B75251BC6570098795A /* DisplayImageBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayImageBox.cpp; sourceTree = "<group>"; }; 6096 0FFF1B76251BC6570098795A /* DisplayStyle.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayStyle.cpp; sourceTree = "<group>"; }; 6097 0FFF1B77251BC6570098795A /* DisplayCSSPainter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayCSSPainter.h; sourceTree = "<group>"; }; 6098 0FFF1B78251BC6570098795A /* DisplayBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayBox.h; sourceTree = "<group>"; }; 6099 0FFF1B79251BC6570098795A /* DisplayReplacedBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayReplacedBox.h; sourceTree = "<group>"; }; 6100 0FFF1B7A251BC6570098795A /* DisplayContainerBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayContainerBox.h; sourceTree = "<group>"; }; 6101 0FFF1B7B251BC6570098795A /* DisplayImageBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayImageBox.h; sourceTree = "<group>"; }; 6102 0FFF1B7C251BC6570098795A /* DisplayReplacedBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayReplacedBox.cpp; sourceTree = "<group>"; }; 6103 0FFF1B7D251BC6570098795A /* DisplayCSSPainter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayCSSPainter.cpp; sourceTree = "<group>"; }; 6104 0FFF1B7F251BC6620098795A /* DisplayTreeBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayTreeBuilder.h; sourceTree = "<group>"; }; 6105 0FFF1B80251BC6620098795A /* DisplayTreeBuilder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayTreeBuilder.cpp; sourceTree = "<group>"; }; 6106 0FFF1B81251BC6630098795A /* DisplayTree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayTree.h; sourceTree = "<group>"; }; 6107 0FFF1B82251BC6630098795A /* DisplayTree.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayTree.cpp; sourceTree = "<group>"; }; 6093 6108 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; }; 6094 6109 1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TrailingFloatsRootInlineBox.cpp; sourceTree = "<group>"; }; … … 6135 6150 1199FA44208E35A3002358CC /* LayoutContainerBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContainerBox.h; sourceTree = "<group>"; }; 6136 6151 1199FA45208E35A3002358CC /* LayoutContainerBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContainerBox.cpp; sourceTree = "<group>"; }; 6137 1199FA59208E3C7F002358CC /* DisplayBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayBox.h; sourceTree = "<group>"; };6138 1199FA5A208E3C7F002358CC /* DisplayBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayBox.cpp; sourceTree = "<group>"; };6139 6152 11B042FB20B0E21400828A6B /* LayoutDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutDescendantIterator.h; sourceTree = "<group>"; }; 6140 6153 11C5F1162003E7750001AE60 /* RenderTreeBuilderInline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderInline.cpp; sourceTree = "<group>"; }; … … 17431 17444 isa = PBXGroup; 17432 17445 children = ( 17446 0FFF1B71251BC6570098795A /* css */, 17433 17447 0F790F402517CE6D009BA034 /* DisplayLayerController.cpp */, 17434 17448 0F790F3E2517CE6D009BA034 /* DisplayLayerController.h */, 17449 0FFF1B82251BC6630098795A /* DisplayTree.cpp */, 17450 0FFF1B81251BC6630098795A /* DisplayTree.h */, 17451 0FFF1B80251BC6620098795A /* DisplayTreeBuilder.cpp */, 17452 0FFF1B7F251BC6620098795A /* DisplayTreeBuilder.h */, 17435 17453 0F790F3D2517CE6D009BA034 /* DisplayView.cpp */, 17436 17454 0F790F3F2517CE6D009BA034 /* DisplayView.h */, … … 17455 17473 ); 17456 17474 path = displaylists; 17475 sourceTree = "<group>"; 17476 }; 17477 0FFF1B71251BC6570098795A /* css */ = { 17478 isa = PBXGroup; 17479 children = ( 17480 0FFF1B72251BC6570098795A /* DisplayBox.cpp */, 17481 0FFF1B78251BC6570098795A /* DisplayBox.h */, 17482 0FFF1B74251BC6570098795A /* DisplayContainerBox.cpp */, 17483 0FFF1B7A251BC6570098795A /* DisplayContainerBox.h */, 17484 0FFF1B7D251BC6570098795A /* DisplayCSSPainter.cpp */, 17485 0FFF1B77251BC6570098795A /* DisplayCSSPainter.h */, 17486 0FFF1B75251BC6570098795A /* DisplayImageBox.cpp */, 17487 0FFF1B7B251BC6570098795A /* DisplayImageBox.h */, 17488 0FFF1B7C251BC6570098795A /* DisplayReplacedBox.cpp */, 17489 0FFF1B79251BC6570098795A /* DisplayReplacedBox.h */, 17490 0FFF1B76251BC6570098795A /* DisplayStyle.cpp */, 17491 0FFF1B73251BC6570098795A /* DisplayStyle.h */, 17492 ); 17493 path = css; 17457 17494 sourceTree = "<group>"; 17458 17495 }; … … 17565 17602 isa = PBXGroup; 17566 17603 children = ( 17567 1199FA5A208E3C7F002358CC /* DisplayBox.cpp */,17568 1199FA59208E3C7F002358CC /* DisplayBox.h */,17569 17604 E4FB4B35239BEB10003C336A /* DisplayInlineContent.cpp */, 17570 17605 E451C6332394058E00993190 /* DisplayInlineContent.h */, … … 31075 31110 F47A09D120A93A9700240FAE /* DisabledAdaptations.h in Headers */, 31076 31111 7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */, 31077 1199FA5B208E3C7F002358CC /* DisplayBox.h in Headers */,31078 31112 E451C6342394058F00993190 /* DisplayInlineContent.h in Headers */, 31079 31113 0F790F422517CE6E009BA034 /* DisplayLayerController.h in Headers */, -
trunk/Source/WebCore/display/DisplayLayerController.cpp
r267328 r267509 31 31 #include "Chrome.h" 32 32 #include "ChromeClient.h" 33 #include "DisplayPainter.h" 33 #include "DisplayCSSPainter.h" 34 #include "DisplayTree.h" 34 35 #include "DisplayView.h" 35 36 #include "Frame.h" 36 37 #include "FrameView.h" 37 #include "LayoutBoxGeometry.h"38 #include "LayoutContext.h"39 #include "LayoutState.h"40 38 #include "Logging.h" 41 39 #include "Page.h" … … 61 59 ASSERT_UNUSED(layer, layer == m_layerController.contentLayer()); 62 60 63 // FIXME: Temporary; once we do scrolling this root layer won't paint anything. 64 if (auto* layoutState = m_layerController.view().layoutState()) 65 Layout::LayoutContext::paint(*layoutState, context, enclosingIntRect(dirtyRect)); 66 } 67 68 WTF_MAKE_ISO_ALLOCATED_IMPL(LayerController); 61 if (auto* displayTree = m_layerController.m_displayTree.get()) 62 CSSPainter::paintTree(*displayTree, context, enclosingIntRect(dirtyRect)); 63 } 64 65 float LayerController::RootLayerClient::deviceScaleFactor() const 66 { 67 return m_layerController.view().deviceScaleFactor(); 68 } 69 69 70 70 LayerController::LayerController(View& view) … … 76 76 LayerController::~LayerController() = default; 77 77 78 void LayerController::prepareForDisplay(const Layout::LayoutState& layoutState) 79 { 80 if (!layoutState.hasRoot()) 81 return; 82 83 auto& rootLayoutBox = layoutState.root(); 84 if (!rootLayoutBox.firstChild()) 85 return; 86 87 ASSERT(layoutState.hasBoxGeometry(rootLayoutBox)); 88 89 auto viewSize = layoutState.geometryForBox(rootLayoutBox).logicalSize(); 90 auto contentSize = layoutState.geometryForBox(*rootLayoutBox.firstChild()).logicalSize(); 91 92 // FIXME: Using the firstChild() size won't be correct until we compute overflow correctly, 93 contentSize.clampToMinimumSize(viewSize); 78 void LayerController::prepareForDisplay(std::unique_ptr<Display::Tree>&& displayTree) 79 { 80 ASSERT(displayTree); 81 m_displayTree = WTFMove(displayTree); 82 83 auto viewSize = m_displayTree->rootBox().borderBoxFrame().size(); 84 // FIXME: Do overflow etc. 85 auto contentSize = viewSize; 94 86 95 87 LOG_WITH_STREAM(FormattingContextLayout, stream << "LayerController::prepareForDisplay - viewSize " << viewSize << " contentSize " << contentSize); … … 137 129 } 138 130 139 void LayerController::ensureRootLayer( LayoutSize viewSize, LayoutSize contentSize)131 void LayerController::ensureRootLayer(FloatSize viewSize, FloatSize contentSize) 140 132 { 141 133 if (m_rootLayer) { … … 172 164 } 173 165 174 void LayerController::updateRootLayerGeometry( LayoutSize viewSize, LayoutSize contentSize)166 void LayerController::updateRootLayerGeometry(FloatSize viewSize, FloatSize contentSize) 175 167 { 176 168 m_rootLayer->setSize(viewSize); -
trunk/Source/WebCore/display/DisplayLayerController.h
r267328 r267509 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayRect.h"31 30 #include "GraphicsLayer.h" 32 #include "LayoutUnits.h"33 31 #include <wtf/IsoMalloc.h> 34 32 … … 38 36 class GraphicsLayerFactory; 39 37 40 namespace Layout {41 class LayoutState;42 }43 44 38 namespace Display { 45 39 40 class Tree; 46 41 class View; 47 42 48 43 // A controller object that makes layerization decisions for a display tree, for a single document. 49 44 class LayerController { 50 WTF_MAKE_ ISO_ALLOCATED(LayerController);45 WTF_MAKE_FAST_ALLOCATED(LayerController); 51 46 public: 52 47 explicit LayerController(View&); 53 48 ~LayerController(); 54 49 55 void prepareForDisplay( const Layout::LayoutState&);50 void prepareForDisplay(std::unique_ptr<Display::Tree>&&); 56 51 void flushLayers(); 57 52 … … 61 56 62 57 private: 63 void ensureRootLayer(LayoutSize viewSize, LayoutSize contentSize);64 58 void attachRootLayer(); 65 59 void detachRootLayer(); 60 61 void ensureRootLayer(FloatSize viewSize, FloatSize contentSize); 62 void updateRootLayerGeometry(FloatSize viewSize, FloatSize contentSize); 63 66 64 void setupRootLayerHierarchy(); 67 void updateRootLayerGeometry(LayoutSize viewSize, LayoutSize contentSize);68 65 void scheduleRenderingUpdate(); 69 66 … … 83 80 void notifyFlushRequired(const GraphicsLayer*) final; 84 81 void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect&, GraphicsLayerPaintBehavior) final; 82 float deviceScaleFactor() const final; 85 83 86 84 LayerController& m_layerController; … … 93 91 RefPtr<GraphicsLayer> m_contentHostLayer; 94 92 RefPtr<GraphicsLayer> m_contentLayer; 93 94 std::unique_ptr<Display::Tree> m_displayTree; 95 95 }; 96 96 -
trunk/Source/WebCore/display/DisplayTree.cpp
r267508 r267509 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "DisplayTree.h" 27 28 28 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 30 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 31 #include <wtf/IsoMallocInlines.h> 34 32 35 33 namespace WebCore { 36 37 class Frame;38 class FrameView;39 class Page;40 41 namespace Layout {42 class LayoutState;43 class LayoutTree;44 }45 46 34 namespace Display { 47 35 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 51 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 65 66 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 69 }; 36 Tree::Tree(std::unique_ptr<ContainerBox>&& rootBox) 37 : m_rootBox(WTFMove(rootBox)) 38 { 39 ASSERT(m_rootBox); 40 } 70 41 71 42 } // namespace Display -
trunk/Source/WebCore/display/DisplayTree.h
r267508 r267509 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 30 #include "DisplayContainerBox.h" 33 31 #include <wtf/IsoMalloc.h> 34 32 35 33 namespace WebCore { 36 37 class Frame;38 class FrameView;39 class Page;40 41 namespace Layout {42 class LayoutState;43 class LayoutTree;44 }45 46 34 namespace Display { 47 35 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 36 class Tree { 37 WTF_MAKE_FAST_ALLOCATED(Tree); 51 38 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 39 Tree(std::unique_ptr<ContainerBox>&&); 59 40 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 41 const ContainerBox& rootBox() const { return *m_rootBox; } 65 42 66 43 private: 67 FrameView& m_frameView;68 LayerController m_layerController;44 // Ideally this root box would be agnostic to display type (CSS vs SVG). 45 std::unique_ptr<ContainerBox> m_rootBox; 69 46 }; 70 47 -
trunk/Source/WebCore/display/DisplayTreeBuilder.h
r267508 r267509 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h"31 #include "DisplayRect.h"32 #include "LayoutUnits.h"33 30 #include <wtf/IsoMalloc.h> 34 31 35 32 namespace WebCore { 36 33 37 class Frame;38 class FrameView;39 class Page;40 41 34 namespace Layout { 35 class Box; 36 class BoxGeometry; 42 37 class LayoutState; 43 class LayoutTree;44 38 } 45 39 46 40 namespace Display { 47 41 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 42 class Box; 43 class ContainerBox; 44 class Tree; 45 46 class TreeBuilder { 51 47 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 48 explicit TreeBuilder(float pixelSnappingFactor); 59 49 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 50 std::unique_ptr<Tree> build(const Layout::LayoutState&) const; 65 51 66 52 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 53 std::unique_ptr<Box> displayBoxForRootBox(const Layout::BoxGeometry&, const Layout::ContainerBox&) const; 54 std::unique_ptr<Box> displayBoxForLayoutBox(const Layout::BoxGeometry&, const Layout::Box&, LayoutSize offsetFromRoot) const; 55 56 Box* recursiveBuildDisplayTree(const Layout::LayoutState&, LayoutSize offsetFromRoot, const Layout::Box&, Display::ContainerBox& parentDisplayBox, Display::Box* previousSiblingBox = nullptr) const; 57 58 float m_pixelSnappingFactor { 1 }; 69 59 }; 60 61 #if ENABLE(TREE_DEBUGGING) 62 void showDisplayTree(const Box&); 63 #endif 70 64 71 65 } // namespace Display -
trunk/Source/WebCore/display/DisplayView.cpp
r267328 r267509 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 30 30 31 #include "DisplayTreeBuilder.h" 31 32 #include "Frame.h" 32 33 #include "FrameView.h" 33 #include "FrameViewLayoutContext.h"34 #include "LayoutContext.h"35 #include "LayoutState.h"36 34 #include "Page.h" 37 35 #include <wtf/IsoMallocInlines.h> … … 73 71 return; 74 72 75 m_layerController.prepareForDisplay(*layoutState); 73 auto treeBuilder = TreeBuilder { deviceScaleFactor() }; 74 auto displayTree = treeBuilder.build(*layoutState); 75 76 m_layerController.prepareForDisplay(WTFMove(displayTree)); 76 77 } 77 78 … … 86 87 } 87 88 89 float View::deviceScaleFactor() const 90 { 91 return page() ? page()->deviceScaleFactor() : 1.0f; 92 } 93 88 94 } // namespace Display 89 95 } // namespace WebCore -
trunk/Source/WebCore/display/DisplayView.h
r267328 r267509 62 62 Frame& frame() const; 63 63 64 float deviceScaleFactor() const; 65 66 private: 64 67 const Layout::LayoutState* layoutState() const; 65 68 66 private:67 69 FrameView& m_frameView; 68 70 LayerController m_layerController; -
trunk/Source/WebCore/display/css/DisplayBox.cpp
r267508 r267509 1 1 /* 2 * Copyright (C) 20 20Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "DisplayBox.h" 27 28 28 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 30 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 31 #include <wtf/IsoMallocInlines.h> 32 #include <wtf/text/TextStream.h> 34 33 35 34 namespace WebCore { 35 namespace Display { 36 36 37 class Frame; 38 class FrameView; 39 class Page; 40 41 namespace Layout { 42 class LayoutState; 43 class LayoutTree; 37 Box::Box(AbsoluteFloatRect borderBox, Style&& displayStyle, OptionSet<Flags> flags) 38 : m_borderBoxFrame(borderBox) 39 , m_style(WTFMove(displayStyle)) 40 , m_flags(flags) 41 { 44 42 } 45 43 46 namespace Display { 44 void Box::setNextSibling(std::unique_ptr<Box>&& box) 45 { 46 m_nextSibling = WTFMove(box); 47 } 47 48 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 51 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 65 66 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 69 }; 49 String Box::debugDescription() const 50 { 51 TextStream stream; 52 stream << "display box " << borderBoxFrame() << " (" << this << ")"; 53 return stream.release(); 54 } 70 55 71 56 } // namespace Display -
trunk/Source/WebCore/display/css/DisplayBox.h
r267508 r267509 1 1 /* 2 * Copyright (C) 20 20Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 30 #include "DisplayStyle.h" 31 #include "FloatRect.h" 33 32 #include <wtf/IsoMalloc.h> 33 #include <wtf/OptionSet.h> 34 34 35 35 namespace WebCore { 36 37 class Frame;38 class FrameView;39 class Page;40 41 namespace Layout {42 class LayoutState;43 class LayoutTree;44 }45 46 36 namespace Display { 47 37 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 38 // FIXME: Make this a strong type. 39 using AbsoluteFloatRect = FloatRect; 40 41 class Box { 42 WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(Box); 51 43 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 44 enum class Flags : uint8_t { 45 ContainerBox = 1 << 0, 46 ImageBox = 1 << 1, 47 }; 59 48 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 49 Box(AbsoluteFloatRect borderBox, Style&&, OptionSet<Flags> = { }); 50 virtual ~Box() = default; 63 51 64 const Layout::LayoutState* layoutState() const; 52 const Style& style() const { return m_style; } 53 54 AbsoluteFloatRect borderBoxFrame() const { return m_borderBoxFrame; } 55 56 bool isContainerBox() const { return m_flags.contains(Flags::ContainerBox); } 57 bool isImageBox() const { return m_flags.contains(Flags::ImageBox); } 58 bool isReplacedBox() const { return m_flags.contains(Flags::ImageBox); /* and other types later. */ } 59 60 const Box* nextSibling() const { return m_nextSibling.get(); } 61 void setNextSibling(std::unique_ptr<Box>&&); 62 63 virtual String debugDescription() const; 65 64 66 65 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 66 AbsoluteFloatRect m_borderBoxFrame; 67 Style m_style; 68 std::unique_ptr<Box> m_nextSibling; 69 OptionSet<Flags> m_flags; 69 70 }; 70 71 … … 72 73 } // namespace WebCore 73 74 75 #define SPECIALIZE_TYPE_TRAITS_DISPLAY_BOX(ToValueTypeName, predicate) \ 76 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Display::ToValueTypeName) \ 77 static bool isType(const WebCore::Display::Box& box) { return box.predicate; } \ 78 SPECIALIZE_TYPE_TRAITS_END() 79 74 80 #endif // ENABLE(LAYOUT_FORMATTING_CONTEXT) -
trunk/Source/WebCore/display/css/DisplayCSSPainter.h
r267508 r267509 1 1 /* 2 * Copyright (C) 20 20Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 30 #include "FloatSize.h" 31 #include <wtf/Vector.h> 34 32 35 33 namespace WebCore { 36 34 37 class Frame; 38 class FrameView; 39 class Page; 40 41 namespace Layout { 42 class LayoutState; 43 class LayoutTree; 44 } 35 class GraphicsContext; 36 class IntRect; 45 37 46 38 namespace Display { 47 39 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 40 class Box; 41 class ContainerBox; 42 class Tree; 43 44 class CSSPainter { 51 45 public: 52 explicit View(FrameView&); 53 ~View(); 46 static void paintStackingContext(const Box&, GraphicsContext&, const IntRect& dirtyRect); 54 47 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 48 static void paintTree(const Tree&, GraphicsContext&, const IntRect& dirtyRect); 59 49 60 Page* page() const;61 FrameView& frameView() const { return m_frameView; }62 Frame& frame() const;63 64 const Layout::LayoutState* layoutState() const;65 50 66 51 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 52 static void paintBox(const Box&, GraphicsContext&, const IntRect& dirtyRect); 53 static void paintBoxDecorations(const Box&, GraphicsContext&); 54 static void paintBoxContent(const Box&, GraphicsContext&); 55 56 enum class PaintPhase { 57 BlockBackgrounds, 58 Floats, 59 BlockForegrounds 60 }; 61 static void recursivePaintDescendants(const ContainerBox&, GraphicsContext&, PaintPhase); 62 63 static bool isStackingContextPaintingBoundary(const Box&); 64 static void recursiveCollectLayers(const ContainerBox&, Vector<const Box*>& negativeZOrderList, Vector<const Box*>& positiveZOrderList); 69 65 }; 70 66 -
trunk/Source/WebCore/display/css/DisplayContainerBox.cpp
r267508 r267509 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "DisplayContainerBox.h" 27 28 28 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 30 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 31 #include "DisplayStyle.h" 32 #include <wtf/IsoMallocInlines.h> 34 33 35 34 namespace WebCore { 35 namespace Display { 36 36 37 class Frame; 38 class FrameView; 39 class Page; 40 41 namespace Layout { 42 class LayoutState; 43 class LayoutTree; 37 ContainerBox::ContainerBox(AbsoluteFloatRect borderBox, Style&& displayStyle) 38 : Box(borderBox, WTFMove(displayStyle), { Flags::ContainerBox }) 39 { 44 40 } 45 41 46 namespace Display { 42 void ContainerBox::setFirstChild(std::unique_ptr<Box>&& box) 43 { 44 m_firstChild = WTFMove(box); 45 } 47 46 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 51 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 65 66 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 69 }; 47 String ContainerBox::debugDescription() const 48 { 49 TextStream stream; 50 stream << "container box " << borderBoxFrame() << " (" << this << ")"; 51 return stream.release(); 52 } 70 53 71 54 } // namespace Display -
trunk/Source/WebCore/display/css/DisplayContainerBox.h
r267508 r267509 1 1 /* 2 * Copyright (C) 20 20Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 30 #include "DisplayBox.h" 34 31 35 32 namespace WebCore { 36 37 class Frame;38 class FrameView;39 class Page;40 41 namespace Layout {42 class LayoutState;43 class LayoutTree;44 }45 46 33 namespace Display { 47 34 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 35 class ContainerBox : public Box { 36 WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(ContainerBox); 51 37 public: 52 explicit View(FrameView&); 53 ~View(); 38 ContainerBox(AbsoluteFloatRect borderBox, Style&&); 54 39 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 40 const Box* firstChild() const { return m_firstChild.get(); } 41 void setFirstChild(std::unique_ptr<Box>&&); 65 42 66 43 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 44 String debugDescription() const override; 45 46 std::unique_ptr<Box> m_firstChild; 69 47 }; 70 48 … … 72 50 } // namespace WebCore 73 51 52 SPECIALIZE_TYPE_TRAITS_DISPLAY_BOX(ContainerBox, isContainerBox()) 53 74 54 #endif // ENABLE(LAYOUT_FORMATTING_CONTEXT) -
trunk/Source/WebCore/display/css/DisplayImageBox.cpp
r267508 r267509 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "DisplayImageBox.h" 27 28 28 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 30 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 31 #include "Image.h" 32 #include <wtf/IsoMallocInlines.h> 34 33 35 34 namespace WebCore { 35 namespace Display { 36 36 37 class Frame; 38 class FrameView; 39 class Page; 40 41 namespace Layout { 42 class LayoutState; 43 class LayoutTree; 37 ImageBox::ImageBox(AbsoluteFloatRect borderBox, Style&& displayStyle, AbsoluteFloatRect replacedContentRect) 38 : ReplacedBox(borderBox, WTFMove(displayStyle), { Flags::ImageBox }, replacedContentRect) 39 { 44 40 } 45 41 46 namespace Display { 42 void ImageBox::setImage(Image* image) 43 { 44 m_image = image; 45 } 47 46 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 51 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 65 66 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 69 }; 47 String ImageBox::debugDescription() const 48 { 49 TextStream stream; 50 stream << "image box " << borderBoxFrame() << " (" << this << ") replaced content rect: " << replacedContentRect() << " image: " << m_image.get(); 51 return stream.release(); 52 } 70 53 71 54 } // namespace Display -
trunk/Source/WebCore/display/css/DisplayImageBox.h
r267508 r267509 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 30 #include "DisplayReplacedBox.h" 34 31 35 32 namespace WebCore { 36 33 37 class Frame; 38 class FrameView; 39 class Page; 40 41 namespace Layout { 42 class LayoutState; 43 class LayoutTree; 44 } 34 class Image; 45 35 46 36 namespace Display { 47 37 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 38 class Style; 39 40 class ImageBox : public ReplacedBox { 41 WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(ImageBox); 51 42 public: 52 explicit View(FrameView&); 53 ~View(); 43 ImageBox(AbsoluteFloatRect borderBox, Style&&, AbsoluteFloatRect replacedContentRect); 54 44 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 45 Image* image() const { return m_image.get(); } 46 void setImage(Image*); 65 47 66 48 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 49 String debugDescription() const final; 50 51 RefPtr<Image> m_image; 69 52 }; 70 53 … … 72 55 } // namespace WebCore 73 56 57 SPECIALIZE_TYPE_TRAITS_DISPLAY_BOX(ImageBox, isImageBox()) 58 74 59 #endif // ENABLE(LAYOUT_FORMATTING_CONTEXT) -
trunk/Source/WebCore/display/css/DisplayReplacedBox.cpp
r267508 r267509 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "DisplayReplacedBox.h" 27 28 28 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 30 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 31 #include <wtf/IsoMallocInlines.h> 34 32 35 33 namespace WebCore { 36 37 class Frame;38 class FrameView;39 class Page;40 41 namespace Layout {42 class LayoutState;43 class LayoutTree;44 }45 46 34 namespace Display { 47 35 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 51 public: 52 explicit View(FrameView&); 53 ~View(); 54 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 65 66 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 69 }; 36 ReplacedBox::ReplacedBox(AbsoluteFloatRect borderBox, Style&& displayStyle, OptionSet<Flags> flags, AbsoluteFloatRect replacedContentRect) 37 : Box(borderBox, WTFMove(displayStyle), flags) 38 , m_replacedContentRect(replacedContentRect) 39 { 40 } 70 41 71 42 } // namespace Display -
trunk/Source/WebCore/display/css/DisplayReplacedBox.h
r267508 r267509 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "DisplayLayerController.h" 31 #include "DisplayRect.h" 32 #include "LayoutUnits.h" 33 #include <wtf/IsoMalloc.h> 30 #include "DisplayBox.h" 34 31 35 32 namespace WebCore { 36 37 class Frame;38 class FrameView;39 class Page;40 41 namespace Layout {42 class LayoutState;43 class LayoutTree;44 }45 46 33 namespace Display { 47 34 48 // The root object which renders a display tree for a single document. 49 class View { 50 WTF_MAKE_ISO_ALLOCATED(View); 35 class ReplacedBox : public Box { 36 WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(ReplacedBox); 51 37 public: 52 explicit View(FrameView&); 53 ~View(); 38 ReplacedBox(AbsoluteFloatRect borderBox, Style&&, OptionSet<Flags>, AbsoluteFloatRect replacedContentRect); 54 39 55 void prepareForDisplay(); 56 void flushLayers(); 57 58 void setIsInWindow(bool); 59 60 Page* page() const; 61 FrameView& frameView() const { return m_frameView; } 62 Frame& frame() const; 63 64 const Layout::LayoutState* layoutState() const; 40 AbsoluteFloatRect replacedContentRect() const { return m_replacedContentRect; } 65 41 66 42 private: 67 FrameView& m_frameView; 68 LayerController m_layerController; 43 AbsoluteFloatRect m_replacedContentRect; 69 44 }; 70 45 … … 72 47 } // namespace WebCore 73 48 49 SPECIALIZE_TYPE_TRAITS_DISPLAY_BOX(ReplacedBox, isReplacedBox()) 50 74 51 #endif // ENABLE(LAYOUT_FORMATTING_CONTEXT) -
trunk/Source/WebCore/display/css/DisplayStyle.cpp
r267508 r267509 25 25 26 26 #include "config.h" 27 #include "Display View.h"27 #include "DisplayStyle.h" 28 28 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 30 30 31 #include "Frame.h" 32 #include "FrameView.h" 33 #include "FrameViewLayoutContext.h" 34 #include "LayoutContext.h" 35 #include "LayoutState.h" 36 #include "Page.h" 31 #include "BorderData.h" 32 #include "RenderStyle.h" 37 33 #include <wtf/IsoMallocInlines.h> 38 34 … … 40 36 namespace Display { 41 37 42 WTF_MAKE_ISO_ALLOCATED_IMPL(View); 38 Style::Style(const RenderStyle& style) 39 { 40 m_backgroundColor = style.visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor); 43 41 44 View::View(FrameView& frameView) 45 : m_frameView(frameView) 46 , m_layerController(*this) 47 { 42 const auto& borderData = style.border(); 43 44 auto borderValueWithResolvedColor = [&style](const BorderValue& value, CSSPropertyID colorPropertyID) { 45 auto resolvedValue = value; 46 resolvedValue.setColor(style.visitedDependentColorWithColorFilter(colorPropertyID)); 47 return resolvedValue; 48 }; 49 50 m_border.left = borderValueWithResolvedColor(borderData.left(), CSSPropertyBorderLeftColor); 51 m_border.right = borderValueWithResolvedColor(borderData.right(), CSSPropertyBorderRightColor); 52 m_border.top = borderValueWithResolvedColor(borderData.top(), CSSPropertyBorderTopColor); 53 m_border.bottom = borderValueWithResolvedColor(borderData.bottom(), CSSPropertyBorderBottomColor); 54 55 m_border.image = borderData.image(); 56 57 if (!style.hasAutoUsedZIndex()) 58 m_zIndex = style.usedZIndex(); 59 60 setIsPositioned(style.position() != PositionType::Static); 61 setIsFloating(style.floating() != Float::No); 48 62 } 49 63 50 View::~View() 64 bool Style::hasBackground() const 51 65 { 66 return m_backgroundColor.isVisible() || hasBackgroundImage(); 52 67 } 53 68 54 Frame& View::frame() const69 bool Style::hasVisibleBorder() const 55 70 { 56 return m_frameView.frame(); 57 } 58 59 Page* View::page() const 60 { 61 return m_frameView.frame().page(); 62 } 63 64 const Layout::LayoutState* View::layoutState() const 65 { 66 return m_frameView.layoutContext().layoutFormattingState(); 67 } 68 69 void View::prepareForDisplay() 70 { 71 auto* layoutState = this->layoutState(); 72 if (!layoutState) 73 return; 74 75 m_layerController.prepareForDisplay(*layoutState); 76 } 77 78 void View::flushLayers() 79 { 80 m_layerController.flushLayers(); 81 } 82 83 void View::setIsInWindow(bool isInWindow) 84 { 85 m_layerController.setIsInWindow(isInWindow); 71 bool haveImage = m_border.image.hasImage(); 72 return m_border.left.isVisible(!haveImage) || m_border.right.isVisible(!haveImage) || m_border.top.isVisible(!haveImage) || m_border.bottom.isVisible(!haveImage); 86 73 } 87 74 -
trunk/Source/WebCore/layout/layouttree/LayoutIterator.h
r259180 r267509 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutInitialContainingBlock.h" 31 30 32 namespace WebCore { 31 33 namespace Layout {
Note:
See TracChangeset
for help on using the changeset viewer.