Changeset 291500 in webkit
- Timestamp:
- Mar 18, 2022 3:47:34 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-invalidation-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-invalidation-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-selection-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/style/StyleChange.cpp (modified) (1 diff)
-
Source/WebCore/style/StyleTreeResolver.cpp (modified) (3 diffs)
-
Source/WebCore/style/StyleTreeResolver.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r291474 r291500 1 2022-03-18 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Ensure container style changes are propagated to descendants 4 https://bugs.webkit.org/show_bug.cgi?id=238072 5 6 Reviewed by Alan Bujtas. 7 8 * web-platform-tests/css/css-contain/container-queries/container-name-invalidation-expected.txt: 9 * web-platform-tests/css/css-contain/container-queries/container-type-invalidation-expected.txt: 10 * web-platform-tests/css/css-contain/container-queries/container-units-selection-expected.txt: 11 1 12 2022-03-18 Antti Koivisto <antti@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-invalidation-expected.txt
r289617 r291500 2 2 3 3 PASS Changing a named container invalidates relevant descendants 4 FAIL Changing container-name invalidates relevant descendants assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" 4 PASS Changing container-name invalidates relevant descendants 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-invalidation-expected.txt
r289742 r291500 1 1 Test 2 2 3 FAIL Changing the container type invalidates relevant descendants assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" 3 PASS Changing the container type invalidates relevant descendants 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-selection-expected.txt
r291474 r291500 1 1 Test 2 2 3 FAIL Container units select the proper container assert_equals: expected "30px" but got "10px" 3 PASS Container units select the proper container 4 4 FAIL Units respond to the writing-mode of the element assert_equals: expected "40px" but got "30px" 5 5 -
trunk/Source/WebCore/ChangeLog
r291499 r291500 1 2022-03-18 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Ensure container style changes are propagated to descendants 4 https://bugs.webkit.org/show_bug.cgi?id=238072 5 6 Reviewed by Alan Bujtas. 7 8 * style/StyleChange.cpp: 9 (WebCore::Style::determineChange): 10 11 Ensure we recompute the descendants when container properties change. 12 13 * style/StyleTreeResolver.cpp: 14 (WebCore::Style::TreeResolver::resolveComposedTree): 15 (WebCore::Style::TreeResolver::updateQueryContainer): 16 17 We need to ensure layout is up-to-date also when a query container stops being one. 18 Remove the unused m_resolvedQueryContainers maps. 19 20 * style/StyleTreeResolver.h: 21 1 22 2022-03-18 Per Arne Vollan <pvollan@apple.com> 2 23 -
trunk/Source/WebCore/style/StyleChange.cpp
r276902 r291500 64 64 return Change::Inherited; 65 65 66 // Query container changes affect descendant style. 67 if (s1.containerType() != s2.containerType() || s1.containerNames() != s2.containerNames()) 68 return Change::Inherited; 69 66 70 if (s1 != s2) 67 71 return Change::NonInherited; -
trunk/Source/WebCore/style/StyleTreeResolver.cpp
r290867 r291500 707 707 auto change = Change::None; 708 708 auto descendantsToResolve = DescendantsToResolve::None; 709 auto previousContainerType = style ? style->containerType() : ContainerType::None; 709 710 710 711 bool shouldResolve = shouldResolveElement(element, parent.descendantsToResolve); … … 738 739 739 740 if (shouldIterateChildren) { 740 if (updateQueryContainer(element, *style ) == QueryContainerAction::Layout)741 if (updateQueryContainer(element, *style, previousContainerType) == QueryContainerAction::Layout) 741 742 shouldIterateChildren = false; 742 743 } … … 763 764 } 764 765 765 auto TreeResolver::updateQueryContainer(Element& element, const RenderStyle& style) -> QueryContainerAction 766 { 767 if (style.containerType() == ContainerType::None) 766 auto TreeResolver::updateQueryContainer(Element& element, const RenderStyle& style, ContainerType previousContainerType) -> QueryContainerAction 767 { 768 if (style.containerType() != ContainerType::None) 769 scope().selectorMatchingState.queryContainers.append(element); 770 771 if (m_unresolvedQueryContainers.remove(&element)) 772 return QueryContainerAction::Continue; 773 774 // Render tree needs to be updated before proceeding to children also if we have a former query container 775 // because container query resolution for descendants relies on it being up-to-date. 776 if (style.containerType() == ContainerType::None && previousContainerType == ContainerType::None) 768 777 return QueryContainerAction::None; 769 778 770 scope().selectorMatchingState.queryContainers.append(element); 771 772 if (m_unresolvedQueryContainers.remove(&element)) { 773 m_resolvedQueryContainers.add(&element); 779 if (m_update->isEmpty()) 774 780 return QueryContainerAction::Continue; 775 } 776 777 if (m_update->isEmpty()) { 778 m_resolvedQueryContainers.add(&element); 779 return QueryContainerAction::Continue; 780 } 781 781 782 // Bail out from TreeResolver to build a render tree and do a layout. Resolution continues after. 782 783 m_unresolvedQueryContainers.add(&element); 783 784 784 return QueryContainerAction::Layout; 785 785 } -
trunk/Source/WebCore/style/StyleTreeResolver.h
r290867 r291500 64 64 65 65 enum class QueryContainerAction : uint8_t { None, Continue, Layout }; 66 QueryContainerAction updateQueryContainer(Element&, const RenderStyle& );66 QueryContainerAction updateQueryContainer(Element&, const RenderStyle&, ContainerType previousContainerType); 67 67 68 68 enum class DescendantsToResolve : uint8_t { None, ChildrenWithExplicitInherit, Children, All }; … … 128 128 129 129 HashSet<RefPtr<Element>> m_unresolvedQueryContainers; 130 HashSet<RefPtr<Element>> m_resolvedQueryContainers;131 130 132 131 std::unique_ptr<Update> m_update;
Note: See TracChangeset
for help on using the changeset viewer.