forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[css-anchor-position-1] Add parsing support for
anchor()
https://bugs.webkit.org/show_bug.cgi?id=275063 rdar://129168625 Reviewed by Antti Koivisto. This patch adds initial parsing support for `anchor()` and introduces a new CSSValue subclass named CSSAnchorValue. This class is also implemented as a CSSPrimitiveValue. Note that the parsers for inset properties (left, top, inset-block-end, etc.) have been modified to accept `anchor()` as a value, whereas `anchor()` is not accepted as a <length> in other properties by default. This patch does not support parsing `anchor()` calls in other CSS math functions (such as `calc()` and `min()`). Previously WebKit ignored inset property declarations using `anchor()`. Now, because these values are properly parsed, any inset properties using `anchor()` are assigned a default fixed length of 0 during style resolution. (This causes many spurious test rebaselines.) * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/ * LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/the-anchor-attribute-003.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-anchor-display-none.tentative-expected.txt: * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/css/CSSAnchorValue.cpp: Added. (WebCore::CSSAnchorValue::create): (WebCore::CSSAnchorValue::collectComputedStyleDependencies const): (WebCore::CSSAnchorValue::customCSSText const): (WebCore::CSSAnchorValue::equals const): * Source/WebCore/css/CSSAnchorValue.h: * Source/WebCore/css/CSSPrimitiveValue.cpp: (WebCore::isValidCSSUnitTypeForDoubleConversion): (WebCore::isStringType): (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::~CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::create): (WebCore::CSSPrimitiveValue::unitTypeString): (WebCore::CSSPrimitiveValue::serializeInternal const): (WebCore::CSSPrimitiveValue::equals const): (WebCore::CSSPrimitiveValue::addDerivedHash const): (WebCore::CSSPrimitiveValue::collectComputedStyleDependencies const): * Source/WebCore/css/CSSPrimitiveValue.h: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/CSSUnits.cpp: (WebCore::unitCategory): (WebCore::operator<<): * Source/WebCore/css/CSSUnits.h: * Source/WebCore/css/CSSValue.cpp: (WebCore::CSSValue::visitDerived): * Source/WebCore/css/CSSValue.h: (WebCore::CSSValue::isAnchorValue const): * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/css/calc/CSSCalcCategoryMapping.cpp: (WebCore::hasDoubleValue): * Source/WebCore/css/parser/CSSPropertyParserConsumer+Length.cpp: (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent): * Source/WebCore/css/parser/CSSPropertyParserConsumer+Length.h: * Source/WebCore/css/parser/CSSPropertyParserConsumer+Primitives.h: * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeDashedIdent): (WebCore::CSSPropertyParserHelpers::consumeAutoOrLengthOrPercent): (WebCore::CSSPropertyParserHelpers::consumeSide): (WebCore::CSSPropertyParserHelpers::consumeInsetLogicalStartEnd): (WebCore::CSSPropertyParserHelpers::consumeAnchor): * Source/WebCore/css/parser/CSSPropertyParserHelpers.h: * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertLength): Canonical link: https://commits.webkit.org/279891@main
- Loading branch information
Showing
73 changed files
with
3,106 additions
and
2,851 deletions.
There are no files selected for viewing
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
6 changes: 3 additions & 3 deletions
6
...d/w3c/web-platform-tests/css/css-anchor-position/anchor-getComputedStyle-001-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,5 +1,5 @@ | ||
|
||
FAIL Basic case assert_equals: expected "100px" but got "120px" | ||
FAIL Mixed writing modes and directions assert_equals: expected "100px" but got "150px" | ||
FAIL With containing block padding assert_equals: expected "90px" but got "110px" | ||
FAIL Basic case assert_equals: expected "100px" but got "0px" | ||
FAIL Mixed writing modes and directions assert_equals: expected "100px" but got "0px" | ||
FAIL With containing block padding assert_equals: expected "90px" but got "0px" | ||
|
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
2 changes: 1 addition & 1 deletion
2
...rted/w3c/web-platform-tests/css/css-anchor-position/anchor-name-cross-shadow-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 Should be able to set anchor-name to a shadow DOM part and anchor to it assert_equals: expected 15 but got 0 | ||
PASS Should be able to set anchor-name to the shadow host and anchor to it | ||
FAIL Should be able to set anchor-name to the shadow host and anchor to it assert_equals: expected 15 but got 0 | ||
|
2 changes: 1 addition & 1 deletion
2
...ted/w3c/web-platform-tests/css/css-anchor-position/anchor-name-in-shadow-002-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,3 +1,3 @@ | ||
|
||
PASS Anchor names in different tree scopes should not be confused | ||
FAIL Anchor names in different tree scopes should not be confused assert_equals: expected 100 but got 0 | ||
|
4 changes: 2 additions & 2 deletions
4
...mported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-in-shadow-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 @@ | ||
|
||
PASS anchor-name should not leak out of a shadow tree | ||
FAIL anchor() in shadow tree should not match host anchor-name assert_equals: #anchored is positioned using fallback expected 37 but got 8 | ||
FAIL anchor-name should not leak out of a shadow tree assert_equals: #anchored is positioned against #anchor expected 100 but got 0 | ||
FAIL anchor() in shadow tree should not match host anchor-name assert_equals: #anchored is positioned using fallback expected 37 but got 0 | ||
|
Oops, something went wrong.