-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@Property] Handle dynamic updates to viewport units
https://bugs.webkit.org/show_bug.cgi?id=255689 rdar://108287215 Reviewed by Antti Koivisto. Viewport units are "computationally independent", and so are allowed in registered custom property initial values. But we don't have any mechanism to invalidate them when the viewport size changes. * Source/WebCore/css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::collectComputedStyleDependencies const): Record whether the value had any viewport units. * Source/WebCore/css/CSSRegisteredCustomProperty.h: Store the CSS parser tokens an initial value was created from if it it contains viewport units, so that we can re-parse it when the viewport is resized. * Source/WebCore/css/CSSValue.h: (WebCore::ComputedStyleDependencies::isComputationallyIndependent const): (WebCore::ComputedStyleDependencies::isEmpty const): Deleted. Rename isEmpty, since we don't want it to look at the new viewportDimensions member. * Source/WebCore/css/ComputedStyleExtractor.cpp: (WebCore::ComputedStyleExtractor::customPropertyValue const): (WebCore::ComputedStyleExtractor::propertyValue const): Flush layout in the parent document if there are viewport units used anywhere in the current document. * Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp: (WebCore::DOMCSSRegisterCustomProperty::registerProperty): * Source/WebCore/style/CustomPropertyRegistry.cpp: (WebCore::Style::CustomPropertyRegistry::registerFromAPI): (WebCore::Style::CustomPropertyRegistry::registerFromStylesheet): (WebCore::Style::CustomPropertyRegistry::parseInitialValue): Factor out initial value parsing from DOMCSSRegisterCustomProperty::registerProperty and CustomPropertyRegistry::registerFromStylesheet into a new function parseInitialValue, which returns both the newly parsed CSSCustomPropertyValue as well as whether it contained viewport unit values. * Source/WebCore/style/CustomPropertyRegistry.h: (WebCore::Style::CustomPropertyRegistry::invalidatePropertiesWithViewportUnits): * Source/WebCore/style/StyleScope.cpp: (WebCore::Style::Scope::didChangeViewportSize): Respond to viewport size changes by invalidating all registered custom properties whose initial value contains viewport units. Canonical link: https://commits.webkit.org/267590@main
- Loading branch information
Showing
9 changed files
with
160 additions
and
68 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...tform-tests/css/css-properties-values-api/at-property-viewport-units-dynamic-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
|
||
FAIL @property: viewport units in initial value (dynamic) assert_equals: expected "10px" but got "40px" | ||
PASS @property: viewport units in initial value (dynamic) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters