Changeset 286668 in webkit
- Timestamp:
- Dec 8, 2021 11:16:05 AM (7 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/parsing/layer-import-parsing-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSImportRule+Layer.idl (modified) (1 diff)
-
Source/WebCore/css/CSSImportRule.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSLayerBlockRule.cpp (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSParserImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r286657 r286668 1 2021-12-08 Antti Koivisto <antti@apple.com> 2 3 [CSS Cascade Layers] CSSImportRule.cssText doesn't include layer parameter 4 https://bugs.webkit.org/show_bug.cgi?id=234010 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/css-cascade/parsing/layer-import-parsing-expected.txt: 9 1 10 2021-12-08 Antti Koivisto <antti@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/parsing/layer-import-parsing-expected.txt
r286647 r286668 1 1 2 FAIL @import url("nonexist.css") layer; should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer;" but got "@import url(\"nonexist.css\");" 3 FAIL @import url("nonexist.css") layer(A); should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer(A);" but got "@import url(\"nonexist.css\");" 4 FAIL @import url("nonexist.css") layer(A.B); should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer(A.B);" but got "@import url(\"nonexist.css\");" 5 FAIL @import url(nonexist.css) layer; should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer;" but got "@import url(\"nonexist.css\");" 6 FAIL @import url(nonexist.css) layer(A); should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer(A);" but got "@import url(\"nonexist.css\");" 7 FAIL @import url(nonexist.css) layer(A.B); should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer(A.B);" but got "@import url(\"nonexist.css\");" 8 FAIL @import "nonexist.css" layer; should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer;" but got "@import url(\"nonexist.css\");" 9 FAIL @import "nonexist.css" layer(A); should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer(A);" but got "@import url(\"nonexist.css\");" 10 FAIL @import "nonexist.css" layer(A.B); should be a valid layered import rule assert_equals: serialization should be canonical expected "@import url(\"nonexist.css\") layer(A.B);" but got "@import url(\"nonexist.css\");" 11 FAIL @import url("nonexist.css") layer(); should still be a valid import rule with an invalid layer declaration assert_not_equals: invalid layer declaration should be parsed as <general-enclosed> media query got disallowed value 0 12 FAIL @import url("nonexist.css") layer(A B); should still be a valid import rule with an invalid layer declaration assert_not_equals: invalid layer declaration should be parsed as <general-enclosed> media query got disallowed value 0 13 FAIL @import url("nonexist.css") layer(A . B); should still be a valid import rule with an invalid layer declaration assert_not_equals: invalid layer declaration should be parsed as <general-enclosed> media query got disallowed value 0 14 FAIL @import url("nonexist.css") layer(A, B, C); should still be a valid import rule with an invalid layer declaration assert_not_equals: invalid layer declaration should be parsed as <general-enclosed> media query got disallowed value 0 2 PASS @import url("nonexist.css") layer; should be a valid layered import rule 3 PASS @import url("nonexist.css") layer(A); should be a valid layered import rule 4 PASS @import url("nonexist.css") layer(A.B); should be a valid layered import rule 5 PASS @import url(nonexist.css) layer; should be a valid layered import rule 6 PASS @import url(nonexist.css) layer(A); should be a valid layered import rule 7 PASS @import url(nonexist.css) layer(A.B); should be a valid layered import rule 8 PASS @import "nonexist.css" layer; should be a valid layered import rule 9 PASS @import "nonexist.css" layer(A); should be a valid layered import rule 10 PASS @import "nonexist.css" layer(A.B); should be a valid layered import rule 11 PASS @import url("nonexist.css") layer(); should still be a valid import rule with an invalid layer declaration 12 PASS @import url("nonexist.css") layer(A B); should still be a valid import rule with an invalid layer declaration 13 PASS @import url("nonexist.css") layer(A . B); should still be a valid import rule with an invalid layer declaration 14 PASS @import url("nonexist.css") layer(A, B, C); should still be a valid import rule with an invalid layer declaration 15 15 -
trunk/Source/WebCore/ChangeLog
r286657 r286668 1 2021-12-08 Antti Koivisto <antti@apple.com> 2 3 [CSS Cascade Layers] CSSImportRule.cssText doesn't include layer parameter 4 https://bugs.webkit.org/show_bug.cgi?id=234010 5 6 Reviewed by Simon Fraser. 7 8 Fix serialization of import rules than include layer, like 9 10 @import url(foo.css) layer(A); 11 12 Also make the parsing of the layer() argument stricter. 13 14 * css/CSSImportRule.cpp: 15 (WebCore::CSSImportRule::cssText const): 16 17 Serialize the layer. 18 19 * css/CSSLayerBlockRule.cpp: 20 (WebCore::stringFromCascadeLayerName): 21 22 Serialize layer name segments as identifiers. 23 24 * css/parser/CSSParserImpl.cpp: 25 (WebCore::CSSParserImpl::consumeImportRule): 26 27 Fail parsing if there is anything left in the function argument after consuming the layer name. 28 If the parsing fails, revert and try the full string as media query. 29 1 30 2021-12-08 Antti Koivisto <antti@apple.com> 2 31 -
trunk/Source/WebCore/css/CSSImportRule+Layer.idl
r286657 r286668 33 33 Exposed=Window 34 34 ] partial interface CSSImportRule { 35 readonly attribute CSSOMString? layerName;35 readonly attribute CSSOMString? layerName; 36 36 }; -
trunk/Source/WebCore/css/CSSImportRule.cpp
r286657 r286668 69 69 String CSSImportRule::cssText() const 70 70 { 71 StringBuilder builder; 72 73 builder.append("@import ", serializeURL(m_importRule.get().href())); 74 75 if (auto layerName = this->layerName(); !layerName.isNull()) { 76 if (layerName.isEmpty()) 77 builder.append(" layer"); 78 else 79 builder.append(" layer(", layerName, ')'); 80 } 81 71 82 if (auto queries = m_importRule.get().mediaQueries()) { 72 83 if (auto mediaText = queries->mediaText(); !mediaText.isEmpty()) 73 return makeString("@import url(\"", m_importRule.get().href(), "\") ", mediaText, ';');84 builder.append(' ', mediaText); 74 85 } 75 return makeString("@import url(\"", m_importRule.get().href(), "\");"); 86 87 builder.append(';'); 88 89 return builder.toString(); 76 90 } 77 91 -
trunk/Source/WebCore/css/CSSLayerBlockRule.cpp
r286657 r286668 31 31 #include "CSSLayerBlockRule.h" 32 32 33 #include "CSSMarkup.h" 33 34 #include "CSSStyleSheet.h" 34 35 #include "StyleRule.h" … … 76 77 StringBuilder result; 77 78 for (auto& segment : name) { 78 result.append(segment);79 serializeIdentifier(segment, result); 79 80 if (&segment != &name.last()) 80 81 result.append('.'); -
trunk/Source/WebCore/css/parser/CSSParserImpl.cpp
r286657 r286668 566 566 auto& token = prelude.peek(); 567 567 if (token.type() == FunctionToken && equalIgnoringASCIICase(token.value(), "layer")) { 568 auto savedPreludeForFailure = prelude; 568 569 auto contents = CSSPropertyParserHelpers::consumeFunction(prelude); 569 return consumeCascadeLayerName(contents, AllowAnonymous::No); 570 auto layerName = consumeCascadeLayerName(contents, AllowAnonymous::No); 571 if (!layerName || !contents.atEnd()) { 572 prelude = savedPreludeForFailure; 573 return { }; 574 } 575 return layerName; 570 576 } 571 577 if (token.type() == IdentToken && equalIgnoringASCIICase(token.value(), "layer")) {
Note: See TracChangeset
for help on using the changeset viewer.