Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (282347 => 282348)
--- trunk/Source/WebCore/CMakeLists.txt 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/CMakeLists.txt 2021-09-13 19:35:36 UTC (rev 282348)
@@ -112,7 +112,6 @@
"${WEBCORE_DIR}/layout/formattingContexts/inline"
"${WEBCORE_DIR}/layout/formattingContexts/inline/text"
"${WEBCORE_DIR}/layout/integration"
- "${WEBCORE_DIR}/layout/invalidation"
"${WEBCORE_DIR}/layout/layouttree"
"${WEBCORE_DIR}/layout/formattingContexts/table"
"${WEBCORE_DIR}/loader"
Modified: trunk/Source/WebCore/ChangeLog (282347 => 282348)
--- trunk/Source/WebCore/ChangeLog 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/ChangeLog 2021-09-13 19:35:36 UTC (rev 282348)
@@ -1,3 +1,60 @@
+2021-09-13 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Do not pass in the InvalidationState to the layout functions
+ https://bugs.webkit.org/show_bug.cgi?id=229221
+ <rdar://problem/82321574>
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for introducing formatting context specific invalidation.
+ Each type of formatting context may require a very different invalidation logic. While BFC could mark whole subtrees dirty, IFC's invalidation logic should be looking at lines instead.
+ The invalidation code (triggered by style/content change) produces a "damage state" which is input to the FormattingContext construction
+ the same way we pass in the FormattingState
+ (i.e. FormattinContext takes the root of the formatting subtree (the extent of the formatting context), the damaged state (how much we need to layout in this frame) and the formatting state (the data we can use from previous layout))
+
+ * CMakeLists.txt:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/LayoutContext.cpp:
+ (WebCore::Layout::LayoutContext::layout):
+ (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
+ (WebCore::Layout::LayoutContext::layoutWithPreparedRootGeometry): Deleted.
+ * layout/LayoutContext.h:
+ * layout/formattingContexts/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
+ * layout/formattingContexts/FormattingContext.h:
+ * layout/formattingContexts/block/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
+ * layout/formattingContexts/block/BlockFormattingContext.h:
+ * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
+ (WebCore::Layout::TableWrapperBlockFormattingContext::layoutInFlowContent):
+ (WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox):
+ * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
+ * layout/formattingContexts/flex/FlexFormattingContext.cpp:
+ (WebCore::Layout::FlexFormattingContext::layoutInFlowContent):
+ (WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
+ * layout/formattingContexts/flex/FlexFormattingContext.h:
+ * layout/formattingContexts/inline/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
+ (WebCore::Layout::InlineFormattingContext::lineLayoutForIntergration):
+ (WebCore::Layout::InlineFormattingContext::invalidateFormattingState):
+ * layout/formattingContexts/inline/InlineFormattingContext.h:
+ * layout/formattingContexts/table/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
+ (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
+ (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
+ * layout/formattingContexts/table/TableFormattingContext.h:
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::layout):
+ * layout/invalidation/InvalidationContext.cpp: Removed.
+ * layout/invalidation/InvalidationContext.h: Removed.
+ * layout/invalidation/InvalidationState.cpp: Removed.
+ * layout/invalidation/InvalidationState.h: Removed.
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::printLayoutTreeForLiveDocuments):
+ * page/FrameViewLayoutContext.cpp:
+ (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
+
2021-09-13 Youenn Fablet <[email protected]>
Remove WritableStream runtime flag
Modified: trunk/Source/WebCore/Sources.txt (282347 => 282348)
--- trunk/Source/WebCore/Sources.txt 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/Sources.txt 2021-09-13 19:35:36 UTC (rev 282348)
@@ -1487,8 +1487,6 @@
layout/integration/LayoutIntegrationLineLayout.cpp
layout/integration/LayoutIntegrationPagination.cpp
layout/integration/LayoutIntegrationRunIterator.cpp
-layout/invalidation/InvalidationContext.cpp
-layout/invalidation/InvalidationState.cpp
layout/layouttree/LayoutBox.cpp
layout/layouttree/LayoutContainerBox.cpp
layout/layouttree/LayoutBoxGeometry.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (282347 => 282348)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-13 19:35:36 UTC (rev 282348)
@@ -2162,8 +2162,6 @@
6F7CA3C6208C2957002F29AB /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C4208C2956002F29AB /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F7CA3CA208C2B2E002F29AB /* InlineFormattingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F91421125152138004E4FEA /* InlineLineGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F91420F25152137004E4FEA /* InlineLineGeometry.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 6F95DE4D237B889C00E517E1 /* InvalidationContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F95DE4B237B889B00E517E1 /* InvalidationContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 6F95DE4E237B889C00E517E1 /* InvalidationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F95DE4C237B889C00E517E1 /* InvalidationState.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F995A161A70756200A735F4 /* WebGLSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A141A70756200A735F4 /* WebGLSync.h */; };
6F995A201A7078B100A735F4 /* WebGLQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A181A7078B100A735F4 /* WebGLQuery.h */; };
6F995A221A7078B100A735F4 /* WebGLSampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A1A1A7078B100A735F4 /* WebGLSampler.h */; };
@@ -10057,8 +10055,6 @@
6F8F460121B03BB40041AC3A /* FormattingQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingQuirks.cpp; sourceTree = "<group>"; };
6F8F460321B03BC60041AC3A /* BlockFormattingQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockFormattingQuirks.cpp; sourceTree = "<group>"; };
6F91420F25152137004E4FEA /* InlineLineGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineLineGeometry.h; sourceTree = "<group>"; };
- 6F95DE4B237B889B00E517E1 /* InvalidationContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InvalidationContext.h; sourceTree = "<group>"; };
- 6F95DE4C237B889C00E517E1 /* InvalidationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InvalidationState.h; sourceTree = "<group>"; };
6F995A091A7070E600A735F4 /* WebGLQuery.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLQuery.idl; sourceTree = "<group>"; };
6F995A0A1A7070E600A735F4 /* WebGLSampler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLSampler.idl; sourceTree = "<group>"; };
6F995A0B1A7070E600A735F4 /* WebGLSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLSync.idl; sourceTree = "<group>"; };
@@ -10111,8 +10107,6 @@
6FE636E72647962900F0951E /* InlineFormattingQuirks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineFormattingQuirks.h; sourceTree = "<group>"; };
6FE7AA2621C37B6300296DCD /* MarginTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MarginTypes.h; sourceTree = "<group>"; };
6FE7CFA02177EEF1005B1573 /* InlineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineItem.h; sourceTree = "<group>"; };
- 6FE8E6F7237BA5E800758D26 /* InvalidationContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InvalidationContext.cpp; sourceTree = "<group>"; };
- 6FE8E6F8237BA6B200758D26 /* InvalidationState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InvalidationState.cpp; sourceTree = "<group>"; };
6FE9F09222211035004C5082 /* ContentChangeObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentChangeObserver.cpp; sourceTree = "<group>"; };
6FEFE81D22F9D22A00114927 /* LayoutPhase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutPhase.h; sourceTree = "<group>"; };
6FF911F626487FC8002021DF /* FlexFormattingGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlexFormattingGeometry.h; sourceTree = "<group>"; };
@@ -18071,7 +18065,6 @@
6FCFC055212DACC2007695D2 /* floats */,
6F844F7F263D916100F91370 /* formattingContexts */,
E4FB4B1E2395356F003C336A /* integration */,
- 6F95DE4A237B883000E517E1 /* invalidation */,
115CFA90208B9441001E6991 /* layouttree */,
115CFA75208AFE30001E6991 /* FormattingState.cpp */,
115CFA74208AFE30001E6991 /* FormattingState.h */,
@@ -22409,17 +22402,6 @@
path = formattingContexts;
sourceTree = "<group>";
};
- 6F95DE4A237B883000E517E1 /* invalidation */ = {
- isa = PBXGroup;
- children = (
- 6FE8E6F7237BA5E800758D26 /* InvalidationContext.cpp */,
- 6F95DE4B237B889B00E517E1 /* InvalidationContext.h */,
- 6FE8E6F8237BA6B200758D26 /* InvalidationState.cpp */,
- 6F95DE4C237B889C00E517E1 /* InvalidationState.h */,
- );
- path = invalidation;
- sourceTree = "<group>";
- };
6FB7D2D5250FD7B5000207AA /* flex */ = {
isa = PBXGroup;
children = (
@@ -32696,8 +32678,6 @@
E134F5AB12EE343F004EC58D /* IntRectHash.h in Headers */,
B27535750B053814002CE64F /* IntSize.h in Headers */,
B27535760B053814002CE64F /* IntSizeHash.h in Headers */,
- 6F95DE4D237B889C00E517E1 /* InvalidationContext.h in Headers */,
- 6F95DE4E237B889C00E517E1 /* InvalidationState.h in Headers */,
2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */,
1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */,
CD5FF4992162E2BE004BD86F /* ISOBox.h in Headers */,
@@ -35629,7 +35609,6 @@
834A6A3A2526844A00747F5D /* WorkletParameters.h in Headers */,
833BD8172524D4F2006E72B3 /* WorkletPendingTasks.h in Headers */,
93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */,
- 41E6D72326EAA04600B765D6 /* WritableStream.h in Headers */,
416E6FE81BBD12DF000A6053 /* WritableStreamInternalsBuiltins.h in Headers */,
9BAF3B2412C1A39800014BF1 /* WritingDirection.h in Headers */,
14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */,
@@ -36880,7 +36859,6 @@
E1EE8B912413195000E794D6 /* WebXRViewport.cpp in Sources */,
E1EE8B832413191F00E794D6 /* WebXRWebGLLayer.cpp in Sources */,
A14832C2187F65C700DA63A6 /* WKUtilities.c in Sources */,
- 41E6D72426EAA04600B765D6 /* WritableStream.cpp in Sources */,
A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */,
A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */,
E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */,
Modified: trunk/Source/WebCore/layout/LayoutContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/LayoutContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/LayoutContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -34,8 +34,6 @@
#include "FlexFormattingState.h"
#include "InlineFormattingContext.h"
#include "InlineFormattingState.h"
-#include "InvalidationContext.h"
-#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutBoxGeometry.h"
#include "LayoutContainerBox.h"
@@ -59,7 +57,7 @@
{
}
-void LayoutContext::layout(const LayoutSize& rootContentBoxSize, InvalidationState& invalidationState)
+void LayoutContext::layout(const LayoutSize& rootContentBoxSize)
{
// Set the geometry on the root.
// Note that we never layout the root box. It has to have an already computed geometry (in case of ICB, it's the view geometry).
@@ -74,23 +72,12 @@
boxGeometry.setContentBoxHeight(rootContentBoxSize.height());
boxGeometry.setContentBoxWidth(rootContentBoxSize.width());
- layoutWithPreparedRootGeometry(invalidationState);
+ auto scope = PhaseScope { Phase::Type::Layout };
+ layoutFormattingContextSubtree(m_layoutState.root());
}
-void LayoutContext::layoutWithPreparedRootGeometry(InvalidationState& invalidationState)
-{
- PhaseScope scope(Phase::Type::Layout);
- auto& formattingContextRootsForLayout = invalidationState.formattingContextRoots();
- // When invalidation is empty, we assume constraint mutation and start running layout on the context root. Layout logic should be able to figure out the damage.
- if (formattingContextRootsForLayout.computesEmpty())
- return layoutFormattingContextSubtree(m_layoutState.root(), invalidationState);
-
- for (auto& formattingContextRoot : formattingContextRootsForLayout)
- layoutFormattingContextSubtree(formattingContextRoot, invalidationState);
-}
-
-void LayoutContext::layoutFormattingContextSubtree(const ContainerBox& formattingContextRoot, InvalidationState& invalidationState)
+void LayoutContext::layoutFormattingContextSubtree(const ContainerBox& formattingContextRoot)
{
RELEASE_ASSERT(formattingContextRoot.establishesFormattingContext());
if (!formattingContextRoot.hasChild())
@@ -101,7 +88,7 @@
if (formattingContextRoot.hasInFlowOrFloatingChild()) {
auto constraintsForInFlowContent = ConstraintsForInFlowContent { { boxGeometry.contentBoxLeft(), boxGeometry.contentBoxWidth() }, boxGeometry.contentBoxTop() };
- formattingContext->layoutInFlowContent(invalidationState, constraintsForInFlowContent);
+ formattingContext->layoutInFlowContent(constraintsForInFlowContent);
}
// FIXME: layoutFormattingContextSubtree() does not perform layout on the root, rather it lays out the root's content.
@@ -110,7 +97,7 @@
{
auto constraints = ConstraintsForOutOfFlowContent { { boxGeometry.paddingBoxLeft(), boxGeometry.paddingBoxWidth() },
{ boxGeometry.paddingBoxTop(), boxGeometry.paddingBoxHeight() }, boxGeometry.contentBoxWidth() };
- formattingContext->layoutOutOfFlowContent(invalidationState, constraints);
+ formattingContext->layoutOutOfFlowContent(constraints);
}
}
Modified: trunk/Source/WebCore/layout/LayoutContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/LayoutContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/LayoutContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -40,7 +40,6 @@
namespace Layout {
class ContainerBox;
-class InvalidationState;
class LayoutState;
class FormattingContext;
@@ -54,8 +53,7 @@
public:
LayoutContext(LayoutState&);
- void layout(const LayoutSize& rootContentBoxSize, InvalidationState&);
- void layoutWithPreparedRootGeometry(InvalidationState&);
+ void layout(const LayoutSize& rootContentBoxSize);
static std::unique_ptr<FormattingContext> createFormattingContext(const ContainerBox& formattingContextRoot, LayoutState&);
@@ -65,7 +63,7 @@
#endif
private:
- void layoutFormattingContextSubtree(const ContainerBox&, InvalidationState&);
+ void layoutFormattingContextSubtree(const ContainerBox&);
LayoutState& layoutState() { return m_layoutState; }
LayoutState& m_layoutState;
Modified: trunk/Source/WebCore/layout/formattingContexts/FormattingContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -31,7 +31,6 @@
#include "FormattingGeometry.h"
#include "FormattingQuirks.h"
#include "FormattingState.h"
-#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutBoxGeometry.h"
#include "LayoutContainerBox.h"
@@ -135,7 +134,7 @@
boxGeometry.setPadding(formattingGeometry().computedPadding(layoutBox, horizontalConstraint.logicalWidth));
}
-void FormattingContext::layoutOutOfFlowContent(InvalidationState& invalidationState, const ConstraintsForOutOfFlowContent& constraints)
+void FormattingContext::layoutOutOfFlowContent(const ConstraintsForOutOfFlowContent& constraints)
{
LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: layout out-of-flow content -> context: " << &layoutState() << " root: " << &root());
@@ -148,9 +147,6 @@
for (auto& outOfFlowBox : formattingState().outOfFlowBoxes()) {
ASSERT(outOfFlowBox->establishesFormattingContext());
- if (!invalidationState.needsLayout(*outOfFlowBox))
- continue;
-
auto containingBlockConstraints = constraintsForLayoutBox(*outOfFlowBox);
auto horizontalConstraintsForBorderAndPadding = HorizontalConstraints { containingBlockConstraints.horizontal.logicalLeft, containingBlockConstraints.borderAndPaddingConstraints };
computeBorderAndPadding(*outOfFlowBox, horizontalConstraintsForBorderAndPadding);
@@ -161,9 +157,9 @@
auto& containerBox = downcast<ContainerBox>(*outOfFlowBox);
auto formattingContext = LayoutContext::createFormattingContext(containerBox, layoutState());
if (containerBox.hasInFlowOrFloatingChild())
- formattingContext->layoutInFlowContent(invalidationState, formattingGeometry().constraintsForInFlowContent(containerBox));
+ formattingContext->layoutInFlowContent(formattingGeometry().constraintsForInFlowContent(containerBox));
computeOutOfFlowVerticalGeometry(containerBox, containingBlockConstraints);
- formattingContext->layoutOutOfFlowContent(invalidationState, formattingGeometry().constraintsForOutOfFlowContent(containerBox));
+ formattingContext->layoutOutOfFlowContent(formattingGeometry().constraintsForOutOfFlowContent(containerBox));
} else
computeOutOfFlowVerticalGeometry(*outOfFlowBox, containingBlockConstraints);
}
Modified: trunk/Source/WebCore/layout/formattingContexts/FormattingContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -50,7 +50,6 @@
class FormattingState;
class FormattingQuirks;
struct IntrinsicWidthConstraints;
-class InvalidationState;
class LayoutState;
class FormattingContext {
@@ -58,8 +57,8 @@
public:
virtual ~FormattingContext();
- virtual void layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent&) = 0;
- void layoutOutOfFlowContent(InvalidationState&, const ConstraintsForOutOfFlowContent&);
+ virtual void layoutInFlowContent(const ConstraintsForInFlowContent&) = 0;
+ void layoutOutOfFlowContent(const ConstraintsForOutOfFlowContent&);
virtual IntrinsicWidthConstraints computedIntrinsicWidthConstraints() = 0;
virtual LayoutUnit usedContentHeight() const = 0;
Modified: trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -33,7 +33,6 @@
#include "BlockMarginCollapse.h"
#include "FloatingContext.h"
#include "FloatingState.h"
-#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutChildIterator.h"
#include "LayoutContainerBox.h"
@@ -58,7 +57,7 @@
{
}
-void BlockFormattingContext::layoutInFlowContent(InvalidationState& invalidationState, const ConstraintsForInFlowContent& constraints)
+void BlockFormattingContext::layoutInFlowContent(const ConstraintsForInFlowContent& constraints)
{
// 9.4.1 Block formatting contexts
// In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
@@ -77,8 +76,6 @@
if (!is<ContainerBox>(layoutBox))
return false;
for (auto* child = downcast<ContainerBox>(layoutBox).firstInFlowOrFloatingChild(); child; child = child->nextInFlowOrFloatingSibling()) {
- if (!invalidationState.needsLayout(*child))
- continue;
layoutQueue.append(child);
return true;
}
@@ -87,8 +84,6 @@
if (direction == LayoutDirection::Sibling) {
for (auto* nextSibling = layoutBox.nextInFlowOrFloatingSibling(); nextSibling; nextSibling = nextSibling->nextInFlowOrFloatingSibling()) {
- if (!invalidationState.needsLayout(*nextSibling))
- continue;
layoutQueue.append(nextSibling);
return true;
}
@@ -133,7 +128,7 @@
auto formattingContext = LayoutContext::createFormattingContext(containerBox, layoutState());
if (containerBox.isTableWrapperBox())
downcast<TableWrapperBlockFormattingContext>(*formattingContext).setHorizontalConstraintsIgnoringFloats(containingBlockConstraints.horizontal());
- formattingContext->layoutInFlowContent(invalidationState, formattingGeometry().constraintsForInFlowContent(containerBox));
+ formattingContext->layoutInFlowContent(formattingGeometry().constraintsForInFlowContent(containerBox));
}
break;
}
@@ -164,7 +159,7 @@
// Now that we computed the box's height, we can layout the out-of-flow descendants.
if (is<ContainerBox>(layoutBox) && downcast<ContainerBox>(layoutBox).hasChild()) {
auto& containerBox = downcast<ContainerBox>(layoutBox);
- LayoutContext::createFormattingContext(containerBox, layoutState())->layoutOutOfFlowContent(invalidationState, formattingGeometry().constraintsForOutOfFlowContent(containerBox));
+ LayoutContext::createFormattingContext(containerBox, layoutState())->layoutOutOfFlowContent(formattingGeometry().constraintsForOutOfFlowContent(containerBox));
}
}
if (!establishesFormattingContext && is<ContainerBox>(layoutBox))
Modified: trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -51,7 +51,7 @@
public:
BlockFormattingContext(const ContainerBox& formattingContextRoot, BlockFormattingState&);
- void layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent&) override;
+ void layoutInFlowContent(const ConstraintsForInFlowContent&) override;
LayoutUnit usedContentHeight() const override;
const BlockFormattingState& formattingState() const { return downcast<BlockFormattingState>(FormattingContext::formattingState()); }
Modified: trunk/Source/WebCore/layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -31,7 +31,6 @@
#include "BlockFormattingGeometry.h"
#include "BlockFormattingState.h"
#include "BlockMarginCollapse.h"
-#include "InvalidationState.h"
#include "LayoutBoxGeometry.h"
#include "LayoutChildIterator.h"
#include "LayoutContext.h"
@@ -52,7 +51,7 @@
{
}
-void TableWrapperBlockFormattingContext::layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent& constraints)
+void TableWrapperBlockFormattingContext::layoutInFlowContent(const ConstraintsForInFlowContent& constraints)
{
// The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes
// (in document order). The table box is a block-level box that contains the table's internal table boxes.
@@ -80,9 +79,8 @@
if (tableBox.hasChild()) {
auto& formattingGeometry = this->formattingGeometry();
- auto invalidationState = InvalidationState { };
auto constraints = ConstraintsForTableContent { formattingGeometry.constraintsForInFlowContent(tableBox), formattingGeometry.computedHeight(tableBox) };
- LayoutContext::createFormattingContext(tableBox, layoutState())->layoutInFlowContent(invalidationState, constraints);
+ LayoutContext::createFormattingContext(tableBox, layoutState())->layoutInFlowContent(constraints);
}
computeHeightAndMarginForTableBox(tableBox, constraints);
Modified: trunk/Source/WebCore/layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -42,7 +42,7 @@
public:
TableWrapperBlockFormattingContext(const ContainerBox& formattingContextRoot, BlockFormattingState&);
- void layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent&) final;
+ void layoutInFlowContent(const ConstraintsForInFlowContent&) final;
void setHorizontalConstraintsIgnoringFloats(const HorizontalConstraints& horizontalConstraints) { m_horizontalConstraintsIgnoringFloats = horizontalConstraints; }
Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -31,7 +31,6 @@
#include "FlexFormattingGeometry.h"
#include "FlexFormattingState.h"
#include "InlineRect.h"
-#include "InvalidationState.h"
#include "LayoutBoxGeometry.h"
#include "LayoutChildIterator.h"
#include "LayoutContext.h"
@@ -49,7 +48,7 @@
{
}
-void FlexFormattingContext::layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent& constraints)
+void FlexFormattingContext::layoutInFlowContent(const ConstraintsForInFlowContent& constraints)
{
computeIntrinsicWidthConstraintsForFlexItems();
sizeAndPlaceFlexItems(constraints);
@@ -81,8 +80,7 @@
auto flexItemLogicalWidth = std::min(std::max(intrinsicWidths->minimum, constraints.horizontal().logicalWidth), intrinsicWidths->maximum);
auto flexItemConstraints = ConstraintsForInFlowContent { { { }, flexItemLogicalWidth }, { } };
- auto invalidationState = InvalidationState { };
- LayoutContext::createFormattingContext(flexItem, layoutState())->layoutInFlowContent(invalidationState, flexItemConstraints);
+ LayoutContext::createFormattingContext(flexItem, layoutState())->layoutInFlowContent(flexItemConstraints);
auto computeFlexItemGeometry = [&] {
auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -35,7 +35,6 @@
namespace WebCore {
namespace Layout {
-class InvalidationState;
// This class implements the layout logic for flex formatting contexts.
// https://www.w3.org/TR/css-flexbox-1/
class FlexFormattingContext final : public FormattingContext {
@@ -42,7 +41,7 @@
WTF_MAKE_ISO_ALLOCATED(FlexFormattingContext);
public:
FlexFormattingContext(const ContainerBox& formattingContextRoot, FlexFormattingState&);
- void layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent&) override;
+ void layoutInFlowContent(const ConstraintsForInFlowContent&) override;
LayoutUnit usedContentHeight() const override;
IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -36,7 +36,6 @@
#include "InlineLineBoxBuilder.h"
#include "InlineLineRun.h"
#include "InlineTextItem.h"
-#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutContainerBox.h"
#include "LayoutContext.h"
@@ -83,12 +82,12 @@
return nullptr;
}
-void InlineFormattingContext::layoutInFlowContent(InvalidationState& invalidationState, const ConstraintsForInFlowContent& constraints)
+void InlineFormattingContext::layoutInFlowContent(const ConstraintsForInFlowContent& constraints)
{
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> formatting root(" << &root() << ")");
ASSERT(root().hasInFlowOrFloatingChild());
- invalidateFormattingState(invalidationState);
+ invalidateFormattingState();
auto* layoutBox = root().firstInFlowOrFloatingChild();
// 1. Visit each inline box and partially compute their geometry (margins, padding and borders).
// 2. Collect the inline items (flatten the the layout tree) and place them on lines in bidirectional order.
@@ -106,9 +105,9 @@
if (formattingRoot.hasChild()) {
auto formattingContext = LayoutContext::createFormattingContext(formattingRoot, layoutState());
if (formattingRoot.hasInFlowOrFloatingChild())
- formattingContext->layoutInFlowContent(invalidationState, formattingGeometry().constraintsForInFlowContent(formattingRoot));
+ formattingContext->layoutInFlowContent(formattingGeometry().constraintsForInFlowContent(formattingRoot));
computeHeightAndMargin(formattingRoot, constraints.horizontal());
- formattingContext->layoutOutOfFlowContent(invalidationState, formattingGeometry().constraintsForOutOfFlowContent(formattingRoot));
+ formattingContext->layoutOutOfFlowContent(formattingGeometry().constraintsForOutOfFlowContent(formattingRoot));
} else
computeHeightAndMargin(formattingRoot, constraints.horizontal());
} else {
@@ -146,9 +145,9 @@
LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> formatting root(" << &root() << ")");
}
-void InlineFormattingContext::lineLayoutForIntergration(InvalidationState& invalidationState, const ConstraintsForInFlowContent& constraints)
+void InlineFormattingContext::lineLayoutForIntergration(const ConstraintsForInFlowContent& constraints)
{
- invalidateFormattingState(invalidationState);
+ invalidateFormattingState();
collectContentIfNeeded();
auto& inlineItems = formattingState().inlineItems();
lineLayout(inlineItems, { 0, inlineItems.size() }, constraints);
@@ -583,7 +582,7 @@
return lineBoxLogicalRect;
}
-void InlineFormattingContext::invalidateFormattingState(const InvalidationState&)
+void InlineFormattingContext::invalidateFormattingState()
{
// Find out what we need to invalidate. This is where we add some smarts to do partial line layout.
// For now let's just clear the runs.
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -38,7 +38,6 @@
namespace Layout {
class InlineFormattingState;
-class InvalidationState;
class LineBox;
// This class implements the layout logic for inline formatting contexts.
@@ -47,13 +46,13 @@
WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext);
public:
InlineFormattingContext(const ContainerBox& formattingContextRoot, InlineFormattingState&);
- void layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent&) override;
+ void layoutInFlowContent(const ConstraintsForInFlowContent&) override;
LayoutUnit usedContentHeight() const override;
const InlineFormattingState& formattingState() const { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }
InlineFormattingState& formattingState() { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }
- void lineLayoutForIntergration(InvalidationState&, const ConstraintsForInFlowContent&);
+ void lineLayoutForIntergration(const ConstraintsForInFlowContent&);
const InlineFormattingGeometry& formattingGeometry() const final { return m_inlineFormattingGeometry; }
const InlineFormattingQuirks& formattingQuirks() const final { return m_inlineFormattingQuirks; }
@@ -73,7 +72,7 @@
void collectContentIfNeeded();
InlineRect computeGeometryForLineContent(const LineBuilder::LineContent&);
- void invalidateFormattingState(const InvalidationState&);
+ void invalidateFormattingState();
const InlineFormattingGeometry m_inlineFormattingGeometry;
const InlineFormattingQuirks m_inlineFormattingQuirks;
Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -31,7 +31,6 @@
#include "BlockFormattingState.h"
#include "FloatingState.h"
#include "InlineFormattingState.h"
-#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutBoxGeometry.h"
#include "LayoutChildIterator.h"
@@ -54,7 +53,7 @@
{
}
-void TableFormattingContext::layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent& constraints)
+void TableFormattingContext::layoutInFlowContent(const ConstraintsForInFlowContent& constraints)
{
auto availableHorizontalSpace = constraints.horizontal().logicalWidth;
auto availableVerticalSpace = downcast<ConstraintsForTableContent>(constraints).availableVerticalSpaceForContent();
@@ -105,11 +104,10 @@
cellBoxGeometry.setContentBoxWidth(formattingGeometry.horizontalSpaceForCellContent(*cell));
if (cellBox.hasInFlowOrFloatingChild()) {
- auto invalidationState = InvalidationState { };
// FIXME: This should probably be part of the invalidation state to indicate when we re-layout the cell multiple times as part of the multi-pass table algorithm.
auto& floatingStateForCellContent = layoutState().ensureBlockFormattingState(cellBox).floatingState();
floatingStateForCellContent.clear();
- LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(invalidationState, formattingGeometry.constraintsForInFlowContent(cellBox));
+ LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(formattingGeometry.constraintsForInFlowContent(cellBox));
}
cellBoxGeometry.setContentBoxHeight(formattingGeometry.verticalSpaceForCellContent(*cell, availableVerticalSpace));
@@ -541,10 +539,8 @@
cellBoxGeometry.setPadding(formattingGeometry.computedPadding(cellBox, availableHorizontalSpace));
cellBoxGeometry.setContentBoxWidth(formattingGeometry.horizontalSpaceForCellContent(cell));
- if (cellBox.hasInFlowOrFloatingChild()) {
- auto invalidationState = InvalidationState { };
- LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(invalidationState, formattingGeometry.constraintsForInFlowContent(cellBox));
- }
+ if (cellBox.hasInFlowOrFloatingChild())
+ LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(formattingGeometry.constraintsForInFlowContent(cellBox));
cellBoxGeometry.setContentBoxHeight(formattingGeometry.verticalSpaceForCellContent(cell, availableVerticalSpace));
};
layoutCellContent(slot.cell());
Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h (282347 => 282348)
--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h 2021-09-13 19:35:36 UTC (rev 282348)
@@ -38,8 +38,6 @@
namespace WebCore {
namespace Layout {
-class InvalidationState;
-
// This class implements the layout logic for table formatting contexts.
// https://www.w3.org/TR/CSS22/tables.html
class TableFormattingContext final : public FormattingContext {
@@ -46,7 +44,7 @@
WTF_MAKE_ISO_ALLOCATED(TableFormattingContext);
public:
TableFormattingContext(const ContainerBox& formattingContextRoot, TableFormattingState&);
- void layoutInFlowContent(InvalidationState&, const ConstraintsForInFlowContent&) override;
+ void layoutInFlowContent(const ConstraintsForInFlowContent&) override;
LayoutUnit usedContentHeight() const override;
const TableFormattingGeometry& formattingGeometry() const final { return m_tableFormattingGeometry; }
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -35,7 +35,6 @@
#include "HitTestResult.h"
#include "InlineFormattingContext.h"
#include "InlineFormattingState.h"
-#include "InvalidationState.h"
#include "LayoutBoxGeometry.h"
#include "LayoutIntegrationCoverage.h"
#include "LayoutIntegrationInlineContentBuilder.h"
@@ -216,10 +215,9 @@
auto& rootGeometry = m_layoutState.geometryForBox(rootLayoutBox);
auto inlineFormattingContext = Layout::InlineFormattingContext { rootLayoutBox, m_inlineFormattingState };
- auto invalidationState = Layout::InvalidationState { };
auto horizontalConstraints = Layout::HorizontalConstraints { rootGeometry.contentBoxLeft(), rootGeometry.contentBoxWidth() };
- inlineFormattingContext.lineLayoutForIntergration(invalidationState, { horizontalConstraints, rootGeometry.contentBoxTop() });
+ inlineFormattingContext.lineLayoutForIntergration({ horizontalConstraints, rootGeometry.contentBoxTop() });
constructContent();
}
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (282347 => 282348)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -35,8 +35,6 @@
#include "HTMLTableColElement.h"
#include "HTMLTableElement.h"
#include "InlineFormattingState.h"
-#include "InvalidationContext.h"
-#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutBoxGeometry.h"
#include "LayoutChildIterator.h"
@@ -591,9 +589,7 @@
auto layoutState = LayoutState { *document, layoutTree->root() };
auto& layoutRoot = layoutState.root();
- auto invalidationState = InvalidationState { };
-
- LayoutContext(layoutState).layout(renderView.size(), invalidationState);
+ LayoutContext(layoutState).layout(renderView.size());
showLayoutTree(layoutRoot, &layoutState);
}
}
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (282347 => 282348)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2021-09-13 19:01:24 UTC (rev 282347)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2021-09-13 19:35:36 UTC (rev 282348)
@@ -40,8 +40,6 @@
#include "Settings.h"
#include "StyleScope.h"
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "InvalidationContext.h"
-#include "InvalidationState.h"
#include "LayoutBoxGeometry.h"
#include "LayoutContext.h"
#include "LayoutState.h"
@@ -67,10 +65,8 @@
auto& renderView = *this->renderView();
m_layoutTree = Layout::TreeBuilder::buildLayoutTree(renderView);
m_layoutState = makeUnique<Layout::LayoutState>(*document(), m_layoutTree->root());
- // FIXME: This is not the real invalidation yet.
- auto invalidationState = Layout::InvalidationState { };
auto layoutContext = Layout::LayoutContext { *m_layoutState };
- layoutContext.layout(view().layoutSize(), invalidationState);
+ layoutContext.layout(view().layoutSize());
// Clean up the render tree state when we don't run RenderView::layout.
if (renderView.needsLayout()) {