Diff
Modified: trunk/LayoutTests/ChangeLog (288626 => 288627)
--- trunk/LayoutTests/ChangeLog 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/LayoutTests/ChangeLog 2022-01-26 18:01:02 UTC (rev 288627)
@@ -1,3 +1,12 @@
+2022-01-26 Antti Koivisto <[email protected]>
+
+ [CSS Container Queries] container-type property should establish containment for 'size' and 'inline-size' values
+ https://bugs.webkit.org/show_bug.cgi?id=235638
+
+ Reviewed by Dean Jackson.
+
+ * TestExpectations:
+
2022-01-26 Antoine Quint <[email protected]>
[Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
Modified: trunk/LayoutTests/TestExpectations (288626 => 288627)
--- trunk/LayoutTests/TestExpectations 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/LayoutTests/TestExpectations 2022-01-26 18:01:02 UTC (rev 288627)
@@ -4808,7 +4808,6 @@
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/counters-in-container.html [ ImageOnlyFailure ]
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/display-in-container.html [ ImageOnlyFailure ]
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/fieldset-legend-change.html [ ImageOnlyFailure ]
-webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/inline-size-bfc-floats.html [ ImageOnlyFailure ]
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/multicol-inside-container.html [ ImageOnlyFailure ]
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/pseudo-elements-002.tentative.html [ ImageOnlyFailure ]
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/resize-while-content-visibility-hidden.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288626 => 288627)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-26 18:01:02 UTC (rev 288627)
@@ -1,3 +1,13 @@
+2022-01-26 Antti Koivisto <[email protected]>
+
+ [CSS Container Queries] container-type property should establish containment for 'size' and 'inline-size' values
+ https://bugs.webkit.org/show_bug.cgi?id=235638
+
+ Reviewed by Dean Jackson.
+
+ * web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt:
+ * web-platform-tests/css/css-contain/container-queries/container-type-layout-invalidation-expected.txt:
+
2022-01-26 Youenn Fablet <[email protected]>
Rebase WPT streams tests up to 8d1dc42
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt (288626 => 288627)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt 2022-01-26 18:01:02 UTC (rev 288627)
@@ -1,8 +1,8 @@
AA
A
-FAIL container-type:inline-size turns on layout containment assert_equals: expected 33 but got 8
+PASS container-type:inline-size turns on layout containment
FAIL container-type:inline-size turns on inline-size containment assert_equals: expected 0 but got 12
-FAIL container-type:size turns on full size containment assert_equals: expected 0 but got 18
+PASS container-type:size turns on full size containment
PASS container-type:inline/size turns on style containment
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-layout-invalidation-expected.txt (288626 => 288627)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-layout-invalidation-expected.txt 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-layout-invalidation-expected.txt 2022-01-26 18:01:02 UTC (rev 288627)
@@ -1,4 +1,4 @@
content
-FAIL Changing container-type invalidates layout assert_equals: expected 0 but got 47
+PASS Changing container-type invalidates layout
Modified: trunk/Source/WebCore/ChangeLog (288626 => 288627)
--- trunk/Source/WebCore/ChangeLog 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/Source/WebCore/ChangeLog 2022-01-26 18:01:02 UTC (rev 288627)
@@ -1,3 +1,32 @@
+2022-01-26 Antti Koivisto <[email protected]>
+
+ [CSS Container Queries] container-type property should establish containment for 'size' and 'inline-size' values
+ https://bugs.webkit.org/show_bug.cgi?id=235638
+
+ Reviewed by Dean Jackson.
+
+ https://drafts.csswg.org/css-contain-3/#container-type
+
+ * layout/layouttree/LayoutBox.cpp:
+ (WebCore::Layout::Box::isLayoutContainmentBox const):
+ (WebCore::Layout::Box::isSizeContainmentBox const):
+ * rendering/RenderObject.cpp:
+ (WebCore::shouldApplyAnyContainment):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::effectiveContainment const):
+
+ Add effectiveContaiment function add use it in most places instead of accessing contain()
+ property value directly.
+
+ Apply appropriate containment for container-type. Note that 'inline-size' containment is not
+ supported yet.
+
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::containsLayout const):
+ (WebCore::RenderStyle::containsSize const):
+ (WebCore::RenderStyle::containsStyle const):
+ (WebCore::RenderStyle::containsPaint const):
+
2022-01-26 Antoine Quint <[email protected]>
[Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (288626 => 288627)
--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp 2022-01-26 18:01:02 UTC (rev 288627)
@@ -389,7 +389,7 @@
return isAtomicInlineLevelBox();
return true;
};
- return m_style.contain().contains(Containment::Layout) && supportsLayoutContainment();
+ return m_style.effectiveContainment().contains(Containment::Layout) && supportsLayoutContainment();
}
bool Box::isSizeContainmentBox() const
@@ -406,7 +406,7 @@
return isAtomicInlineLevelBox();
return true;
};
- return m_style.contain().contains(Containment::Size) && supportsSizeContainment();
+ return m_style.effectiveContainment().contains(Containment::Size) && supportsSizeContainment();
}
bool Box::isInternalTableBox() const
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (288626 => 288627)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2022-01-26 18:01:02 UTC (rev 288627)
@@ -2622,7 +2622,7 @@
bool WebCore::shouldApplyAnyContainment(const WebCore::RenderObject& renderer)
{
- if (renderer.style().contain().isEmpty())
+ if (renderer.style().effectiveContainment().isEmpty())
return false;
if ((renderer.style().containsLayout() || renderer.style().containsPaint()) && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isRenderBlockFlow()))
return true;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (288626 => 288627)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2022-01-26 18:01:02 UTC (rev 288627)
@@ -2818,4 +2818,25 @@
RELEASE_ASSERT_NOT_REACHED();
}
+
+OptionSet<Containment> RenderStyle::effectiveContainment() const
+{
+ auto containment = contain();
+
+ switch (containerType()) {
+ case ContainerType::None:
+ break;
+ case ContainerType::Size:
+ containment.add({ Containment::Layout, Containment::Style, Containment::Size });
+ break;
+ case ContainerType::InlineSize:
+ // FIXME: Support inline-size containment.
+ containment.add({ Containment::Layout, Containment::Style });
+ break;
+ };
+
+ return containment;
+}
+
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (288626 => 288627)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-01-26 17:58:55 UTC (rev 288626)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-01-26 18:01:02 UTC (rev 288627)
@@ -528,10 +528,11 @@
}
bool hasAspectRatio() const { return aspectRatioType() == AspectRatioType::Ratio || aspectRatioType() == AspectRatioType::AutoAndRatio; }
OptionSet<Containment> contain() const { return m_rareNonInheritedData->contain; }
- bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); }
- bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); }
- bool containsStyle() const { return m_rareNonInheritedData->contain.contains(Containment::Style); }
- bool containsPaint() const { return m_rareNonInheritedData->contain.contains(Containment::Paint); }
+ OptionSet<Containment> effectiveContainment() const;
+ bool containsLayout() const { return effectiveContainment().contains(Containment::Layout); }
+ bool containsSize() const { return effectiveContainment().contains(Containment::Size); }
+ bool containsStyle() const { return effectiveContainment().contains(Containment::Style); }
+ bool containsPaint() const { return effectiveContainment().contains(Containment::Paint); }
ContainerType containerType() const { return static_cast<ContainerType>(m_rareNonInheritedData->containerType); }
const Vector<AtomString>& containerNames() const { return m_rareNonInheritedData->containerNames; }
BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }