Changeset 288099 in webkit
- Timestamp:
- Jan 17, 2022 11:44:14 AM (6 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/loading/preload-css-import-layer-expected.txt (added)
-
LayoutTests/http/tests/loading/preload-css-import-layer.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/parser/CSSPreloadScanner.cpp (modified) (5 diffs)
-
Source/WebCore/html/parser/CSSPreloadScanner.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r288096 r288099 1 2022-01-17 Antti Koivisto <antti@apple.com> 2 3 Layered @import rules in <style> should be preloaded 4 https://bugs.webkit.org/show_bug.cgi?id=234094 5 <rdar://problem/86586969> 6 7 Reviewed by Dean Jackson. 8 9 * http/tests/loading/preload-css-import-layer-expected.txt: Added. 10 * http/tests/loading/preload-css-import-layer.html: Added. 11 1 12 2022-01-17 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r288095 r288099 1 2022-01-17 Antti Koivisto <antti@apple.com> 2 3 Layered @import rules in <style> should be preloaded 4 https://bugs.webkit.org/show_bug.cgi?id=234094 5 <rdar://problem/86586969> 6 7 Reviewed by Dean Jackson. 8 9 Test: http/tests/loading/preload-css-import-layer.html 10 11 * html/parser/CSSPreloadScanner.cpp: 12 (WebCore::CSSPreloadScanner::tokenize): 13 (WebCore::hasValidImportConditions): 14 (WebCore::CSSPreloadScanner::emitRule): 15 * html/parser/CSSPreloadScanner.h: 16 17 Allow @import rule containing layer condition to be preloaded. 18 1 19 2022-01-17 Alan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebCore/html/parser/CSSPreloadScanner.cpp
r248846 r288099 99 99 m_rule.clear(); 100 100 m_ruleValue.clear(); 101 m_ruleConditions.clear(); 101 102 m_rule.append(c); 102 103 m_state = Rule; … … 140 141 m_state = DoneParsingImportRules; 141 142 else { 142 // FIXME: media rules143 m_ state = Initial;143 m_state = RuleConditions; 144 m_ruleConditions.append(c); 144 145 } 146 break; 147 case RuleConditions: 148 if (c == ';') 149 emitRule(); 150 else if (c == '{') 151 m_state = DoneParsingImportRules; 152 else 153 m_ruleConditions.append(c); 145 154 break; 146 155 case DoneParsingImportRules: … … 194 203 } 195 204 205 static bool hasValidImportConditions(StringView conditions) 206 { 207 if (conditions.isEmpty()) 208 return true; 209 210 conditions = conditions.stripLeadingAndTrailingMatchedCharacters(isHTMLSpace<UChar>); 211 212 // FIXME: Support multiple conditions. 213 // FIXME: Support media queries. 214 // FIXME: Support supports(). 215 216 auto end = conditions.find(')'); 217 if (end != notFound) 218 return end == conditions.length() - 1 && conditions.startsWith("layer("); 219 220 return conditions == "layer"; 221 } 222 196 223 void CSSPreloadScanner::emitRule() 197 224 { … … 199 226 if (equalLettersIgnoringASCIICase(rule, "import")) { 200 227 String url = parseCSSStringOrURL(m_ruleValue.data(), m_ruleValue.size()); 201 if (!url.isEmpty()) { 228 StringView conditions(m_ruleConditions.data(), m_ruleConditions.size()); 229 if (!url.isEmpty() && hasValidImportConditions(conditions)) { 202 230 URL baseElementURL; // FIXME: This should be passed in from the HTMLPreloadScanner via scan(): without it we will get relative URLs wrong. 203 231 // FIXME: Should this be including the charset in the preload request? … … 211 239 m_rule.clear(); 212 240 m_ruleValue.clear(); 213 } 214 215 } 241 m_ruleConditions.clear(); 242 } 243 244 } -
trunk/Source/WebCore/html/parser/CSSPreloadScanner.h
r208179 r288099 54 54 RuleValue, 55 55 AfterRuleValue, 56 RuleConditions, 56 57 DoneParsingImportRules, 57 58 }; … … 63 64 Vector<UChar> m_rule; 64 65 Vector<UChar> m_ruleValue; 66 Vector<UChar> m_ruleConditions; 65 67 66 68 // Only non-zero during scan()
Note: See TracChangeset
for help on using the changeset viewer.