Changeset 252415 in webkit
- Timestamp:
- Nov 13, 2019 10:39:44 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 3 deleted
- 6 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252409 r252415 1 2019-11-13 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][Invalidation] Introduce InvalidationState and Context 4 https://bugs.webkit.org/show_bug.cgi?id=204140 5 <rdar://problem/57142106> 6 7 Reviewed by Antti Koivisto. 8 9 InvalidationContext take style/content changes and turn them into "dirty layout boxes" (stored in InvalidationState). 10 InvalidationState is the input to the (partial)subsequent layout. 11 12 * Sources.txt: 13 * WebCore.xcodeproj/project.pbxproj: 14 * layout/Invalidation.h: Removed. 15 * layout/LayoutContext.cpp: 16 (WebCore::Layout::LayoutContext::layout): 17 (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): 18 (WebCore::Layout::LayoutContext::runLayout): 19 (WebCore::Layout::LayoutContext::styleChanged): Deleted. 20 (WebCore::Layout::LayoutContext::markNeedsUpdate): Deleted. 21 * layout/LayoutContext.h: 22 (WebCore::Layout::LayoutContext::updateAll): Deleted. 23 * layout/blockformatting/BlockInvalidation.cpp: Removed. 24 * layout/blockformatting/BlockInvalidation.h: Removed. 25 * layout/invalidation/InvalidationContext.cpp: Renamed from Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp. 26 (WebCore::Layout::InvalidationContext::InvalidationContext): 27 (WebCore::Layout::InvalidationContext::styleChanged): 28 (WebCore::Layout::InvalidationContext::contentChanged): 29 (WebCore::Layout::InvalidationContext::subtreeChanged): 30 * layout/invalidation/InvalidationContext.h: Renamed from Source/WebCore/layout/inlineformatting/InlineInvalidation.h. 31 * layout/invalidation/InvalidationState.cpp: Renamed from Source/WebCore/layout/tableformatting/TableInvalidation.cpp. 32 (WebCore::Layout::InvalidationState::InvalidationState): 33 (WebCore::Layout::InvalidationState::markNeedsUpdate): 34 * layout/invalidation/InvalidationState.h: Renamed from Source/WebCore/layout/tableformatting/TableInvalidation.h. 35 (WebCore::Layout::InvalidationState::formattingContextRoots const): 36 * layout/layouttree/LayoutTreeBuilder.cpp: 37 (WebCore::Layout::printLayoutTreeForLiveDocuments): 38 1 39 2019-11-13 Commit Queue <commit-queue@webkit.org> 2 40 -
trunk/Source/WebCore/Sources.txt
r252393 r252415 1436 1436 layout/blockformatting/BlockFormattingState.cpp 1437 1437 layout/blockformatting/BlockMarginCollapse.cpp 1438 layout/blockformatting/BlockInvalidation.cpp1439 1438 layout/displaytree/DisplayBox.cpp 1440 1439 layout/displaytree/DisplayPainter.cpp … … 1447 1446 layout/inlineformatting/InlineFormattingContextQuirks.cpp 1448 1447 layout/inlineformatting/InlineFormattingState.cpp 1449 layout/inlineformatting/InlineInvalidation.cpp1450 1448 layout/inlineformatting/InlineItem.cpp 1451 1449 layout/inlineformatting/InlineLine.cpp … … 1454 1452 layout/inlineformatting/InlineTextItem.cpp 1455 1453 layout/inlineformatting/text/TextUtil.cpp 1454 layout/invalidation/InvalidationContext.cpp 1455 layout/invalidation/InvalidationState.cpp 1456 1456 layout/layouttree/LayoutBox.cpp 1457 1457 layout/layouttree/LayoutContainer.cpp … … 1462 1462 layout/tableformatting/TableFormattingState.cpp 1463 1463 layout/tableformatting/TableGrid.cpp 1464 layout/tableformatting/TableInvalidation.cpp1465 1464 1466 1465 loader/AdClickAttribution.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r252393 r252415 371 371 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; }; 372 372 112B34D51E60B98300BB310A /* SimpleLineLayoutPagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 112B34D41E60B98300BB310A /* SimpleLineLayoutPagination.h */; }; 373 11310CF120BA4A1B0065A8D0 /* Invalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 115F7805209CBCBD00739C13 /* Invalidation.h */; settings = {ATTRIBUTES = (Private, ); }; };374 373 11310CF220BA4A320065A8D0 /* LayoutTreeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 11100FD7209514DF0081AA6C /* LayoutTreeBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; }; 375 374 11310CF320BA4A370065A8D0 /* LayoutReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = 111C615620AD1AE1005B82FA /* LayoutReplaced.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 378 377 11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 11100FC920927CBC0081AA6C /* LayoutChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 379 378 11310CF720BA4A620065A8D0 /* LayoutAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 11100FCA2092868D0081AA6C /* LayoutAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 380 11310CF820BA4A6A0065A8D0 /* InlineInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1123AFDC209ABBBA00736ACC /* InlineInvalidation.h */; settings = {ATTRIBUTES = (Private, ); }; };381 11310CF920BA4A7D0065A8D0 /* BlockInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1123AFD9209ABB2000736ACC /* BlockInvalidation.h */; settings = {ATTRIBUTES = (Private, ); }; };382 379 113409DA203E038000C66915 /* RenderTreeBuilderContinuation.h in Headers */ = {isa = PBXBuildFile; fileRef = 113409D8203E038000C66915 /* RenderTreeBuilderContinuation.h */; }; 383 380 113D0B521F9FDD2B00F611BB /* FrameViewLayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 113D0B501F9FDD2B00F611BB /* FrameViewLayoutContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2031 2028 6F7CA3C6208C2957002F29AB /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C4208C2956002F29AB /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2032 2029 6F7CA3CA208C2B2E002F29AB /* InlineFormattingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2030 6F95DE4D237B889C00E517E1 /* InvalidationContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F95DE4B237B889B00E517E1 /* InvalidationContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2031 6F95DE4E237B889C00E517E1 /* InvalidationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F95DE4C237B889C00E517E1 /* InvalidationState.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2033 2032 6F995A161A70756200A735F4 /* WebGLSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A141A70756200A735F4 /* WebGLSync.h */; }; 2034 2033 6F995A201A7078B100A735F4 /* WebGLQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A181A7078B100A735F4 /* WebGLQuery.h */; }; … … 5861 5860 111C615620AD1AE1005B82FA /* LayoutReplaced.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutReplaced.h; sourceTree = "<group>"; }; 5862 5861 111C615720AD1AE1005B82FA /* LayoutReplaced.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutReplaced.cpp; sourceTree = "<group>"; }; 5863 1123AFD9209ABB2000736ACC /* BlockInvalidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlockInvalidation.h; sourceTree = "<group>"; };5864 1123AFDA209ABB2000736ACC /* BlockInvalidation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockInvalidation.cpp; sourceTree = "<group>"; };5865 1123AFDC209ABBBA00736ACC /* InlineInvalidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InlineInvalidation.h; sourceTree = "<group>"; };5866 1123AFDD209ABBBA00736ACC /* InlineInvalidation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineInvalidation.cpp; sourceTree = "<group>"; };5867 5862 112B34D01E60B8A700BB310A /* SimpleLineLayoutPagination.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutPagination.cpp; sourceTree = "<group>"; }; 5868 5863 112B34D41E60B98300BB310A /* SimpleLineLayoutPagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutPagination.h; sourceTree = "<group>"; }; … … 5889 5884 115CFA95208B952B001E6991 /* LayoutBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutBox.h; sourceTree = "<group>"; }; 5890 5885 115CFA96208B952B001E6991 /* LayoutBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutBox.cpp; sourceTree = "<group>"; }; 5891 115F7805209CBCBD00739C13 /* Invalidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Invalidation.h; sourceTree = "<group>"; };5892 5886 119340761FE8B92300935F1E /* RenderTreeBuilderTable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderTable.cpp; sourceTree = "<group>"; }; 5893 5887 119340771FE8B92300935F1E /* RenderTreeBuilderTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderTable.h; sourceTree = "<group>"; }; … … 9274 9268 6F8F460121B03BB40041AC3A /* FormattingContextQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContextQuirks.cpp; sourceTree = "<group>"; }; 9275 9269 6F8F460321B03BC60041AC3A /* BlockFormattingContextQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockFormattingContextQuirks.cpp; sourceTree = "<group>"; }; 9270 6F95DE4B237B889B00E517E1 /* InvalidationContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InvalidationContext.h; sourceTree = "<group>"; }; 9271 6F95DE4C237B889C00E517E1 /* InvalidationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InvalidationState.h; sourceTree = "<group>"; }; 9276 9272 6F995A091A7070E600A735F4 /* WebGLQuery.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLQuery.idl; sourceTree = "<group>"; }; 9277 9273 6F995A0A1A7070E600A735F4 /* WebGLSampler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLSampler.idl; sourceTree = "<group>"; }; … … 9306 9302 6FBB860520B464B600DAD938 /* FormattingContextGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContextGeometry.cpp; sourceTree = "<group>"; }; 9307 9303 6FC5CA9222E3599300B13E11 /* TableFormattingState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TableFormattingState.cpp; sourceTree = "<group>"; }; 9308 6FC5CA9322E3599300B13E11 /* TableInvalidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableInvalidation.h; sourceTree = "<group>"; };9309 9304 6FC5CA9422E3599400B13E11 /* TableFormattingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TableFormattingContext.cpp; sourceTree = "<group>"; }; 9310 9305 6FC5CA9522E3599400B13E11 /* TableFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableFormattingContext.h; sourceTree = "<group>"; }; 9311 9306 6FC5CA9622E3599500B13E11 /* TableFormattingState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableFormattingState.h; sourceTree = "<group>"; }; 9312 6FC5CA9722E3599500B13E11 /* TableInvalidation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TableInvalidation.cpp; sourceTree = "<group>"; };9313 9307 6FCE1A1822618AB3004F0343 /* DisplayRun.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayRun.h; sourceTree = "<group>"; }; 9314 9308 6FD9CD52227E21C800E53957 /* DisplayRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRect.h; sourceTree = "<group>"; }; … … 9317 9311 6FE7AA2621C37B6300296DCD /* MarginTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MarginTypes.h; sourceTree = "<group>"; }; 9318 9312 6FE7CFA02177EEF1005B1573 /* InlineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineItem.h; sourceTree = "<group>"; }; 9313 6FE8E6F7237BA5E800758D26 /* InvalidationContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InvalidationContext.cpp; sourceTree = "<group>"; }; 9314 6FE8E6F8237BA6B200758D26 /* InvalidationState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InvalidationState.cpp; sourceTree = "<group>"; }; 9319 9315 6FE9F09222211035004C5082 /* ContentChangeObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentChangeObserver.cpp; sourceTree = "<group>"; }; 9320 9316 6FEFE81D22F9D22A00114927 /* LayoutPhase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutPhase.h; sourceTree = "<group>"; }; … … 16615 16611 6FCFC055212DACC2007695D2 /* floats */, 16616 16612 115CFA9A208BC140001E6991 /* inlineformatting */, 16613 6F95DE4A237B883000E517E1 /* invalidation */, 16617 16614 115CFA90208B9441001E6991 /* layouttree */, 16618 16615 6FC5CA9122E3593300B13E11 /* tableformatting */, … … 16623 16620 115CFA75208AFE30001E6991 /* FormattingState.cpp */, 16624 16621 115CFA74208AFE30001E6991 /* FormattingState.h */, 16625 115F7805209CBCBD00739C13 /* Invalidation.h */,16626 16622 6F26BB6923343E5A002F2BEA /* LayoutContext.cpp */, 16627 16623 6F26BB6B23343E5B002F2BEA /* LayoutContext.h */, … … 16666 16662 115CFA79208B8D9D001E6991 /* BlockFormattingState.cpp */, 16667 16663 115CFA78208B8D9D001E6991 /* BlockFormattingState.h */, 16668 1123AFDA209ABB2000736ACC /* BlockInvalidation.cpp */,16669 1123AFD9209ABB2000736ACC /* BlockInvalidation.h */,16670 16664 115CFA89208B921A001E6991 /* BlockMarginCollapse.cpp */, 16671 16665 ); … … 16683 16677 115CFA7D208B8E10001E6991 /* InlineFormattingState.cpp */, 16684 16678 115CFA7C208B8E10001E6991 /* InlineFormattingState.h */, 16685 1123AFDD209ABBBA00736ACC /* InlineInvalidation.cpp */,16686 1123AFDC209ABBBA00736ACC /* InlineInvalidation.h */,16687 16679 6F7B8CEC23626E6600C9FF15 /* InlineItem.cpp */, 16688 16680 6FE7CFA02177EEF1005B1573 /* InlineItem.h */, … … 20797 20789 sourceTree = "<group>"; 20798 20790 }; 20791 6F95DE4A237B883000E517E1 /* invalidation */ = { 20792 isa = PBXGroup; 20793 children = ( 20794 6FE8E6F7237BA5E800758D26 /* InvalidationContext.cpp */, 20795 6F95DE4B237B889B00E517E1 /* InvalidationContext.h */, 20796 6FE8E6F8237BA6B200758D26 /* InvalidationState.cpp */, 20797 6F95DE4C237B889C00E517E1 /* InvalidationState.h */, 20798 ); 20799 path = invalidation; 20800 sourceTree = "<group>"; 20801 }; 20799 20802 6FC5CA9122E3593300B13E11 /* tableformatting */ = { 20800 20803 isa = PBXGroup; … … 20807 20810 6F5B7EAA2300A79E0067D9C3 /* TableGrid.cpp */, 20808 20811 6FB22E30230097E300C20866 /* TableGrid.h */, 20809 6FC5CA9722E3599500B13E11 /* TableInvalidation.cpp */,20810 6FC5CA9322E3599300B13E11 /* TableInvalidation.h */,20811 20812 ); 20812 20813 path = tableformatting; … … 29018 29019 115CFA6E208AFAB7001E6991 /* BlockFormattingContext.h in Headers */, 29019 29020 115CFA7A208B8D9D001E6991 /* BlockFormattingState.h in Headers */, 29020 11310CF920BA4A7D0065A8D0 /* BlockInvalidation.h in Headers */,29021 29021 BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */, 29022 29022 589556ED18D4A44000764B03 /* BorderEdge.h in Headers */, … … 30166 30166 6F7CA3CA208C2B2E002F29AB /* InlineFormattingContext.h in Headers */, 30167 30167 115CFA7E208B8E10001E6991 /* InlineFormattingState.h in Headers */, 30168 11310CF820BA4A6A0065A8D0 /* InlineInvalidation.h in Headers */,30169 30168 6FE7CFA22177EEF2005B1573 /* InlineItem.h in Headers */, 30170 30169 BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */, … … 30237 30236 B27535750B053814002CE64F /* IntSize.h in Headers */, 30238 30237 B27535760B053814002CE64F /* IntSizeHash.h in Headers */, 30239 11310CF120BA4A1B0065A8D0 /* Invalidation.h in Headers */, 30238 6F95DE4D237B889C00E517E1 /* InvalidationContext.h in Headers */, 30239 6F95DE4E237B889C00E517E1 /* InvalidationState.h in Headers */, 30240 30240 2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */, 30241 30241 1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */, -
trunk/Source/WebCore/layout/LayoutContext.cpp
r251640 r252415 31 31 #include "BlockFormattingContext.h" 32 32 #include "BlockFormattingState.h" 33 #include "BlockInvalidation.h"34 33 #include "DisplayBox.h" 35 34 #include "DisplayPainter.h" 36 35 #include "InlineFormattingContext.h" 37 36 #include "InlineFormattingState.h" 38 #include "In lineInvalidation.h"39 #include "Invalidation .h"37 #include "InvalidationContext.h" 38 #include "InvalidationState.h" 40 39 #include "LayoutBox.h" 41 40 #include "LayoutContainer.h" 42 41 #include "LayoutPhase.h" 43 42 #include "LayoutTreeBuilder.h" 43 #include "RenderStyleConstants.h" 44 44 #include "RenderView.h" 45 45 #include "TableFormattingContext.h" … … 57 57 } 58 58 59 void LayoutContext::layout( )59 void LayoutContext::layout(const InvalidationState& invalidationState) 60 60 { 61 61 PhaseScope scope(Phase::Type::Layout); 62 62 63 ASSERT(!m_formattingContextRootListForLayout.computesEmpty());64 for (auto& layoutRoot : m_formattingContextRootListForLayout)65 layoutFormattingContextSubtree(layoutRoot);66 m_formattingContextRootListForLayout.clear();63 auto& formattingContextRootsForLayout = invalidationState.formattingContextRoots(); 64 ASSERT(!formattingContextRootsForLayout.computesEmpty()); 65 for (auto& formattingContextRoot : formattingContextRootsForLayout) 66 layoutFormattingContextSubtree(formattingContextRoot); 67 67 } 68 68 69 void LayoutContext::layoutFormattingContextSubtree(const Container& layoutRoot)69 void LayoutContext::layoutFormattingContextSubtree(const Container& formattingContextRoot) 70 70 { 71 RELEASE_ASSERT( layoutRoot.establishesFormattingContext());72 auto formattingContext = createFormattingContext( layoutRoot, layoutState());71 RELEASE_ASSERT(formattingContextRoot.establishesFormattingContext()); 72 auto formattingContext = createFormattingContext(formattingContextRoot, layoutState()); 73 73 formattingContext->layoutInFlowContent(); 74 74 formattingContext->layoutOutOfFlowContent(); 75 }76 77 void LayoutContext::styleChanged(const Box& layoutBox, StyleDiff styleDiff)78 {79 PhaseScope scope(Phase::Type::Invalidation);80 81 auto& formattingState = layoutState().formattingStateForBox(layoutBox);82 const Container* invalidationRoot = nullptr;83 if (is<BlockFormattingState>(formattingState))84 invalidationRoot = BlockInvalidation::invalidate(layoutBox, styleDiff, *this, downcast<BlockFormattingState>(formattingState)).root;85 else if (is<InlineFormattingState>(formattingState))86 invalidationRoot = InlineInvalidation::invalidate(layoutBox, styleDiff, *this, downcast<InlineFormattingState>(formattingState)).root;87 else88 ASSERT_NOT_IMPLEMENTED_YET();89 ASSERT(invalidationRoot);90 m_formattingContextRootListForLayout.add(invalidationRoot);91 }92 93 void LayoutContext::markNeedsUpdate(const Box& layoutBox, OptionSet<UpdateType>)94 {95 // FIXME: This should trigger proper invalidation instead of just adding the formatting context root to the dirty list.96 m_formattingContextRootListForLayout.add(&(layoutBox.isInitialContainingBlock() ? downcast<Container>(layoutBox) : layoutBox.formattingContextRoot()));97 75 } 98 76 … … 157 135 displayBox.setContentBoxWidth(LayoutUnit(layoutRoot.style().logicalWidth().value())); 158 136 159 auto layoutContext = LayoutContext(layoutState); 160 layoutContext.markNeedsUpdate(layoutRoot); 161 layoutContext.layout(); 137 auto invalidationState = InvalidationState { }; 138 auto invalidationContext = InvalidationContext { invalidationState }; 139 invalidationContext.styleChanged(*layoutRoot.firstChild(), StyleDifference::Layout); 140 141 LayoutContext(layoutState).layout(invalidationState); 162 142 } 163 143 -
trunk/Source/WebCore/layout/LayoutContext.h
r251640 r252415 30 30 #include <wtf/IsoMalloc.h> 31 31 #include <wtf/OptionSet.h> 32 #include <wtf/WeakHashSet.h>33 32 34 33 namespace WebCore { … … 40 39 namespace Layout { 41 40 42 enum class StyleDiff;43 class Box;44 41 class Container; 42 class InvalidationState; 45 43 class LayoutState; 46 44 class FormattingContext; … … 60 58 61 59 LayoutContext(LayoutState&); 62 void layout(); 63 64 enum class UpdateType { 65 Overflow = 1 << 0, 66 Position = 1 << 1, 67 Size = 1 << 2 68 }; 69 static constexpr OptionSet<UpdateType> updateAll() { return { UpdateType::Overflow, UpdateType::Position, UpdateType::Size }; } 70 void markNeedsUpdate(const Box&, OptionSet<UpdateType> = updateAll()); 71 bool needsUpdate(const Box&) const; 72 73 void styleChanged(const Box&, StyleDiff); 60 void layout(const InvalidationState&); 74 61 75 62 static std::unique_ptr<FormattingContext> createFormattingContext(const Container& formattingContextRoot, LayoutState&); … … 84 71 85 72 LayoutState& m_layoutState; 86 WeakHashSet<const Container> m_formattingContextRootListForLayout;87 73 }; 88 74 -
trunk/Source/WebCore/layout/invalidation/InvalidationContext.cpp
r252412 r252415 1 1 /* 2 * Copyright (C) 201 8Apple 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 … … 25 25 26 26 #include "config.h" 27 #include "In lineInvalidation.h"27 #include "InvalidationContext.h" 28 28 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 30 30 31 #include "InlineFormattingState.h" 32 #include "Invalidation.h" 33 #include "LayoutBox.h" 34 #include "LayoutContext.h" 31 #include "InvalidationState.h" 35 32 #include <wtf/IsoMallocInlines.h> 36 33 … … 38 35 namespace Layout { 39 36 40 WTF_MAKE_ISO_ALLOCATED_IMPL(In lineInvalidation);37 WTF_MAKE_ISO_ALLOCATED_IMPL(InvalidationContext); 41 38 42 InvalidationResult InlineInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutContext& layoutContext, InlineFormattingState&) 39 InvalidationContext::InvalidationContext(InvalidationState& invalidationState) 40 : m_invalidationState(invalidationState) 43 41 { 44 layoutContext.markNeedsUpdate(layoutBox); 45 return { nullptr }; 42 } 43 44 void InvalidationContext::styleChanged(const Box& layoutBox, StyleDifference) 45 { 46 m_invalidationState.markNeedsUpdate(layoutBox); 47 } 48 49 void InvalidationContext::contentChanged(const Box&) 50 { 51 } 52 53 void InvalidationContext::subtreeChanged(const Box&) 54 { 46 55 } 47 56 -
trunk/Source/WebCore/layout/invalidation/InvalidationContext.h
r252412 r252415 31 31 32 32 namespace WebCore { 33 enum class StyleDifference; 34 33 35 namespace Layout { 36 class Box; 37 class InvalidationState; 34 38 35 class Box; 36 class TableFormattingState; 37 class LayoutContext; 38 struct InvalidationResult; 39 enum class StyleDiff; 39 class InvalidationContext { 40 WTF_MAKE_ISO_ALLOCATED(InvalidationContext); 41 public: 42 InvalidationContext(InvalidationState&); 40 43 41 // This class implements box invalidation for table formatting context. 42 class TableInvalidation { 43 WTF_MAKE_ISO_ALLOCATED(TableInvalidation); 44 public: 45 static InvalidationResult invalidate(const Box&, StyleDiff, LayoutContext&, TableFormattingState&); 44 void styleChanged(const Box&, StyleDifference); 45 // FIXME: We might just merge this with subtreeChanged. 46 void contentChanged(const Box&); 47 // FIXME: This is just a placeholder for tree changes like gaining and losing descendants. 48 void subtreeChanged(const Box&); 49 50 private: 51 InvalidationState& m_invalidationState; 46 52 }; 47 53 -
trunk/Source/WebCore/layout/invalidation/InvalidationState.cpp
r252412 r252415 25 25 26 26 #include "config.h" 27 #include " TableInvalidation.h"27 #include "InvalidationState.h" 28 28 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 30 30 31 #include "Invalidation.h"32 #include "LayoutBox.h"33 #include "LayoutContext.h"34 #include "TableFormattingState.h"35 31 #include <wtf/IsoMallocInlines.h> 36 32 … … 38 34 namespace Layout { 39 35 40 WTF_MAKE_ISO_ALLOCATED_IMPL( TableInvalidation);36 WTF_MAKE_ISO_ALLOCATED_IMPL(InvalidationState); 41 37 42 Invalidation Result TableInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutContext& layoutContext, TableFormattingState&)38 InvalidationState::InvalidationState() 43 39 { 44 layoutContext.markNeedsUpdate(layoutBox); 45 return { nullptr }; 40 } 41 42 void InvalidationState::markNeedsUpdate(const Box& layoutBox) 43 { 44 // We never lay out the initial containing block. It always has pre-determined geometry. 45 ASSERT(!layoutBox.isInitialContainingBlock()); 46 // FIXME: This is just a placeholder implementation. 47 m_formattingContextRoots.add(&layoutBox.formattingContextRoot()); 46 48 } 47 49 -
trunk/Source/WebCore/layout/invalidation/InvalidationState.h
r252412 r252415 1 1 /* 2 * Copyright (C) 201 8Apple 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 "LayoutBox.h" 31 #include "LayoutContainer.h" 30 32 #include <wtf/IsoMalloc.h> 33 #include <wtf/WeakHashSet.h> 31 34 32 35 namespace WebCore { 33 36 namespace Layout { 34 37 35 class Box; 36 class Container; 37 class InlineFormattingState; 38 class LayoutContext; 39 struct InvalidationResult; 40 enum class StyleDiff; 38 class InvalidationState { 39 WTF_MAKE_ISO_ALLOCATED(InvalidationState); 40 public: 41 InvalidationState(); 41 42 42 // This class implements box invalidation for inline formatting context. 43 class InlineInvalidation { 44 WTF_MAKE_ISO_ALLOCATED(InlineInvalidation); 45 public: 46 static InvalidationResult invalidate(const Box&, StyleDiff, LayoutContext&, InlineFormattingState&); 43 void markNeedsUpdate(const Box&); 44 45 using FormattingContextRoots = WeakHashSet<const Container>; 46 // FIXME: We currently do full formatting context layouts (no partial layout within a formatting context). 47 const FormattingContextRoots& formattingContextRoots() const { return m_formattingContextRoots; } 48 49 private: 50 FormattingContextRoots m_formattingContextRoots; 47 51 }; 48 52 -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r251638 r252415 35 35 #include "HTMLTableColElement.h" 36 36 #include "InlineFormattingState.h" 37 #include "InvalidationContext.h" 38 #include "InvalidationState.h" 37 39 #include "LayoutBox.h" 38 40 #include "LayoutChildIterator.h" … … 404 406 auto layoutState = LayoutState { TreeBuilder::createLayoutTree(renderView) }; 405 407 layoutState.setQuirksMode(renderView.document().inLimitedQuirksMode() ? LayoutState::QuirksMode::Limited : (renderView.document().inQuirksMode() ? LayoutState::QuirksMode::Yes : LayoutState::QuirksMode::No)); 406 LayoutContext(layoutState).layout(); 407 showLayoutTree(layoutState.root(), &layoutState); 408 409 auto& layoutRoot = layoutState.root(); 410 auto invalidationState = InvalidationState { }; 411 auto invalidationContext = InvalidationContext { invalidationState }; 412 invalidationContext.styleChanged(*layoutRoot.firstChild(), StyleDifference::Layout); 413 414 LayoutContext(layoutState).layout(invalidationState); 415 showLayoutTree(layoutRoot, &layoutState); 408 416 } 409 417 }
Note: See TracChangeset
for help on using the changeset viewer.