Changeset 252893 in webkit
- Timestamp:
- Nov 26, 2019 12:15:39 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252891 r252893 1 2019-11-26 Antti Koivisto <antti@apple.com> 2 3 [LFC][Render tree] Add LFC line layout path to RenderBlockFlow 4 https://bugs.webkit.org/show_bug.cgi?id=204613 5 6 Reviewed by Zalan Bujtas. 7 8 Add a basic LFC line layout implementation for RenderBlockFlow. 9 It can layout lines and do simple painting but doesn't do anything else (like hit testing) yet. 10 11 Add a new layoutFormattingContextRenderTreeIntegrationEnabled feature flag, default to false. 12 13 * Sources.txt: 14 * WebCore.xcodeproj/project.pbxproj: 15 * layout/RenderBlockFlowLineLayout.cpp: Added. 16 (WebCore::Layout::RenderBlockFlowLineLayout::RenderBlockFlowLineLayout): 17 (WebCore::Layout::RenderBlockFlowLineLayout::canUseFor): 18 (WebCore::Layout::RenderBlockFlowLineLayout::layout): 19 (WebCore::Layout::RenderBlockFlowLineLayout::height const): 20 (WebCore::Layout::RenderBlockFlowLineLayout::paint): 21 * layout/RenderBlockFlowLineLayout.h: Copied from Source/WebCore/layout/displaytree/DisplayPainter.h. 22 * layout/displaytree/DisplayPainter.cpp: 23 (WebCore::Display::Painter::paintInlineFlow): 24 * layout/displaytree/DisplayPainter.h: 25 * layout/invalidation/InvalidationState.cpp: 26 (WebCore::Layout::InvalidationState::markNeedsUpdate): 27 * layout/layouttree/LayoutTreeBuilder.cpp: 28 (WebCore::Layout::TreeBuilder::buildLayoutTree): 29 * layout/layouttree/LayoutTreeBuilder.h: 30 * page/RuntimeEnabledFeatures.h: 31 (WebCore::RuntimeEnabledFeatures::setLayoutFormattingContextRenderTreeIntegrationEnabled): 32 (WebCore::RuntimeEnabledFeatures::layoutFormattingContextRenderTreeIntegrationEnabled const): 33 * rendering/RenderBlockFlow.cpp: 34 (WebCore::RenderBlockFlow::layoutInlineChildren): 35 (WebCore::RenderBlockFlow::addOverflowFromInlineChildren): 36 (WebCore::RenderBlockFlow::paintInlineChildren): 37 (WebCore::RenderBlockFlow::invalidateLineLayoutPath): 38 (WebCore::RenderBlockFlow::layoutSimpleLines): 39 (WebCore::RenderBlockFlow::layoutLFCLines): 40 (WebCore::RenderBlockFlow::deleteLineBoxesBeforeSimpleLineLayout): 41 * rendering/RenderBlockFlow.h: 42 (WebCore::RenderBlockFlow::hasLFCLineLayout const): 43 (WebCore::RenderBlockFlow::lfcLineLayout const): 44 (WebCore::RenderBlockFlow::lfcLineLayout): 45 1 46 2019-11-26 Antti Koivisto <antti@apple.com> 2 47 -
trunk/Source/WebCore/Sources.txt
r252865 r252893 1422 1422 layout/LayoutState.cpp 1423 1423 layout/LayoutUnits.cpp 1424 layout/RenderBlockFlowLineLayout.cpp 1424 1425 layout/Verification.cpp 1425 1426 layout/blockformatting/BlockFormattingContext.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r252865 r252893 4852 4852 E4A814E01C7338EB00BF85AC /* IdChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */; }; 4853 4853 E4A8D21622578DB700A8463C /* EventRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A8D21422578DA000A8463C /* EventRegion.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4854 E4ABABDD236088FE00FA4345 /* RenderBlockFlowLineLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = E4ABABDB236088FD00FA4345 /* RenderBlockFlowLineLayout.h */; }; 4854 4855 E4ABABE42361A32900FA4345 /* PropertyCascade.h in Headers */ = {isa = PBXBuildFile; fileRef = E4ABABE22361A32900FA4345 /* PropertyCascade.h */; }; 4855 4856 E4ABABF32368B95900FA4345 /* StyleBuilderState.h in Headers */ = {isa = PBXBuildFile; fileRef = E4ABABF22368B95800FA4345 /* StyleBuilderState.h */; }; … … 15214 15215 E4A8D21422578DA000A8463C /* EventRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventRegion.h; sourceTree = "<group>"; }; 15215 15216 E4A8D21522578DA000A8463C /* EventRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventRegion.cpp; sourceTree = "<group>"; }; 15217 E4ABABDB236088FD00FA4345 /* RenderBlockFlowLineLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderBlockFlowLineLayout.h; sourceTree = "<group>"; }; 15218 E4ABABDE2360893D00FA4345 /* RenderBlockFlowLineLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderBlockFlowLineLayout.cpp; sourceTree = "<group>"; }; 15216 15219 E4ABABE22361A32900FA4345 /* PropertyCascade.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyCascade.h; sourceTree = "<group>"; }; 15217 15220 E4ABABE52361A34200FA4345 /* PropertyCascade.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyCascade.cpp; sourceTree = "<group>"; }; … … 16636 16639 6F73918C2106CEDD006AF262 /* LayoutUnits.h */, 16637 16640 6FE7AA2621C37B6300296DCD /* MarginTypes.h */, 16641 E4ABABDB236088FD00FA4345 /* RenderBlockFlowLineLayout.h */, 16642 E4ABABDE2360893D00FA4345 /* RenderBlockFlowLineLayout.cpp */, 16638 16643 11FF02D520BA3C810083F25B /* Verification.cpp */, 16639 16644 ); … … 32458 32463 081093DC1255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.h in Headers */, 32459 32464 081668DA125603D5006F25DE /* SVGTextLayoutEngine.h in Headers */, 32465 E4ABABDD236088FE00FA4345 /* RenderBlockFlowLineLayout.h in Headers */, 32460 32466 080E49261255F3BD00EFCA27 /* SVGTextLayoutEngineBaseline.h in Headers */, 32461 32467 080E49281255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.h in Headers */, -
trunk/Source/WebCore/layout/RenderBlockFlowLineLayout.h
r252892 r252893 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutPoint.h" 31 30 32 namespace WebCore { 31 33 32 34 class GraphicsContext; 33 class IntRect; 35 class RenderBlockFlow; 36 struct PaintInfo; 34 37 35 38 namespace Layout { 39 40 class LayoutTreeContent; 36 41 class LayoutState; 37 }38 42 39 namespace Display { 43 class RenderBlockFlowLineLayout { 44 WTF_MAKE_FAST_ALLOCATED; 45 public: 46 RenderBlockFlowLineLayout(const RenderBlockFlow&); 47 ~RenderBlockFlowLineLayout(); 40 48 41 class Painter { 42 public: 43 static void paint(const Layout::LayoutState&, GraphicsContext&, const IntRect& dirtyRect); 49 static bool canUseFor(const RenderBlockFlow&); 50 51 void layout(); 52 53 LayoutUnit contentBoxHeight() const; 54 55 void paint(PaintInfo&, const LayoutPoint& paintOffset); 56 57 private: 58 const RenderBlockFlow& m_flow; 59 std::unique_ptr<LayoutTreeContent> m_treeContent; 60 std::unique_ptr<LayoutState> m_layoutState; 44 61 }; 45 62 46 63 } 47 64 } 65 48 66 #endif -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp
r251917 r252893 197 197 } 198 198 199 void Painter::paintInlineFlow(const Layout::LayoutState& layoutState, GraphicsContext& context) 200 { 201 auto& layoutRoot = layoutState.root(); 202 203 ASSERT(layoutRoot.establishesInlineFormattingContext()); 204 205 auto& displayBox = layoutState.displayBoxForLayoutBox(layoutRoot); 206 207 paintInlineContent(context, displayBox, downcast<Layout::InlineFormattingState>(layoutState.establishedFormattingState(layoutRoot))); 208 } 209 199 210 } 200 211 } -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.h
r251640 r252893 42 42 public: 43 43 static void paint(const Layout::LayoutState&, GraphicsContext&, const IntRect& dirtyRect); 44 static void paintInlineFlow(const Layout::LayoutState&, GraphicsContext&); 44 45 }; 45 46 -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r252888 r252893 137 137 138 138 auto layoutTreeContent = makeUnique<LayoutTreeContent>(renderView, makeUnique<Container>(WTF::nullopt, WTFMove(style))); 139 TreeBuilder(*layoutTreeContent).buildTree(); 140 return layoutTreeContent; 141 } 142 143 std::unique_ptr<Layout::LayoutTreeContent> TreeBuilder::buildLayoutTree(const RenderBlockFlow& renderBlockFlow) 144 { 145 PhaseScope scope(Phase::Type::TreeBuilding); 146 147 auto style = RenderStyle::clone(renderBlockFlow.style()); 148 auto layoutTreeContent = makeUnique<LayoutTreeContent>(renderBlockFlow, makeUnique<Container>(WTF::nullopt, WTFMove(style))); 139 149 TreeBuilder(*layoutTreeContent).buildTree(); 140 150 return layoutTreeContent; -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h
r252888 r252893 34 34 namespace WebCore { 35 35 36 class RenderBlockFlow; 36 37 class RenderElement; 37 38 class RenderObject; … … 71 72 public: 72 73 static std::unique_ptr<Layout::LayoutTreeContent> buildLayoutTree(const RenderView&); 74 static std::unique_ptr<Layout::LayoutTreeContent> buildLayoutTree(const RenderBlockFlow&); 73 75 74 76 private: -
trunk/Source/WebCore/layout/tableformatting/TableGrid.h
r251283 r252893 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "FormattingContext.h" 30 31 #include "IntPointHash.h" 31 32 #include <wtf/HashMap.h> -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.h
r251630 r252893 189 189 void setLayoutFormattingContextEnabled(bool isEnabled) { m_layoutFormattingContextEnabled = isEnabled; } 190 190 bool layoutFormattingContextEnabled() const { return m_layoutFormattingContextEnabled; } 191 192 void setLayoutFormattingContextRenderTreeIntegrationEnabled(bool isEnabled) { m_layoutFormattingContextRenderTreeIntegrationEnabled = isEnabled; } 193 bool layoutFormattingContextRenderTreeIntegrationEnabled() const { return m_layoutFormattingContextRenderTreeIntegrationEnabled; } 191 194 #endif 192 195 … … 444 447 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 445 448 bool m_layoutFormattingContextEnabled { false }; 449 bool m_layoutFormattingContextRenderTreeIntegrationEnabled { false }; 446 450 #endif 447 451 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r252891 r252893 38 38 #include "LayoutRepainter.h" 39 39 #include "Logging.h" 40 #include "RenderBlockFlowLineLayout.h" 40 41 #include "RenderCombineText.h" 41 42 #include "RenderFlexibleBox.h" … … 668 669 void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom) 669 670 { 671 auto computeLineLayoutPath = [&] { 672 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 673 if (Layout::RenderBlockFlowLineLayout::canUseFor(*this)) 674 return LFCPath; 675 #endif 676 if (SimpleLineLayout::canUseFor(*this)) 677 return SimpleLinesPath; 678 return LineBoxesPath; 679 }; 680 670 681 if (lineLayoutPath() == UndeterminedPath) 671 setLineLayoutPath( SimpleLineLayout::canUseFor(*this) ? SimpleLinesPath : LineBoxesPath);682 setLineLayoutPath(computeLineLayoutPath()); 672 683 673 684 if (lineLayoutPath() == SimpleLinesPath) { … … 675 686 return; 676 687 } 688 689 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 690 if (lineLayoutPath() == LFCPath) { 691 layoutLFCLines(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 692 return; 693 } 694 #endif 677 695 678 696 if (!complexLineLayout()) … … 3531 3549 ASSERT(childrenInline()); 3532 3550 3551 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 3552 if (lfcLineLayout()) { 3553 lfcLineLayout()->paint(paintInfo, paintOffset); 3554 return; 3555 } 3556 #endif 3557 3533 3558 if (auto simpleLineLayout = this->simpleLineLayout()) { 3534 3559 SimpleLineLayout::paintFlow(*this, *simpleLineLayout, paintInfo, paintOffset); … … 3603 3628 return; 3604 3629 case LineBoxesPath: 3630 case LFCPath: 3605 3631 ASSERT(!simpleLineLayout()); 3606 3632 setLineLayoutPath(UndeterminedPath); … … 3641 3667 setLogicalHeight(lineLayoutTop + lineLayoutHeight + borderAndPaddingAfter()); 3642 3668 } 3669 3670 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 3671 void RenderBlockFlow::layoutLFCLines(bool, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom) 3672 { 3673 if (!lfcLineLayout()) 3674 m_lineLayout = makeUnique<Layout::RenderBlockFlowLineLayout>(*this); 3675 3676 auto& lfcLineLayout = *this->lfcLineLayout(); 3677 3678 for (auto& renderer : childrenOfType<RenderObject>(*this)) 3679 renderer.clearNeedsLayout(); 3680 3681 lfcLineLayout.layout(); 3682 3683 LayoutUnit lineLayoutHeight = lfcLineLayout.contentBoxHeight(); 3684 LayoutUnit lineLayoutTop = borderAndPaddingBefore(); 3685 repaintLogicalTop = lineLayoutTop; 3686 repaintLogicalBottom = repaintLogicalTop + lineLayoutHeight + borderAndPaddingAfter(); 3687 setLogicalHeight(lineLayoutTop + lineLayoutHeight + borderAndPaddingAfter()); 3688 } 3689 #endif 3643 3690 3644 3691 void RenderBlockFlow::ensureLineBoxes() -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r252891 r252893 38 38 class RenderRubyRun; 39 39 40 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 41 namespace Layout { 42 class RenderBlockFlowLineLayout; 43 } 44 #endif 45 40 46 #if ENABLE(TEXT_AUTOSIZING) 41 47 enum LineCount { … … 339 345 void invalidateLineLayoutPath() final; 340 346 341 enum LineLayoutPath { UndeterminedPath = 0, SimpleLinesPath, LineBoxesPath, ForceLineBoxesPath };347 enum LineLayoutPath { UndeterminedPath = 0, SimpleLinesPath, LineBoxesPath, LFCPath, ForceLineBoxesPath }; 342 348 LineLayoutPath lineLayoutPath() const { return static_cast<LineLayoutPath>(renderBlockFlowLineLayoutPath()); } 343 349 void setLineLayoutPath(LineLayoutPath path) { setRenderBlockFlowLineLayoutPath(path); } … … 358 364 const ComplexLineLayout* complexLineLayout() const; 359 365 ComplexLineLayout* complexLineLayout(); 366 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 367 const Layout::RenderBlockFlowLineLayout* lfcLineLayout() const; 368 Layout::RenderBlockFlowLineLayout* lfcLineLayout(); 369 #endif 360 370 361 371 void ensureLineBoxes(); … … 536 546 void layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom); 537 547 548 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 549 bool hasLFCLineLayout() const; 550 void layoutLFCLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom); 551 #endif 552 538 553 void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const; 539 554 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const; … … 573 588 574 589 private: 575 Variant<std::nullptr_t, std::unique_ptr<ComplexLineLayout>, Ref<SimpleLineLayout::Layout>> m_lineLayout; 590 Variant< 591 std::nullptr_t, 592 Ref<SimpleLineLayout::Layout>, 593 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 594 std::unique_ptr<Layout::RenderBlockFlowLineLayout>, 595 #endif 596 std::unique_ptr<ComplexLineLayout> 597 > m_lineLayout; 576 598 577 599 friend class LineBreaker; … … 610 632 } 611 633 634 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 635 inline bool RenderBlockFlow::hasLFCLineLayout() const 636 { 637 return WTF::holds_alternative<std::unique_ptr<Layout::RenderBlockFlowLineLayout>>(m_lineLayout); 638 } 639 640 inline const Layout::RenderBlockFlowLineLayout* RenderBlockFlow::lfcLineLayout() const 641 { 642 return hasLFCLineLayout() ? WTF::get<std::unique_ptr<Layout::RenderBlockFlowLineLayout>>(m_lineLayout).get() : nullptr; 643 } 644 645 inline Layout::RenderBlockFlowLineLayout* RenderBlockFlow::lfcLineLayout() 646 { 647 return hasLFCLineLayout() ? WTF::get<std::unique_ptr<Layout::RenderBlockFlowLineLayout>>(m_lineLayout).get() : nullptr; 648 } 649 #endif 650 612 651 } // namespace WebCore 613 652 -
trunk/Source/WebKit/ChangeLog
r252886 r252893 1 2019-11-26 Antti Koivisto <antti@apple.com> 2 3 [LFC][Render tree] Add LFC line layout path to RenderBlockFlow 4 https://bugs.webkit.org/show_bug.cgi?id=204613 5 6 Reviewed by Zalan Bujtas. 7 8 * Shared/WebPreferences.yaml: 9 * WebProcess/InjectedBundle/InjectedBundle.cpp: 10 (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 11 1 12 2019-11-26 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r252840 r252893 1643 1643 type: bool 1644 1644 defaultValue: false 1645 humanReadableName: "Next-gen layout" 1646 humanReadableDescription: "Enable next-gen layout" 1645 humanReadableName: "Next-generation layout" 1646 humanReadableDescription: "Enable next-generation layout" 1647 category: internal 1648 webcoreBinding: RuntimeEnabledFeatures 1649 condition: ENABLE(LAYOUT_FORMATTING_CONTEXT) 1650 1651 LayoutFormattingContextRenderTreeIntegrationEnabled: 1652 type: bool 1653 defaultValue: false 1654 humanReadableName: "Next-generation inline layout in render tree" 1655 humanReadableDescription: "Enable next-generation inline layout in render tree" 1647 1656 category: internal 1648 1657 webcoreBinding: RuntimeEnabledFeatures -
trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp
r251950 r252893 262 262 if (preference == "LayoutFormattingContextEnabled") 263 263 RuntimeEnabledFeatures::sharedFeatures().setLayoutFormattingContextEnabled(enabled); 264 if (preference == "LayoutFormattingContextRenderTreeIntegrationEnabled") 265 RuntimeEnabledFeatures::sharedFeatures().setLayoutFormattingContextRenderTreeIntegrationEnabled(enabled); 264 266 #endif 265 267
Note: See TracChangeset
for help on using the changeset viewer.