Changeset 291594 in webkit
- Timestamp:
- Mar 21, 2022 6:35:47 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/presentational-hints-rollback-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/presentational-hints-rollback.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/style/ElementRuleCollector.cpp (modified) (4 diffs)
-
Source/WebCore/style/ElementRuleCollector.h (modified) (1 diff)
-
Source/WebCore/style/RuleSet.h (modified) (1 diff)
-
Source/WebCore/style/RuleSetBuilder.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r291589 r291594 1 2022-03-21 Oriol Brufau <obrufau@igalia.com> 2 3 [css-cascade] Let revert-layer roll back to preshints 4 https://bugs.webkit.org/show_bug.cgi?id=237532 5 6 Reviewed by Darin Adler. 7 8 Add test. 9 10 * web-platform-tests/css/css-cascade/presentational-hints-rollback-expected.txt: Added. 11 * web-platform-tests/css/css-cascade/presentational-hints-rollback.html: Added. 12 1 13 2022-03-21 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r291589 r291594 1 2022-03-21 Oriol Brufau <obrufau@igalia.com> 2 3 [css-cascade] Let revert-layer roll back to preshints 4 https://bugs.webkit.org/show_bug.cgi?id=237532 5 6 Reviewed by Darin Adler. 7 8 The patch makes presentational hints use a cascade layer priority of 0. 9 The priority of the lowest layer is then increased to 1. 10 This allows 'revert-layer' in author origin revert to the presentational 11 hints origin, which is between user origin and author origin. 12 13 Test: imported/w3c/web-platform-tests/css/css-cascade/presentational-hints-rollback.html 14 15 * style/ElementRuleCollector.cpp: 16 (WebCore::Style::ElementRuleCollector::addElementStyleProperties): 17 (WebCore::Style::ElementRuleCollector::matchAllRules): 18 (WebCore::Style::ElementRuleCollector::addElementInlineStyleProperties): 19 * style/ElementRuleCollector.h: 20 * style/RuleSetBuilder.cpp: 21 (WebCore::Style::RuleSetBuilder::updateCascadeLayerPriorities): 22 1 23 2022-03-21 Chris Dumez <cdumez@apple.com> 2 24 -
trunk/Source/WebCore/style/ElementRuleCollector.cpp
r290457 r291594 127 127 } 128 128 129 inline void ElementRuleCollector::addElementStyleProperties(const StyleProperties* propertySet, bool isCacheable, FromStyleAttribute fromStyleAttribute)129 inline void ElementRuleCollector::addElementStyleProperties(const StyleProperties* propertySet, CascadeLayerPriority priority, bool isCacheable, FromStyleAttribute fromStyleAttribute) 130 130 { 131 131 if (!propertySet || propertySet->isEmpty()) … … 136 136 137 137 auto matchedProperty = MatchedProperties { propertySet }; 138 matchedProperty.cascadeLayerPriority = priority; 138 139 matchedProperty.fromStyleAttribute = fromStyleAttribute; 139 140 addMatchedProperties(WTFMove(matchedProperty), DeclarationOrigin::Author); … … 550 551 auto& styledElement = downcast<StyledElement>(element()); 551 552 // https://html.spec.whatwg.org/#presentational-hints 552 addElementStyleProperties(styledElement.presentationalHintStyle() );553 addElementStyleProperties(styledElement.presentationalHintStyle(), RuleSet::cascadeLayerPriorityForPresentationalHints); 553 554 554 555 // Tables and table cells share an additional presentation style that must be applied 555 556 // after all attributes, since their style depends on the values of multiple attributes. 556 addElementStyleProperties(styledElement.additionalPresentationalHintStyle() );557 addElementStyleProperties(styledElement.additionalPresentationalHintStyle(), RuleSet::cascadeLayerPriorityForPresentationalHints); 557 558 558 559 if (is<HTMLElement>(styledElement)) { … … 589 590 // FIXME: Media control shadow trees seem to have problems with caching. 590 591 bool isInlineStyleCacheable = !inlineStyle->isMutable() && !element().isInShadowTree(); 591 addElementStyleProperties(inlineStyle, isInlineStyleCacheable, FromStyleAttribute::Yes);592 addElementStyleProperties(inlineStyle, RuleSet::cascadeLayerPriorityForUnlayered, isInlineStyleCacheable, FromStyleAttribute::Yes); 592 593 } 593 594 594 595 if (includeSMILProperties && is<SVGElement>(element())) 595 addElementStyleProperties(downcast<SVGElement>(element()).animatedSMILStyleProperties(), false /* isCacheable */);596 addElementStyleProperties(downcast<SVGElement>(element()).animatedSMILStyleProperties(), RuleSet::cascadeLayerPriorityForUnlayered, false /* isCacheable */); 596 597 } 597 598 -
trunk/Source/WebCore/style/ElementRuleCollector.h
r290457 r291594 97 97 98 98 private: 99 void addElementStyleProperties(const StyleProperties*, bool isCacheable = true, FromStyleAttribute = FromStyleAttribute::No);99 void addElementStyleProperties(const StyleProperties*, CascadeLayerPriority, bool isCacheable = true, FromStyleAttribute = FromStyleAttribute::No); 100 100 101 101 void matchUARules(const RuleSet&); -
trunk/Source/WebCore/style/RuleSet.h
r290257 r291594 106 106 bool hasHostPseudoClassRulesMatchingInShadowTree() const { return m_hasHostPseudoClassRulesMatchingInShadowTree; } 107 107 108 static constexpr auto cascadeLayerPriorityForPresentationalHints = std::numeric_limits<CascadeLayerPriority>::min(); 108 109 static constexpr auto cascadeLayerPriorityForUnlayered = std::numeric_limits<CascadeLayerPriority>::max(); 109 110 -
trunk/Source/WebCore/style/RuleSetBuilder.cpp
r290329 r291594 290 290 std::sort(layersInPriorityOrder.begin(), layersInPriorityOrder.end(), compare); 291 291 292 // Priorities matter only relative to each other, so assign them enforcing these constraints: 293 // - Layers must get a priority greater than RuleSet::cascadeLayerPriorityForPresentationalHints. 294 // - Layers must get a priority smaller than RuleSet::cascadeLayerPriorityForUnlayered. 295 // - A layer must get at least the same priority as the previous one. 296 // - A layer should get more priority than the previous one, but this may be impossible if there are too many layers. 297 // In that case, the last layers will get the maximum priority for layers, RuleSet::cascadeLayerPriorityForUnlayered - 1. 292 298 for (unsigned i = 0; i < layerCount; ++i) { 293 auto priority = std::min<unsigned>(i , RuleSet::cascadeLayerPriorityForUnlayered - 1);299 auto priority = std::min<unsigned>(i + RuleSet::cascadeLayerPriorityForPresentationalHints + 1, RuleSet::cascadeLayerPriorityForUnlayered - 1); 294 300 m_ruleSet->cascadeLayerForIdentifier(layersInPriorityOrder[i]).priority = priority; 295 301 }
Note: See TracChangeset
for help on using the changeset viewer.