Changeset 289466 in webkit
- Timestamp:
- Feb 9, 2022 4:42:22 AM (5 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlockFlow.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyleConstants.h (modified) (1 diff)
-
Source/WebCore/style/StyleScope.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r289465 r289466 1 2022-02-09 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Implement inline-size containment 4 https://bugs.webkit.org/show_bug.cgi?id=236354 5 6 Reviewed by Antoine Quint. 7 8 * web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt: 9 1 10 2022-02-09 Ziran Sun <zsun@igalia.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-containment-expected.txt
r288627 r289466 3 3 4 4 PASS container-type:inline-size turns on layout containment 5 FAIL container-type:inline-size turns on inline-size containment assert_equals: expected 0 but got 12 5 PASS container-type:inline-size turns on inline-size containment 6 6 PASS container-type:size turns on full size containment 7 7 PASS container-type:inline/size turns on style containment -
trunk/Source/WebCore/ChangeLog
r289465 r289466 1 2022-02-09 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Implement inline-size containment 4 https://bugs.webkit.org/show_bug.cgi?id=236354 5 6 Reviewed by Antoine Quint. 7 8 "Giving an element inline-size containment applies size containment to the inline-axis sizing 9 of its principal box. This means the inline-axis intrinsic sizes of the principal box are 10 determined as if the element had no content." 11 12 https://drafts.csswg.org/css-contain-3/#containment-inline-size 13 14 * rendering/RenderBlockFlow.cpp: 15 (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const): 16 17 Compute inline axis preferred width as if the block had no content. 18 19 * rendering/style/RenderStyle.cpp: 20 (WebCore::RenderStyle::effectiveContainment const): 21 * rendering/style/RenderStyleConstants.h: 22 23 For completeness, add an enum value for inline-size containment. It can only be set by 'container' 24 property for now. 25 26 * style/StyleScope.cpp: 27 (WebCore::Style::Scope::updateQueryContainerState): 28 29 Ignore block axis for inline-size containers. 30 1 31 2022-02-09 Ziran Sun <zsun@igalia.com> 2 32 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r288985 r289466 4082 4082 void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const 4083 4083 { 4084 // "The inline-axis intrinsic sizes of the principal box are determined as if the element had no content." 4085 // https://drafts.csswg.org/css-contain-3/#containment-inline-size 4086 if (style().effectiveContainment().contains(Containment::InlineSize)) 4087 return; 4088 4084 4089 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 4085 4090 if (const_cast<RenderBlockFlow&>(*this).tryComputePreferredWidthsUsingModernPath(minLogicalWidth, maxLogicalWidth)) -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r289241 r289466 2836 2836 break; 2837 2837 case ContainerType::InlineSize: 2838 // FIXME: Support inline-size containment. 2839 containment.add({ Containment::Layout, Containment::Style }); 2838 containment.add({ Containment::Layout, Containment::Style, Containment::InlineSize }); 2840 2839 break; 2841 2840 }; -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r288465 r289466 1226 1226 1227 1227 enum class Containment : uint8_t { 1228 Layout = 1 << 0, 1229 Paint = 1 << 1, 1230 Size = 1 << 2, 1231 Style = 1 << 3, 1228 Layout = 1 << 0, 1229 Paint = 1 << 1, 1230 Size = 1 << 2, 1231 InlineSize = 1 << 3, 1232 Style = 1 << 4, 1232 1233 }; 1233 1234 -
trunk/Source/WebCore/style/StyleScope.cpp
r289457 r289466 798 798 if (!containerElement) 799 799 continue; 800 auto size = containerRenderer.size(); 800 801 auto size = containerRenderer.logicalSize(); 802 803 auto sizeChanged = [&](LayoutSize oldSize) { 804 switch (containerRenderer.style().containerType()) { 805 case ContainerType::InlineSize: 806 return size.width() != oldSize.width(); 807 case ContainerType::Size: 808 return size != oldSize; 809 case ContainerType::None: 810 ASSERT_NOT_REACHED(); 811 return false; 812 } 813 }; 814 801 815 auto it = previousStates.find(*containerElement); 802 bool changed = it == previousStates.end() || it->value != size;816 bool changed = it == previousStates.end() || sizeChanged(it->value); 803 817 if (changed) 804 818 changedContainers.append(containerElement);
Note: See TracChangeset
for help on using the changeset viewer.