Changeset 267463 in webkit
- Timestamp:
- Sep 22, 2020, 9:39:06 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 7 edited
- 1 copied
-
ChangeLog (modified) (1 diff)
-
Sources.txt (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
layout/displaytree/DisplayInlineContent.h (modified) (2 diffs)
-
layout/integration/LayoutIntegrationLineLayout.cpp (modified) (5 diffs)
-
layout/integration/LayoutIntegrationLineLayout.h (modified) (2 diffs)
-
layout/integration/LayoutIntegrationPagination.cpp (added)
-
layout/integration/LayoutIntegrationPagination.h (copied) (copied from trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.h ) (2 diffs)
-
rendering/RenderBlockFlow.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267461 r267463 1 2020-09-22 Antti Koivisto <antti@apple.com> 2 3 [LFC][Integration] Basic pagination support 4 https://bugs.webkit.org/show_bug.cgi?id=215451 5 <rdar://problem/67482721> 6 7 Reviewed by Zalan Bujtas. 8 9 Port the Simple Line Layout pagination code to LFC integration layer. 10 Pagination is the last remaining use of SLL so this patch turns it into dead code. 11 12 * Sources.txt: 13 * WebCore.xcodeproj/project.pbxproj: 14 * layout/displaytree/DisplayInlineContent.h: 15 (WebCore::Display::InlineContent::create): 16 * layout/integration/LayoutIntegrationLineLayout.cpp: 17 (WebCore::LayoutIntegration::LineLayout::canUseFor): 18 19 This now the same as SLL test, covering all cases. 20 21 (WebCore::LayoutIntegration::LineLayout::contentLogicalHeight const): 22 (WebCore::LayoutIntegration::LineLayout::adjustForPagination): 23 (WebCore::LayoutIntegration::LineLayout::ensureDisplayInlineContent): 24 25 This is fairly direct copy of the SLL code. It is not future proof or otherwise great but it serves the job for now. 26 27 * layout/integration/LayoutIntegrationLineLayout.h: 28 (WebCore::LayoutIntegration::LineLayout::isPaginated const): 29 * layout/integration/LayoutIntegrationPagination.cpp: Added. 30 (WebCore::LayoutIntegration::computeLineTopAndBottomWithOverflow): 31 (WebCore::LayoutIntegration::computeLineBreakIndex): 32 (WebCore::LayoutIntegration::computeOffsetAfterLineBreak): 33 (WebCore::LayoutIntegration::setPageBreakForLine): 34 (WebCore::LayoutIntegration::updateMinimumPageHeight): 35 (WebCore::LayoutIntegration::makeAdjustedContent): 36 (WebCore::LayoutIntegration::adjustLinePositionsForPagination): 37 * layout/integration/LayoutIntegrationPagination.h: Copied from Source/WebCore/layout/displaytree/DisplayInlineContent.h. 38 * rendering/RenderBlockFlow.cpp: 39 (WebCore::RenderBlockFlow::layoutLFCLines): 40 (WebCore::RenderBlockFlow::ensureLineBoxes): 41 1 42 2020-09-22 Zalan Bujtas <zalan@apple.com> 2 43 -
trunk/Source/WebCore/Sources.txt
r267449 r267463 1457 1457 layout/integration/LayoutIntegrationBoxTree.cpp 1458 1458 layout/integration/LayoutIntegrationLineLayout.cpp 1459 layout/integration/LayoutIntegrationPagination.cpp 1459 1460 layout/invalidation/InvalidationContext.cpp 1460 1461 layout/invalidation/InvalidationState.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r267449 r267463 15831 15831 E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; }; 15832 15832 E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; }; 15833 E4312AB524B3265600678349 /* LayoutIntegrationPagination.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationPagination.cpp; sourceTree = "<group>"; }; 15834 E4312AB724B3265600678349 /* LayoutIntegrationPagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationPagination.h; sourceTree = "<group>"; }; 15833 15835 E4343D212392778300EBBB66 /* LineLayoutTraversalSimplePath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineLayoutTraversalSimplePath.h; sourceTree = "<group>"; }; 15834 15836 E4343D242392778F00EBBB66 /* LineLayoutTraversalComplexPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineLayoutTraversalComplexPath.h; sourceTree = "<group>"; }; … … 28442 28444 isa = PBXGroup; 28443 28445 children = ( 28446 E4312AB524B3265600678349 /* LayoutIntegrationPagination.cpp */, 28447 E4312AB724B3265600678349 /* LayoutIntegrationPagination.h */, 28444 28448 E418025623D454B500FFB071 /* LayoutIntegrationBoxTree.cpp */, 28445 28449 E418025323D4549A00FFB071 /* LayoutIntegrationBoxTree.h */, -
trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.h
r267325 r267463 37 37 38 38 struct InlineContent : public RefCounted<InlineContent> { 39 static Ref<InlineContent> create() { return adoptRef(*new InlineContent); } 39 40 ~InlineContent(); 40 41 … … 48 49 WTF::IteratorRange<const Run*> runsForRect(const LayoutRect&) const; 49 50 void shrinkToFit(); 51 52 private: 53 InlineContent() = default; 50 54 }; 51 55 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r267325 r267463 38 38 #include "InvalidationState.h" 39 39 #include "LayoutBoxGeometry.h" 40 #include "LayoutIntegrationPagination.h" 40 41 #include "LayoutTreeBuilder.h" 41 42 #include "PaintInfo.h" … … 75 76 }); 76 77 77 if (!passesSimpleLineLayoutTest) 78 return false; 79 80 if (flow.fragmentedFlowState() != RenderObject::NotInsideFragmentedFlow) 81 return false; 82 83 return true; 78 return passesSimpleLineLayoutTest; 84 79 } 85 80 … … 226 221 LayoutUnit LineLayout::contentLogicalHeight() const 227 222 { 223 if (m_paginatedHeight) 224 return *m_paginatedHeight; 225 228 226 auto& lines = m_inlineFormattingState.lines(); 229 227 return LayoutUnit { lines.last().logicalBottom() - lines.first().logicalTop() }; … … 264 262 } 265 263 264 void LineLayout::adjustForPagination(RenderBlockFlow& flow) 265 { 266 ASSERT(&flow == &m_flow); 267 auto paginedInlineContent = adjustLinePositionsForPagination(*m_displayInlineContent, flow); 268 if (paginedInlineContent.ptr() == m_displayInlineContent) { 269 m_paginatedHeight = { }; 270 return; 271 } 272 273 auto& lines = paginedInlineContent->lines; 274 m_paginatedHeight = LayoutUnit { lines.last().rect().maxY() - lines.first().rect().y() }; 275 276 m_displayInlineContent = WTFMove(paginedInlineContent); 277 } 278 266 279 void LineLayout::collectOverflow(RenderBlockFlow& flow) 267 280 { … … 278 291 { 279 292 if (!m_displayInlineContent) 280 m_displayInlineContent = adoptRef(*new Display::InlineContent);293 m_displayInlineContent = Display::InlineContent::create(); 281 294 return *m_displayInlineContent; 282 295 } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h
r267325 r267463 68 68 LayoutUnit lastLineBaseline() const; 69 69 70 void adjustForPagination(RenderBlockFlow&); 70 71 void collectOverflow(RenderBlockFlow&); 71 72 72 73 const Display::InlineContent* displayInlineContent() const { return m_displayInlineContent.get(); } 74 bool isPaginated() const { return !!m_paginatedHeight; } 73 75 74 76 void paint(PaintInfo&, const LayoutPoint& paintOffset); … … 96 98 Layout::InlineFormattingState& m_inlineFormattingState; 97 99 RefPtr<Display::InlineContent> m_displayInlineContent; 100 Optional<LayoutUnit> m_paginatedHeight; 98 101 }; 99 102 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.h
r267462 r267463 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 "DisplayLine.h" 31 #include "DisplayRun.h" 32 #include <wtf/IteratorRange.h> 33 #include <wtf/Vector.h> 30 #include "DisplayInlineContent.h" 34 31 35 32 namespace WebCore { 36 namespace Display {37 33 38 struct InlineContent : public RefCounted<InlineContent> { 39 ~InlineContent(); 34 class RenderBlockFlow; 40 35 41 using Runs = Vector<Run, 4>; 42 using Lines = Vector<Line, 4>; 43 44 Runs runs; 45 Lines lines; 46 47 const Line& lineForRun(const Run& run) const { return lines[run.lineIndex()]; } 48 WTF::IteratorRange<const Run*> runsForRect(const LayoutRect&) const; 49 void shrinkToFit(); 50 }; 51 52 inline void InlineContent::shrinkToFit() 53 { 54 runs.shrinkToFit(); 55 lines.shrinkToFit(); 56 } 36 namespace LayoutIntegration { 37 38 Ref<Display::InlineContent> adjustLinePositionsForPagination(Display::InlineContent&, RenderBlockFlow&); 57 39 58 40 } -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r267363 r267463 3744 3744 layoutFormattingContextLineLayout.layout(); 3745 3745 3746 if (view().frameView().layoutContext().layoutState()->isPaginated()) 3747 layoutFormattingContextLineLayout.adjustForPagination(*this); 3748 3746 3749 auto contentHeight = layoutFormattingContextLineLayout.contentLogicalHeight(); 3747 3750 auto contentBoxTop = borderAndPaddingBefore(); … … 3767 3770 auto simpleLineLayout = makeRefPtr(this->simpleLineLayout()); 3768 3771 3772 bool needsToPaginateComplexLines = [&] { 3773 if (simpleLineLayout && simpleLineLayout->isPaginated()) 3774 return true; 3775 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 3776 if (layoutFormattingContextLineLayout() && layoutFormattingContextLineLayout()->isPaginated()) 3777 return true; 3778 #endif 3779 return false; 3780 }(); 3781 3769 3782 m_lineLayout = makeUnique<ComplexLineLayout>(*this); 3770 3783 … … 3786 3799 LayoutUnit repaintLogicalTop; 3787 3800 LayoutUnit repaintLogicalBottom; 3788 if ( simpleLineLayout && simpleLineLayout->isPaginated()) {3801 if (needsToPaginateComplexLines) { 3789 3802 PaginatedLayoutStateMaintainer state(*this); 3790 3803 complexLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
Note:
See TracChangeset
for help on using the changeset viewer.