Title: [251655] trunk
Revision
251655
Author
simon.fra...@apple.com
Date
2019-10-28 09:02:53 -0700 (Mon, 28 Oct 2019)

Log Message

Can't change @font-face descriptors from fontFaceRule.style.setProperty()
https://bugs.webkit.org/show_bug.cgi?id=177975
<rdar://problem/56648761>

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

More passing subtests.

* web-platform-tests/css/css-syntax/urange-parsing-expected.txt:

Source/WebCore:

When parsing properties via PropertySetCSSStyleDeclaration::setProperty() (called from
script as rule.style.setProperty()), CSSPropertyParser::parseValue() needs to know if
we're parsing properties in a @font-face or @viewport rule, since some properties are
only allowed in these contexts.

Achieve this by adding to CSSParserContext an Optional<enclosingRuleType>, which gets set
for font-face and viewport rules. This gets set by StyleRuleCSSStyleDeclaration::cssParserContext()
based on the type of the parent rule.

Moved StyleRule::Type to its own header so CSSParserContext can use it. Added compile-time asserts
that the values match CSSRule::Type (fixing one of them).

Also fix <urange> serialization when start and end values are the same.

Test: web-platform-tests/css/css-syntax/urange-parsing.html

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSKeyframeRule.cpp:
(WebCore::StyleRuleKeyframe::StyleRuleKeyframe):
* css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
* css/CSSPropertySourceData.h:
(WebCore::CSSRuleSourceData::create):
(WebCore::CSSRuleSourceData::createUnknown):
(WebCore::CSSRuleSourceData::CSSRuleSourceData):
* css/CSSRule.cpp:
* css/CSSUnicodeRangeValue.cpp:
(WebCore::CSSUnicodeRangeValue::customCSSText const):
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::StyleRuleCSSStyleDeclaration::cssParserContext const):
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
(WebCore::StyleRule::StyleRule):
(WebCore::StyleRulePage::StyleRulePage):
(WebCore::StyleRuleFontFace::StyleRuleFontFace):
(WebCore::StyleRuleGroup::StyleRuleGroup):
(WebCore::StyleRuleMedia::StyleRuleMedia):
(WebCore::StyleRuleSupports::StyleRuleSupports):
(WebCore::StyleRuleViewport::StyleRuleViewport):
(WebCore::StyleRuleCharset::StyleRuleCharset):
(WebCore::StyleRuleNamespace::StyleRuleNamespace):
* css/StyleRule.h:
(WebCore::StyleRuleBase::type const):
(WebCore::StyleRuleBase::isCharsetRule const):
(WebCore::StyleRuleBase::isFontFaceRule const):
(WebCore::StyleRuleBase::isKeyframesRule const):
(WebCore::StyleRuleBase::isKeyframeRule const):
(WebCore::StyleRuleBase::isNamespaceRule const):
(WebCore::StyleRuleBase::isMediaRule const):
(WebCore::StyleRuleBase::isPageRule const):
(WebCore::StyleRuleBase::isStyleRule const):
(WebCore::StyleRuleBase::isSupportsRule const):
(WebCore::StyleRuleBase::isViewportRule const):
(WebCore::StyleRuleBase::isImportRule const):
(WebCore::StyleRuleBase::StyleRuleBase):
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::StyleRuleImport):
* css/StyleRuleImport.h:
* css/StyleRuleType.h: Copied from Source/WebCore/css/CSSUnicodeRangeValue.cpp.
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseValueWithVariableReferences):
* css/parser/CSSParserContext.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseValue):
(WebCore::CSSParserImpl::parseInlineStyleDeclaration):
(WebCore::CSSParserImpl::parseDeferredDeclaration):
(WebCore::CSSParserImpl::parseDeclarationList):
(WebCore::CSSParserImpl::supportsDeclaration):
(WebCore::CSSParserImpl::parseDeclarationListForInspector):
(WebCore::CSSParserImpl::consumeImportRule):
(WebCore::CSSParserImpl::consumeMediaRule):
(WebCore::CSSParserImpl::consumeSupportsRule):
(WebCore::CSSParserImpl::consumeViewportRule):
(WebCore::CSSParserImpl::consumeFontFaceRule):
(WebCore::CSSParserImpl::consumeKeyframesRule):
(WebCore::CSSParserImpl::consumePageRule):
(WebCore::CSSParserImpl::consumeKeyframeStyleRule):
(WebCore::observeSelectors):
(WebCore::CSSParserImpl::consumeStyleRule):
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
(WebCore::CSSParserImpl::consumeDeclarationValue):
* css/parser/CSSParserImpl.h:
* css/parser/CSSParserObserver.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue):
* css/parser/CSSPropertyParser.h:
* css/parser/CSSTokenizer.cpp:
(WebCore::CSSTokenizer::letterU):
* inspector/InspectorStyleSheet.cpp:
(flattenSourceData):
(WebCore::StyleSheetHandler::startRuleHeader):
(WebCore::InspectorStyleSheetForInlineStyle::ruleSourceData const):

LayoutTests:

Fix tests for the urange serialization fix.

* fast/text/font-face-_javascript_-expected.txt:
* fast/text/font-face-_javascript_.html:
* fast/text/unicode-range-_javascript_-expected.txt:
* fast/text/unicode-range-_javascript_.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (251654 => 251655)


--- trunk/LayoutTests/ChangeLog	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/ChangeLog	2019-10-28 16:02:53 UTC (rev 251655)
@@ -1,3 +1,18 @@
+2019-10-28  Simon Fraser  <simon.fra...@apple.com>
+
+        Can't change @font-face descriptors from fontFaceRule.style.setProperty()
+        https://bugs.webkit.org/show_bug.cgi?id=177975
+        <rdar://problem/56648761>
+
+        Reviewed by Antti Koivisto.
+
+        Fix tests for the urange serialization fix.
+
+        * fast/text/font-face-_javascript_-expected.txt:
+        * fast/text/font-face-_javascript_.html:
+        * fast/text/unicode-range-_javascript_-expected.txt:
+        * fast/text/unicode-range-_javascript_.html:
+
 2019-10-28  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Update WPT tests related to Web Animations and remove imported Mozilla tests

Modified: trunk/LayoutTests/fast/text/font-face-_javascript_-expected.txt (251654 => 251655)


--- trunk/LayoutTests/fast/text/font-face-_javascript_-expected.txt	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/fast/text/font-face-_javascript_-expected.txt	2019-10-28 16:02:53 UTC (rev 251655)
@@ -17,7 +17,7 @@
 PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'lighter'}).weight is "200"
 PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'inherit'}).weight threw exception SyntaxError: The string did not match the expected pattern..
 PASS new FontFace('family_name', 'url(\'asdf\')', {'stretch': 'ultra-expanded'}).stretch is "ultra-expanded"
-PASS new FontFace('family_name', 'url(\'asdf\')', {'unicodeRange': 'U+26'}).unicodeRange is "U+26-26"
+PASS new FontFace('family_name', 'url(\'asdf\')', {'unicodeRange': 'U+26'}).unicodeRange is "U+26"
 PASS new FontFace('family_name', 'url(\'asdf\')', {'unicodeRange': 'U+0-7F'}).unicodeRange is "U+0-7f"
 PASS new FontFace('family_name', 'url(\'asdf\')', {'variant': 'variant_name'}).variant threw exception SyntaxError: The string did not match the expected pattern..
 PASS new FontFace('family_name', 'url(\'asdf\')', {'variant': 'small-caps'}).variant is "small-caps"
@@ -26,7 +26,7 @@
 PASS everything.style is "italic"
 PASS everything.weight is "bold"
 PASS everything.stretch is "extra-expanded"
-PASS everything.unicodeRange is "U+26-26"
+PASS everything.unicodeRange is "U+26"
 PASS everything.variant is "small-caps"
 PASS everything.featureSettings is "\"titl\""
 PASS everything.family is "other_family_name"

Modified: trunk/LayoutTests/fast/text/font-face-_javascript_.html (251654 => 251655)


--- trunk/LayoutTests/fast/text/font-face-_javascript_.html	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/fast/text/font-face-_javascript_.html	2019-10-28 16:02:53 UTC (rev 251655)
@@ -25,7 +25,7 @@
 shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'lighter'}).weight", "200");
 shouldThrow("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'inherit'}).weight");
 shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'stretch': 'ultra-expanded'}).stretch", "ultra-expanded");
-shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'unicodeRange': 'U+26'}).unicodeRange", "U+26-26");
+shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'unicodeRange': 'U+26'}).unicodeRange", "U+26");
 shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'unicodeRange': 'U+0-7F'}).unicodeRange", "U+0-7f");
 shouldThrow("new FontFace('family_name', 'url(\\'asdf\\')', {'variant': 'variant_name'}).variant");
 shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'variant': 'small-caps'}).variant", "small-caps");
@@ -36,7 +36,7 @@
 shouldBeEqualToString("everything.style", "italic");
 shouldBeEqualToString("everything.weight", "bold");
 shouldBeEqualToString("everything.stretch", "extra-expanded");
-shouldBeEqualToString("everything.unicodeRange", "U+26-26");
+shouldBeEqualToString("everything.unicodeRange", "U+26");
 shouldBeEqualToString("everything.variant", "small-caps");
 shouldBeEqualToString("everything.featureSettings", "\"titl\"");
 

Modified: trunk/LayoutTests/fast/text/unicode-range-_javascript_-expected.txt (251654 => 251655)


--- trunk/LayoutTests/fast/text/unicode-range-_javascript_-expected.txt	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/fast/text/unicode-range-_javascript_-expected.txt	2019-10-28 16:02:53 UTC (rev 251655)
@@ -4,11 +4,11 @@
 
 
 PASS faces.length is 1
-PASS faces[0].unicodeRange is "U+41-41"
+PASS faces[0].unicodeRange is "U+41"
 PASS document.fonts.check('14px WebFont', 'A') is true
 PASS faces.length is 1
 PASS faces[0].family is "WebFont"
-PASS faces[0].unicodeRange is "U+41-41"
+PASS faces[0].unicodeRange is "U+41"
 PASS document.fonts.check('14px WebFont3', 'A') is false
 PASS document.fonts.check('14px WebFont3', 'A') is true
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/text/unicode-range-_javascript_.html (251654 => 251655)


--- trunk/LayoutTests/fast/text/unicode-range-_javascript_.html	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/fast/text/unicode-range-_javascript_.html	2019-10-28 16:02:53 UTC (rev 251655)
@@ -53,7 +53,7 @@
 document.fonts.load("14px WebFont", "A").then(function(facesArgument) {
     faces = facesArgument;
     shouldBe("faces.length", "1");
-    shouldBeEqualToString("faces[0].unicodeRange", "U+41-41");
+    shouldBeEqualToString("faces[0].unicodeRange", "U+41");
     shouldBeTrue("document.fonts.check('14px WebFont', 'A')");
     return document.fonts.load("14px WebFont, WebFont2", "A");
 }, failure).then(function(facesArgument) {
@@ -60,10 +60,10 @@
     faces = facesArgument;
     shouldBe("faces.length", "1");
     shouldBeEqualToString("faces[0].family", "WebFont");
-    shouldBeEqualToString("faces[0].unicodeRange", "U+41-41");
+    shouldBeEqualToString("faces[0].unicodeRange", "U+41");
     shouldBeFalse("document.fonts.check('14px WebFont3', 'A')");
     for (let f of document.fonts) {
-        if (f.family == "WebFont3" && f.unicodeRange == "U+41-41")
+        if (f.family == "WebFont3" && f.unicodeRange == "U+41")
             return f.load();
     }
     testFailed("Should find font.");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (251654 => 251655)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-28 16:02:53 UTC (rev 251655)
@@ -1,3 +1,15 @@
+2019-10-28  Simon Fraser  <simon.fra...@apple.com>
+
+        Can't change @font-face descriptors from fontFaceRule.style.setProperty()
+        https://bugs.webkit.org/show_bug.cgi?id=177975
+        <rdar://problem/56648761>
+
+        Reviewed by Antti Koivisto.
+
+        More passing subtests.
+
+        * web-platform-tests/css/css-syntax/urange-parsing-expected.txt:
+
 2019-10-27  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] getKeyframes() doesn't return the right timing function for declarative animations

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/urange-parsing-expected.txt (251654 => 251655)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/urange-parsing-expected.txt	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/urange-parsing-expected.txt	2019-10-28 16:02:53 UTC (rev 251655)
@@ -1,94 +1,94 @@
 
-FAIL "u/**/+/**/a/**/?" => "U+A0-AF" assert_equals: expected "U+A0-AF" but got ""
-FAIL "u+abc" => "U+ABC" assert_equals: expected "U+ABC" but got ""
-FAIL "U+abc" => "U+ABC" assert_equals: expected "U+ABC" but got ""
-FAIL "u+ABC" => "U+ABC" assert_equals: expected "U+ABC" but got ""
-FAIL "U+ABC" => "U+ABC" assert_equals: expected "U+ABC" but got ""
-FAIL "u+AbC" => "U+ABC" assert_equals: expected "U+ABC" but got ""
-FAIL "u+efg" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+ abc" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u +abc" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u + abc" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "U + a b c" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+a" => "U+A" assert_equals: expected "U+A" but got ""
-FAIL "u+aa" => "U+AA" assert_equals: expected "U+AA" but got ""
-FAIL "u+aaa" => "U+AAA" assert_equals: expected "U+AAA" but got ""
-FAIL "u+aaaa" => "U+AAAA" assert_equals: expected "U+AAAA" but got ""
-FAIL "u+aaaaa" => "U+AAAAA" assert_equals: expected "U+AAAAA" but got ""
-FAIL "u+aaaaaaa" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+a?" => "U+A0-AF" assert_equals: expected "U+A0-AF" but got ""
-FAIL "u+a??" => "U+A00-AFF" assert_equals: expected "U+A00-AFF" but got ""
-FAIL "u+a???" => "U+A000-AFFF" assert_equals: expected "U+A000-AFFF" but got ""
-FAIL "u+a????" => "U+A0000-AFFFF" assert_equals: expected "U+A0000-AFFFF" but got ""
-FAIL "u+aaaaaa?" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+aaaaa??" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+aaaa???" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+aaa????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+aa?????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+a??????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+a?a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+aaaaaa" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+a?????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u/**/+0a/**/?" => "U+A0-AF" assert_equals: expected "U+A0-AF" but got ""
-FAIL "u+0a" => "U+A" assert_equals: expected "U+A" but got ""
-FAIL "U+0a0" => "U+A0" assert_equals: expected "U+A0" but got ""
-FAIL "u+0aaaaa" => "U+AAAAA" assert_equals: expected "U+AAAAA" but got ""
-FAIL "u+0aaaaaa" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0a0000" => "U+A0000" assert_equals: expected "U+A0000" but got ""
-FAIL "u+0a00000" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0aaaaa0" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+00000a" => "U+A" assert_equals: expected "U+A" but got ""
-FAIL "u+00000aa" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+00000a0" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+000000a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0a????" => "U+A0000-AFFFF" assert_equals: expected "U+A0000-AFFFF" but got ""
-FAIL "u+0a?????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+00a????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+22222a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+1e9a" => "U+1E9A" assert_equals: expected "U+1E9A" but got ""
-FAIL "u/**/+0/**/?" => "U+0-F" assert_equals: expected "U+0-F" but got ""
-FAIL "u/**/0" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0" => "U+0" assert_equals: expected "U+0" but got ""
-FAIL "u+00" => "U+0" assert_equals: expected "U+0" but got ""
-FAIL "u+000" => "U+0" assert_equals: expected "U+0" but got ""
-FAIL "u+0000" => "U+0" assert_equals: expected "U+0" but got ""
-FAIL "u+00000" => "U+0" assert_equals: expected "U+0" but got ""
-FAIL "u+000000" => "U+0" assert_equals: expected "U+0" but got ""
-FAIL "u+0000000" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+00000?" => "U+0-F" assert_equals: expected "U+0-F" but got ""
-FAIL "u+0?????" => "U+0-FFFFF" assert_equals: expected "U+0-FFFFF" but got ""
-FAIL "u+0?a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+000000?" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+00000??" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0??????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+1e3" => "U+1E3" assert_equals: expected "U+1E3" but got ""
-FAIL "u+1e-20" => "U+1E-20" assert_equals: expected "U+1E-20" but got ""
-FAIL "u+222222" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+2?????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u/**/+0/**/-0a" => "U+0-A" assert_equals: expected "U+0-A" but got ""
-FAIL "u+0-0a" => "U+0-A" assert_equals: expected "U+0-A" but got ""
-FAIL "u+000000-0aaaaa" => "U+0-AAAAA" assert_equals: expected "U+0-AAAAA" but got ""
-FAIL "u+0000000-0a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0-0aaaaaa" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0-000000a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0+0a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0?-0a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0-0a?" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+222222-22222a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u/**/+0/**/-1" => "U+0-1" assert_equals: expected "U+0-1" but got ""
-FAIL "u+0-1" => "U+0-1" assert_equals: expected "U+0-1" but got ""
-FAIL "u-0-1" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u-0+1" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0+1" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+000000-000001" => "U+0-1" assert_equals: expected "U+0-1" but got ""
-FAIL "u+0000000-1" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0-0000001" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+0-222222" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u/**/+/**/?" => "U+0-F" assert_equals: expected "U+0-F" but got ""
-FAIL "u+?" => "U+0-F" assert_equals: expected "U+0-F" but got ""
-FAIL "u+?????" => "u+0-FFFFF" assert_equals: expected "U+0-FFFFF" but got ""
-FAIL "u+???????" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+?a" is invalid assert_equals: expected "U+1357" but got ""
-FAIL "u+??????" is invalid assert_equals: expected "U+1357" but got ""
+FAIL "u/**/+/**/a/**/?" => "U+A0-AF" assert_equals: expected "U+A0-AF" but got "U+1357"
+PASS "u+abc" => "U+ABC" 
+PASS "U+abc" => "U+ABC" 
+PASS "u+ABC" => "U+ABC" 
+PASS "U+ABC" => "U+ABC" 
+PASS "u+AbC" => "U+ABC" 
+PASS "u+efg" is invalid 
+PASS "u+ abc" is invalid 
+PASS "u +abc" is invalid 
+PASS "u + abc" is invalid 
+PASS "U + a b c" is invalid 
+PASS "u+a" => "U+A" 
+PASS "u+aa" => "U+AA" 
+PASS "u+aaa" => "U+AAA" 
+PASS "u+aaaa" => "U+AAAA" 
+PASS "u+aaaaa" => "U+AAAAA" 
+PASS "u+aaaaaaa" is invalid 
+PASS "u+a?" => "U+A0-AF" 
+PASS "u+a??" => "U+A00-AFF" 
+PASS "u+a???" => "U+A000-AFFF" 
+PASS "u+a????" => "U+A0000-AFFFF" 
+PASS "u+aaaaaa?" is invalid 
+PASS "u+aaaaa??" is invalid 
+PASS "u+aaaa???" is invalid 
+PASS "u+aaa????" is invalid 
+PASS "u+aa?????" is invalid 
+PASS "u+a??????" is invalid 
+PASS "u+a?a" is invalid 
+FAIL "u+aaaaaa" is invalid assert_equals: expected "U+1357" but got "U+AAAAAA"
+FAIL "u+a?????" is invalid assert_equals: expected "U+1357" but got "U+A00000-AFFFFF"
+FAIL "u/**/+0a/**/?" => "U+A0-AF" assert_equals: expected "U+A0-AF" but got "U+1357"
+PASS "u+0a" => "U+A" 
+PASS "U+0a0" => "U+A0" 
+PASS "u+0aaaaa" => "U+AAAAA" 
+PASS "u+0aaaaaa" is invalid 
+PASS "u+0a0000" => "U+A0000" 
+PASS "u+0a00000" is invalid 
+PASS "u+0aaaaa0" is invalid 
+PASS "u+00000a" => "U+A" 
+PASS "u+00000aa" is invalid 
+PASS "u+00000a0" is invalid 
+PASS "u+000000a" is invalid 
+PASS "u+0a????" => "U+A0000-AFFFF" 
+PASS "u+0a?????" is invalid 
+PASS "u+00a????" is invalid 
+FAIL "u+22222a" is invalid assert_equals: expected "U+1357" but got "U+22222A"
+PASS "u+1e9a" => "U+1E9A" 
+FAIL "u/**/+0/**/?" => "U+0-F" assert_equals: expected "U+0-F" but got "U+1357"
+PASS "u/**/0" is invalid 
+PASS "u+0" => "U+0" 
+PASS "u+00" => "U+0" 
+PASS "u+000" => "U+0" 
+PASS "u+0000" => "U+0" 
+PASS "u+00000" => "U+0" 
+PASS "u+000000" => "U+0" 
+PASS "u+0000000" is invalid 
+PASS "u+00000?" => "U+0-F" 
+PASS "u+0?????" => "U+0-FFFFF" 
+PASS "u+0?a" is invalid 
+PASS "u+000000?" is invalid 
+PASS "u+00000??" is invalid 
+PASS "u+0??????" is invalid 
+PASS "u+1e3" => "U+1E3" 
+PASS "u+1e-20" => "U+1E-20" 
+FAIL "u+222222" is invalid assert_equals: expected "U+1357" but got "U+222222"
+FAIL "u+2?????" is invalid assert_equals: expected "U+1357" but got "U+200000-2FFFFF"
+FAIL "u/**/+0/**/-0a" => "U+0-A" assert_equals: expected "U+0-A" but got "U+1357"
+PASS "u+0-0a" => "U+0-A" 
+PASS "u+000000-0aaaaa" => "U+0-AAAAA" 
+PASS "u+0000000-0a" is invalid 
+PASS "u+0-0aaaaaa" is invalid 
+PASS "u+0-000000a" is invalid 
+PASS "u+0+0a" is invalid 
+PASS "u+0?-0a" is invalid 
+PASS "u+0-0a?" is invalid 
+FAIL "u+222222-22222a" is invalid assert_equals: expected "U+1357" but got "U+222222-22222A"
+FAIL "u/**/+0/**/-1" => "U+0-1" assert_equals: expected "U+0-1" but got "U+1357"
+PASS "u+0-1" => "U+0-1" 
+PASS "u-0-1" is invalid 
+PASS "u-0+1" is invalid 
+PASS "u+0+1" is invalid 
+PASS "u+000000-000001" => "U+0-1" 
+PASS "u+0000000-1" is invalid 
+PASS "u+0-0000001" is invalid 
+FAIL "u+0-222222" is invalid assert_equals: expected "U+1357" but got "U+0-222222"
+FAIL "u/**/+/**/?" => "U+0-F" assert_equals: expected "U+0-F" but got "U+1357"
+PASS "u+?" => "U+0-F" 
+PASS "u+?????" => "u+0-FFFFF" 
+PASS "u+???????" is invalid 
+PASS "u+?a" is invalid 
+FAIL "u+??????" is invalid assert_equals: expected "U+1357" but got "U+0-FFFFFF"
 FAIL u+a is a valid selector assert_equals: expected "u + a" but got ".error"
 

Modified: trunk/Source/WebCore/ChangeLog (251654 => 251655)


--- trunk/Source/WebCore/ChangeLog	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/ChangeLog	2019-10-28 16:02:53 UTC (rev 251655)
@@ -1,3 +1,111 @@
+2019-10-28  Simon Fraser  <simon.fra...@apple.com>
+
+        Can't change @font-face descriptors from fontFaceRule.style.setProperty()
+        https://bugs.webkit.org/show_bug.cgi?id=177975
+        <rdar://problem/56648761>
+
+        Reviewed by Antti Koivisto.
+
+        When parsing properties via PropertySetCSSStyleDeclaration::setProperty() (called from
+        script as rule.style.setProperty()), CSSPropertyParser::parseValue() needs to know if
+        we're parsing properties in a @font-face or @viewport rule, since some properties are
+        only allowed in these contexts.
+
+        Achieve this by adding to CSSParserContext an Optional<enclosingRuleType>, which gets set
+        for font-face and viewport rules. This gets set by StyleRuleCSSStyleDeclaration::cssParserContext()
+        based on the type of the parent rule.
+
+        Moved StyleRule::Type to its own header so CSSParserContext can use it. Added compile-time asserts
+        that the values match CSSRule::Type (fixing one of them).
+
+        Also fix <urange> serialization when start and end values are the same.
+
+        Test: web-platform-tests/css/css-syntax/urange-parsing.html
+
+        * Headers.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSKeyframeRule.cpp:
+        (WebCore::StyleRuleKeyframe::StyleRuleKeyframe):
+        * css/CSSKeyframesRule.cpp:
+        (WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
+        * css/CSSPropertySourceData.h:
+        (WebCore::CSSRuleSourceData::create):
+        (WebCore::CSSRuleSourceData::createUnknown):
+        (WebCore::CSSRuleSourceData::CSSRuleSourceData):
+        * css/CSSRule.cpp:
+        * css/CSSUnicodeRangeValue.cpp:
+        (WebCore::CSSUnicodeRangeValue::customCSSText const):
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        (WebCore::StyleRuleCSSStyleDeclaration::cssParserContext const):
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBase::destroy):
+        (WebCore::StyleRuleBase::copy const):
+        (WebCore::StyleRuleBase::createCSSOMWrapper const):
+        (WebCore::StyleRule::StyleRule):
+        (WebCore::StyleRulePage::StyleRulePage):
+        (WebCore::StyleRuleFontFace::StyleRuleFontFace):
+        (WebCore::StyleRuleGroup::StyleRuleGroup):
+        (WebCore::StyleRuleMedia::StyleRuleMedia):
+        (WebCore::StyleRuleSupports::StyleRuleSupports):
+        (WebCore::StyleRuleViewport::StyleRuleViewport):
+        (WebCore::StyleRuleCharset::StyleRuleCharset):
+        (WebCore::StyleRuleNamespace::StyleRuleNamespace):
+        * css/StyleRule.h:
+        (WebCore::StyleRuleBase::type const):
+        (WebCore::StyleRuleBase::isCharsetRule const):
+        (WebCore::StyleRuleBase::isFontFaceRule const):
+        (WebCore::StyleRuleBase::isKeyframesRule const):
+        (WebCore::StyleRuleBase::isKeyframeRule const):
+        (WebCore::StyleRuleBase::isNamespaceRule const):
+        (WebCore::StyleRuleBase::isMediaRule const):
+        (WebCore::StyleRuleBase::isPageRule const):
+        (WebCore::StyleRuleBase::isStyleRule const):
+        (WebCore::StyleRuleBase::isSupportsRule const):
+        (WebCore::StyleRuleBase::isViewportRule const):
+        (WebCore::StyleRuleBase::isImportRule const):
+        (WebCore::StyleRuleBase::StyleRuleBase):
+        * css/StyleRuleImport.cpp:
+        (WebCore::StyleRuleImport::StyleRuleImport):
+        * css/StyleRuleImport.h:
+        * css/StyleRuleType.h: Copied from Source/WebCore/css/CSSUnicodeRangeValue.cpp.
+        * css/StyleSheetContents.cpp:
+        (WebCore::traverseRulesInVector):
+        (WebCore::StyleSheetContents::traverseSubresources const):
+        * css/parser/CSSParser.cpp:
+        (WebCore::CSSParser::parseValueWithVariableReferences):
+        * css/parser/CSSParserContext.h:
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::parseValue):
+        (WebCore::CSSParserImpl::parseInlineStyleDeclaration):
+        (WebCore::CSSParserImpl::parseDeferredDeclaration):
+        (WebCore::CSSParserImpl::parseDeclarationList):
+        (WebCore::CSSParserImpl::supportsDeclaration):
+        (WebCore::CSSParserImpl::parseDeclarationListForInspector):
+        (WebCore::CSSParserImpl::consumeImportRule):
+        (WebCore::CSSParserImpl::consumeMediaRule):
+        (WebCore::CSSParserImpl::consumeSupportsRule):
+        (WebCore::CSSParserImpl::consumeViewportRule):
+        (WebCore::CSSParserImpl::consumeFontFaceRule):
+        (WebCore::CSSParserImpl::consumeKeyframesRule):
+        (WebCore::CSSParserImpl::consumePageRule):
+        (WebCore::CSSParserImpl::consumeKeyframeStyleRule):
+        (WebCore::observeSelectors):
+        (WebCore::CSSParserImpl::consumeStyleRule):
+        (WebCore::CSSParserImpl::consumeDeclarationList):
+        (WebCore::CSSParserImpl::consumeDeclaration):
+        (WebCore::CSSParserImpl::consumeDeclarationValue):
+        * css/parser/CSSParserImpl.h:
+        * css/parser/CSSParserObserver.h:
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::parseValue):
+        * css/parser/CSSPropertyParser.h:
+        * css/parser/CSSTokenizer.cpp:
+        (WebCore::CSSTokenizer::letterU):
+        * inspector/InspectorStyleSheet.cpp:
+        (flattenSourceData):
+        (WebCore::StyleSheetHandler::startRuleHeader):
+        (WebCore::InspectorStyleSheetForInlineStyle::ruleSourceData const):
+
 2019-10-28  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r251651.

Modified: trunk/Source/WebCore/Headers.cmake (251654 => 251655)


--- trunk/Source/WebCore/Headers.cmake	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/Headers.cmake	2019-10-28 16:02:53 UTC (rev 251655)
@@ -335,6 +335,7 @@
     css/Rect.h
     css/StyleColor.h
     css/StyleProperties.h
+    css/StyleRuleType.h
     css/StyleSheet.h
     css/StyleSheetContents.h
     css/StyleSheetList.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (251654 => 251655)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-10-28 16:02:53 UTC (rev 251655)
@@ -331,6 +331,7 @@
 		0F94B6492208FE3B00157014 /* ScrollingTreeStickyNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B6432208F70200157014 /* ScrollingTreeStickyNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F94B6522209150600157014 /* ScrollingStatePositionedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B651220914FF00157014 /* ScrollingStatePositionedNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F94B655220931E400157014 /* ScrollingTreePositionedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B6532209156C00157014 /* ScrollingTreePositionedNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F94F37E23661626003AA5C7 /* StyleRuleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94F37C23661131003AA5C7 /* StyleRuleType.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F9DAA0F1FD1C66A0079C5B2 /* DOMGCOutputConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9DAA0E1FD1C6640079C5B2 /* DOMGCOutputConstraint.h */; };
 		0FA24D7A162DF91900A3F4C0 /* GraphicsLayerUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FA24D78162DF91900A3F4C0 /* GraphicsLayerUpdater.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FB6252F18DE1B1500A07C05 /* GeometryUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB6252D18DE1B1500A07C05 /* GeometryUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5737,6 +5738,7 @@
 		0F94B651220914FF00157014 /* ScrollingStatePositionedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingStatePositionedNode.h; sourceTree = "<group>"; };
 		0F94B6532209156C00157014 /* ScrollingTreePositionedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingTreePositionedNode.h; sourceTree = "<group>"; };
 		0F94B6542209156C00157014 /* ScrollingTreePositionedNode.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreePositionedNode.mm; sourceTree = "<group>"; };
+		0F94F37C23661131003AA5C7 /* StyleRuleType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleRuleType.h; sourceTree = "<group>"; };
 		0F97A657155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayRefreshMonitorIOS.mm; sourceTree = "<group>"; };
 		0F9B547522B4A772007B5E8A /* ScrollingStateOverflowScrollProxyNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingStateOverflowScrollProxyNode.h; sourceTree = "<group>"; };
 		0F9B547622B4A773007B5E8A /* ScrollingStateOverflowScrollProxyNode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingStateOverflowScrollProxyNode.cpp; sourceTree = "<group>"; };
@@ -9135,8 +9137,6 @@
 		65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
 		697101071C6BE1550018C7F1 /* AccessibilitySVGElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilitySVGElement.cpp; sourceTree = "<group>"; };
 		697101081C6BE1550018C7F1 /* AccessibilitySVGElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySVGElement.h; sourceTree = "<group>"; };
-		AAD9D0B121DFA80C001B11C7 /* LazyLoadImageObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadImageObserver.cpp; sourceTree = "<group>"; };
-		AAD9D0B321DFA80E001B11C7 /* LazyLoadImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyLoadImageObserver.h; sourceTree = "<group>"; };
 		6A22E86F1F10418600F546C3 /* InspectorCanvas.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InspectorCanvas.h; sourceTree = "<group>"; };
 		6A22E8721F1042C400F546C3 /* InspectorCanvas.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCanvas.cpp; sourceTree = "<group>"; };
 		6A7279881F16C29B003F39B8 /* InspectorShaderProgram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorShaderProgram.h; sourceTree = "<group>"; };
@@ -12136,6 +12136,8 @@
 		AACC83D62316569E00EB6BF5 /* HTMLOrForeignElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLOrForeignElement.idl; sourceTree = "<group>"; };
 		AACC83D72316576A00EB6BF5 /* JSHTMLOrForeignElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSHTMLOrForeignElement.h; sourceTree = "<group>"; };
 		AACC83D82316576B00EB6BF5 /* JSHTMLOrForeignElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOrForeignElement.cpp; sourceTree = "<group>"; };
+		AAD9D0B121DFA80C001B11C7 /* LazyLoadImageObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadImageObserver.cpp; sourceTree = "<group>"; };
+		AAD9D0B321DFA80E001B11C7 /* LazyLoadImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyLoadImageObserver.h; sourceTree = "<group>"; };
 		AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizerMock.cpp; sourceTree = "<group>"; };
 		AAE27B7516CBFC0D00623043 /* PlatformSpeechSynthesizerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizerMock.h; sourceTree = "<group>"; };
 		AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerIOS.mm; sourceTree = "<group>"; };
@@ -27330,6 +27332,7 @@
 				E4BBED4B14FCDBA1003F0B98 /* StyleRule.h */,
 				E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */,
 				E4946EAD156E64DD00D3297F /* StyleRuleImport.h */,
+				0F94F37C23661131003AA5C7 /* StyleRuleType.h */,
 				A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */,
 				A8EA80040A19516E00A8EF5F /* StyleSheet.h */,
 				850656DC0AAB44D9002D15C0 /* StyleSheet.idl */,
@@ -32116,6 +32119,7 @@
 				E139866415478474001E3F65 /* StyleResolver.h in Headers */,
 				E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */,
 				E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */,
+				0F94F37E23661626003AA5C7 /* StyleRuleType.h in Headers */,
 				E461D65F1BB0C80D00CB5645 /* StyleScope.h in Headers */,
 				F47A5E3E195B8C8A00483100 /* StyleScrollSnapPoints.h in Headers */,
 				9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSKeyframeRule.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/CSSKeyframeRule.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/CSSKeyframeRule.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -35,13 +35,13 @@
 namespace WebCore {
 
 StyleRuleKeyframe::StyleRuleKeyframe(Ref<StyleProperties>&& properties)
-    : StyleRuleBase(Keyframe)
+    : StyleRuleBase(StyleRuleType::Keyframe)
     , m_properties(WTFMove(properties))
 {
 }
 
 StyleRuleKeyframe::StyleRuleKeyframe(std::unique_ptr<Vector<double>> keys, Ref<StyleProperties>&& properties)
-    : StyleRuleBase(Keyframe)
+    : StyleRuleBase(StyleRuleType::Keyframe)
     , m_properties(WTFMove(properties))
     , m_keys(*keys)
 {

Modified: trunk/Source/WebCore/css/CSSKeyframesRule.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/CSSKeyframesRule.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -37,13 +37,13 @@
 namespace WebCore {
 
 StyleRuleKeyframes::StyleRuleKeyframes(const AtomString& name)
-    : StyleRuleBase(Keyframes)
+    : StyleRuleBase(StyleRuleType::Keyframes)
     , m_name(name)
 {
 }
 
 StyleRuleKeyframes::StyleRuleKeyframes(const AtomString& name, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
-    : StyleRuleBase(Keyframes)
+    : StyleRuleBase(StyleRuleType::Keyframes)
     , m_name(name)
     , m_deferredRules(WTFMove(deferredRules))
 {

Modified: trunk/Source/WebCore/css/CSSPropertySourceData.h (251654 => 251655)


--- trunk/Source/WebCore/css/CSSPropertySourceData.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/CSSPropertySourceData.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -80,7 +80,7 @@
 typedef Vector<SourceRange> SelectorRangeList;
 
 struct CSSRuleSourceData : public RefCounted<CSSRuleSourceData> {
-    static Ref<CSSRuleSourceData> create(StyleRule::Type type)
+    static Ref<CSSRuleSourceData> create(StyleRuleType type)
     {
         return adoptRef(*new CSSRuleSourceData(type));
     }
@@ -87,17 +87,17 @@
 
     static Ref<CSSRuleSourceData> createUnknown()
     {
-        return adoptRef(*new CSSRuleSourceData(StyleRule::Unknown));
+        return adoptRef(*new CSSRuleSourceData(StyleRuleType::Unknown));
     }
 
-    CSSRuleSourceData(StyleRule::Type type)
+    CSSRuleSourceData(StyleRuleType type)
         : type(type)
     {
-        if (type == StyleRule::Style || type == StyleRule::FontFace || type == StyleRule::Page)
+        if (type == StyleRuleType::Style || type == StyleRuleType::FontFace || type == StyleRuleType::Page)
             styleSourceData = CSSStyleSourceData::create();
     }
 
-    StyleRule::Type type;
+    StyleRuleType type;
 
     // Range of the selector list in the enclosing source.
     SourceRange ruleHeaderRange;

Modified: trunk/Source/WebCore/css/CSSRule.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/CSSRule.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/CSSRule.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -36,8 +36,19 @@
 
 COMPILE_ASSERT(sizeof(CSSRule) == sizeof(SameSizeAsCSSRule), CSSRule_should_stay_small);
 
+COMPILE_ASSERT(StyleRuleType::Unknown == static_cast<StyleRuleType>(CSSRule::Type::UNKNOWN_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Style == static_cast<StyleRuleType>(CSSRule::Type::STYLE_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Charset == static_cast<StyleRuleType>(CSSRule::Type::CHARSET_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Import == static_cast<StyleRuleType>(CSSRule::Type::IMPORT_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Media == static_cast<StyleRuleType>(CSSRule::Type::MEDIA_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::FontFace == static_cast<StyleRuleType>(CSSRule::Type::FONT_FACE_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Page == static_cast<StyleRuleType>(CSSRule::Type::PAGE_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Keyframes == static_cast<StyleRuleType>(CSSRule::Type::KEYFRAMES_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Keyframe == static_cast<StyleRuleType>(CSSRule::Type::KEYFRAME_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Namespace == static_cast<StyleRuleType>(CSSRule::Type::NAMESPACE_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleType::Supports == static_cast<StyleRuleType>(CSSRule::Type::SUPPORTS_RULE), enums_should_match);
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-COMPILE_ASSERT(StyleRuleBase::Viewport == static_cast<StyleRuleBase::Type>(CSSRule::WEBKIT_VIEWPORT_RULE), enums_should_match);
+COMPILE_ASSERT(StyleRuleBase::Viewport == static_cast<StyleRuleType>(CSSRule::WEBKIT_VIEWPORT_RULE), enums_should_match);
 #endif
 
 ExceptionOr<void> CSSRule::setCssText(const String&)

Modified: trunk/Source/WebCore/css/CSSUnicodeRangeValue.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/CSSUnicodeRangeValue.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/CSSUnicodeRangeValue.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -32,6 +32,9 @@
 
 String CSSUnicodeRangeValue::customCSSText() const
 {
+    if (m_from == m_to)
+        return makeString("U+", hex(m_from, Lowercase));
+
     return makeString("U+", hex(m_from, Lowercase), '-', hex(m_to, Lowercase));
 }
 

Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -412,7 +412,11 @@
     if (!styleSheet)
         return PropertySetCSSStyleDeclaration::cssParserContext();
 
-    return styleSheet->parserContext();
+    auto context = styleSheet->parserContext();
+    if (m_parentRule)
+        context.enclosingRuleType = static_cast<StyleRuleType>(m_parentRule->type());
+    
+    return context;
 }
 
 void StyleRuleCSSStyleDeclaration::reattach(MutableStyleProperties& propertySet)

Modified: trunk/Source/WebCore/css/StyleRule.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/StyleRule.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -58,42 +58,42 @@
 void StyleRuleBase::destroy()
 {
     switch (type()) {
-    case Style:
+    case StyleRuleType::Style:
         delete downcast<StyleRule>(this);
         return;
-    case Page:
+    case StyleRuleType::Page:
         delete downcast<StyleRulePage>(this);
         return;
-    case FontFace:
+    case StyleRuleType::FontFace:
         delete downcast<StyleRuleFontFace>(this);
         return;
-    case Media:
+    case StyleRuleType::Media:
         delete downcast<StyleRuleMedia>(this);
         return;
-    case Supports:
+    case StyleRuleType::Supports:
         delete downcast<StyleRuleSupports>(this);
         return;
-    case Import:
+    case StyleRuleType::Import:
         delete downcast<StyleRuleImport>(this);
         return;
-    case Keyframes:
+    case StyleRuleType::Keyframes:
         delete downcast<StyleRuleKeyframes>(this);
         return;
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-    case Viewport:
+    case StyleRuleType::Viewport:
         delete downcast<StyleRuleViewport>(this);
         return;
 #endif
-    case Namespace:
+    case StyleRuleType::Namespace:
         delete downcast<StyleRuleNamespace>(this);
         return;
-    case Keyframe:
+    case StyleRuleType::Keyframe:
         delete downcast<StyleRuleKeyframe>(this);
         return;
-    case Charset:
+    case StyleRuleType::Charset:
         delete downcast<StyleRuleCharset>(this);
         return;
-    case Unknown:
+    case StyleRuleType::Unknown:
         ASSERT_NOT_REACHED();
         return;
     }
@@ -103,29 +103,29 @@
 Ref<StyleRuleBase> StyleRuleBase::copy() const
 {
     switch (type()) {
-    case Style:
+    case StyleRuleType::Style:
         return downcast<StyleRule>(*this).copy();
-    case Page:
+    case StyleRuleType::Page:
         return downcast<StyleRulePage>(*this).copy();
-    case FontFace:
+    case StyleRuleType::FontFace:
         return downcast<StyleRuleFontFace>(*this).copy();
-    case Media:
+    case StyleRuleType::Media:
         return downcast<StyleRuleMedia>(*this).copy();
-    case Supports:
+    case StyleRuleType::Supports:
         return downcast<StyleRuleSupports>(*this).copy();
-    case Keyframes:
+    case StyleRuleType::Keyframes:
         return downcast<StyleRuleKeyframes>(*this).copy();
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-    case Viewport:
+    case StyleRuleType::Viewport:
         return downcast<StyleRuleViewport>(*this).copy();
 #endif
-    case Import:
-    case Namespace:
+    case StyleRuleType::Import:
+    case StyleRuleType::Namespace:
         // FIXME: Copy import and namespace rules.
         break;
-    case Unknown:
-    case Charset:
-    case Keyframe:
+    case StyleRuleType::Unknown:
+    case StyleRuleType::Charset:
+    case StyleRuleType::Keyframe:
         break;
     }
     CRASH();
@@ -136,38 +136,38 @@
     RefPtr<CSSRule> rule;
     StyleRuleBase& self = const_cast<StyleRuleBase&>(*this);
     switch (type()) {
-    case Style:
+    case StyleRuleType::Style:
         rule = CSSStyleRule::create(downcast<StyleRule>(self), parentSheet);
         break;
-    case Page:
+    case StyleRuleType::Page:
         rule = CSSPageRule::create(downcast<StyleRulePage>(self), parentSheet);
         break;
-    case FontFace:
+    case StyleRuleType::FontFace:
         rule = CSSFontFaceRule::create(downcast<StyleRuleFontFace>(self), parentSheet);
         break;
-    case Media:
+    case StyleRuleType::Media:
         rule = CSSMediaRule::create(downcast<StyleRuleMedia>(self), parentSheet);
         break;
-    case Supports:
+    case StyleRuleType::Supports:
         rule = CSSSupportsRule::create(downcast<StyleRuleSupports>(self), parentSheet);
         break;
-    case Import:
+    case StyleRuleType::Import:
         rule = CSSImportRule::create(downcast<StyleRuleImport>(self), parentSheet);
         break;
-    case Keyframes:
+    case StyleRuleType::Keyframes:
         rule = CSSKeyframesRule::create(downcast<StyleRuleKeyframes>(self), parentSheet);
         break;
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-    case Viewport:
+    case StyleRuleType::Viewport:
         rule = WebKitCSSViewportRule::create(downcast<StyleRuleViewport>(self), parentSheet);
         break;
 #endif
-    case Namespace:
+    case StyleRuleType::Namespace:
         rule = CSSNamespaceRule::create(downcast<StyleRuleNamespace>(self), parentSheet);
         break;
-    case Unknown:
-    case Charset:
-    case Keyframe:
+    case StyleRuleType::Unknown:
+    case StyleRuleType::Charset:
+    case StyleRuleType::Keyframe:
         ASSERT_NOT_REACHED();
         break;
     }
@@ -184,7 +184,7 @@
 }
 
 StyleRule::StyleRule(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
-    : StyleRuleBase(Style, hasDocumentSecurityOrigin)
+    : StyleRuleBase(StyleRuleType::Style, hasDocumentSecurityOrigin)
     , m_properties(WTFMove(properties))
     , m_selectorList(WTFMove(selectors))
 {
@@ -250,7 +250,7 @@
 }
 
 StyleRulePage::StyleRulePage(Ref<StyleProperties>&& properties, CSSSelectorList&& selectors)
-    : StyleRuleBase(Page)
+    : StyleRuleBase(StyleRuleType::Page)
     , m_properties(WTFMove(properties))
     , m_selectorList(WTFMove(selectors))
 {
@@ -273,7 +273,7 @@
 }
 
 StyleRuleFontFace::StyleRuleFontFace(Ref<StyleProperties>&& properties)
-    : StyleRuleBase(FontFace)
+    : StyleRuleBase(StyleRuleType::FontFace)
     , m_properties(WTFMove(properties))
 {
 }
@@ -311,13 +311,13 @@
     m_parser->parseKeyframeList(m_tokens, keyframesRule);
 }
     
-StyleRuleGroup::StyleRuleGroup(Type type, Vector<RefPtr<StyleRuleBase>>& adoptRule)
+StyleRuleGroup::StyleRuleGroup(StyleRuleType type, Vector<RefPtr<StyleRuleBase>>& adoptRule)
     : StyleRuleBase(type)
 {
     m_childRules.swap(adoptRule);
 }
 
-StyleRuleGroup::StyleRuleGroup(Type type, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
+StyleRuleGroup::StyleRuleGroup(StyleRuleType type, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
     : StyleRuleBase(type)
     , m_deferredRules(WTFMove(deferredRules))
 {
@@ -359,13 +359,13 @@
 }
     
 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
-    : StyleRuleGroup(Media, adoptRules)
+    : StyleRuleGroup(StyleRuleType::Media, adoptRules)
     , m_mediaQueries(WTFMove(media))
 {
 }
 
 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
-    : StyleRuleGroup(Media, WTFMove(deferredRules))
+    : StyleRuleGroup(StyleRuleType::Media, WTFMove(deferredRules))
     , m_mediaQueries(WTFMove(media))
 {
 }
@@ -379,7 +379,7 @@
 
 
 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules)
-    : StyleRuleGroup(Supports, adoptRules)
+    : StyleRuleGroup(StyleRuleType::Supports, adoptRules)
     , m_conditionText(conditionText)
     , m_conditionIsSupported(conditionIsSupported)
 {
@@ -386,7 +386,7 @@
 }
 
 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported,  std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
-    : StyleRuleGroup(Supports, WTFMove(deferredRules))
+    : StyleRuleGroup(StyleRuleType::Supports, WTFMove(deferredRules))
     , m_conditionText(conditionText)
     , m_conditionIsSupported(conditionIsSupported)
 {
@@ -401,7 +401,7 @@
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)
 StyleRuleViewport::StyleRuleViewport(Ref<StyleProperties>&& properties)
-    : StyleRuleBase(Viewport)
+    : StyleRuleBase(StyleRuleType::Viewport)
     , m_properties(WTFMove(properties))
 {
 }
@@ -423,7 +423,7 @@
 #endif // ENABLE(CSS_DEVICE_ADAPTATION)
 
 StyleRuleCharset::StyleRuleCharset()
-    : StyleRuleBase(Charset)
+    : StyleRuleBase(StyleRuleType::Charset)
 {
 }
 
@@ -435,7 +435,7 @@
 StyleRuleCharset::~StyleRuleCharset() = default;
 
 StyleRuleNamespace::StyleRuleNamespace(AtomString prefix, AtomString uri)
-    : StyleRuleBase(Namespace)
+    : StyleRuleBase(StyleRuleType::Namespace)
     , m_prefix(prefix)
     , m_uri(uri)
 {

Modified: trunk/Source/WebCore/css/StyleRule.h (251654 => 251655)


--- trunk/Source/WebCore/css/StyleRule.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/StyleRule.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -24,6 +24,7 @@
 #include "CSSSelectorList.h"
 #include "CompiledSelector.h"
 #include "StyleProperties.h"
+#include "StyleRuleType.h"
 #include <wtf/RefPtr.h>
 #include <wtf/TypeCasts.h>
 #include <wtf/UniqueArray.h>
@@ -42,38 +43,21 @@
 class StyleRuleBase : public WTF::RefCountedBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    enum Type {
-        Unknown, // Not used.
-        Style,
-        Charset, // Not used. These are internally strings owned by the style sheet.
-        Import,
-        Media,
-        FontFace,
-        Page,
-        Keyframes,
-        Keyframe, // Not used. These are internally non-rule StyleRuleKeyframe objects.
-        Namespace,
-        Supports = 12,
-#if ENABLE(CSS_DEVICE_ADAPTATION)
-        Viewport = 15,
-#endif
-    };
-
-    Type type() const { return static_cast<Type>(m_type); }
+    StyleRuleType type() const { return static_cast<StyleRuleType>(m_type); }
     
-    bool isCharsetRule() const { return type() == Charset; }
-    bool isFontFaceRule() const { return type() == FontFace; }
-    bool isKeyframesRule() const { return type() == Keyframes; }
-    bool isKeyframeRule() const { return type() == Keyframe; }
-    bool isNamespaceRule() const { return type() == Namespace; }
-    bool isMediaRule() const { return type() == Media; }
-    bool isPageRule() const { return type() == Page; }
-    bool isStyleRule() const { return type() == Style; }
-    bool isSupportsRule() const { return type() == Supports; }
+    bool isCharsetRule() const { return type() == StyleRuleType::Charset; }
+    bool isFontFaceRule() const { return type() == StyleRuleType::FontFace; }
+    bool isKeyframesRule() const { return type() == StyleRuleType::Keyframes; }
+    bool isKeyframeRule() const { return type() == StyleRuleType::Keyframe; }
+    bool isNamespaceRule() const { return type() == StyleRuleType::Namespace; }
+    bool isMediaRule() const { return type() == StyleRuleType::Media; }
+    bool isPageRule() const { return type() == StyleRuleType::Page; }
+    bool isStyleRule() const { return type() == StyleRuleType::Style; }
+    bool isSupportsRule() const { return type() == StyleRuleType::Supports; }
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-    bool isViewportRule() const { return type() == Viewport; }
+    bool isViewportRule() const { return type() == StyleRuleType::Viewport; }
 #endif
-    bool isImportRule() const { return type() == Import; }
+    bool isImportRule() const { return type() == StyleRuleType::Import; }
 
     Ref<StyleRuleBase> copy() const;
 
@@ -88,8 +72,8 @@
     Ref<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const;
 
 protected:
-    StyleRuleBase(Type type, bool hasDocumentSecurityOrigin = false)
-        : m_type(type)
+    StyleRuleBase(StyleRuleType type, bool hasDocumentSecurityOrigin = false)
+        : m_type(static_cast<unsigned>(type))
         , m_hasDocumentSecurityOrigin(hasDocumentSecurityOrigin)
     {
     }
@@ -110,7 +94,7 @@
     
     Ref<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule* parentRule) const;
 
-    unsigned m_type : 5;
+    unsigned m_type : 5; // StyleRuleType
     // This is only needed to support getMatchedCSSRules.
     unsigned m_hasDocumentSecurityOrigin : 1;
 };
@@ -241,8 +225,8 @@
     void wrapperRemoveRule(unsigned);
     
 protected:
-    StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase>>&);
-    StyleRuleGroup(Type, std::unique_ptr<DeferredStyleGroupRuleList>&&);
+    StyleRuleGroup(StyleRuleType, Vector<RefPtr<StyleRuleBase>>&);
+    StyleRuleGroup(StyleRuleType, std::unique_ptr<DeferredStyleGroupRuleList>&&);
     StyleRuleGroup(const StyleRuleGroup&);
     
 private:

Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/StyleRuleImport.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -42,13 +42,10 @@
 }
 
 StyleRuleImport::StyleRuleImport(const String& href, Ref<MediaQuerySet>&& media)
-    : StyleRuleBase(Import)
-    , m_parentStyleSheet(0)
+    : StyleRuleBase(StyleRuleType::Import)
     , m_styleSheetClient(this)
     , m_strHref(href)
     , m_mediaQueries(WTFMove(media))
-    , m_cachedSheet(0)
-    , m_loading(false)
 {
     if (!m_mediaQueries)
         m_mediaQueries = MediaQuerySet::create(String(), MediaQueryParserContext());

Modified: trunk/Source/WebCore/css/StyleRuleImport.h (251654 => 251655)


--- trunk/Source/WebCore/css/StyleRuleImport.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/StyleRuleImport.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -72,7 +72,7 @@
 
     StyleRuleImport(const String& href, Ref<MediaQuerySet>&&);
 
-    StyleSheetContents* m_parentStyleSheet;
+    StyleSheetContents* m_parentStyleSheet { nullptr };
 
     ImportedStyleSheetClient m_styleSheetClient;
     String m_strHref;
@@ -79,7 +79,7 @@
     RefPtr<MediaQuerySet> m_mediaQueries;
     RefPtr<StyleSheetContents> m_styleSheet;
     CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
-    bool m_loading;
+    bool m_loading { false };
 };
 
 } // namespace WebCore

Copied: trunk/Source/WebCore/css/StyleRuleType.h (from rev 251654, trunk/Source/WebCore/css/CSSUnicodeRangeValue.cpp) (0 => 251655)


--- trunk/Source/WebCore/css/StyleRuleType.h	                        (rev 0)
+++ trunk/Source/WebCore/css/StyleRuleType.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class StyleRuleType : uint8_t {
+    Unknown, // Not used.
+    Style,
+    Charset, // Not used. These are internally strings owned by the style sheet.
+    Import,
+    Media,
+    FontFace,
+    Page,
+    Keyframes,
+    Keyframe, // Not used. These are internally non-rule StyleRuleKeyframe objects.
+    Namespace = 10,
+    Supports = 12,
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    Viewport = 15,
+#endif
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/StyleSheetContents.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -426,26 +426,26 @@
         if (handler(*rule))
             return true;
         switch (rule->type()) {
-        case StyleRuleBase::Media: {
+        case StyleRuleType::Media: {
             auto* childRules = downcast<StyleRuleMedia>(*rule).childRulesWithoutDeferredParsing();
             if (childRules && traverseRulesInVector(*childRules, handler))
                 return true;
             break;
         }
-        case StyleRuleBase::Import:
+        case StyleRuleType::Import:
             ASSERT_NOT_REACHED();
             break;
-        case StyleRuleBase::Style:
-        case StyleRuleBase::FontFace:
-        case StyleRuleBase::Page:
-        case StyleRuleBase::Keyframes:
-        case StyleRuleBase::Namespace:
-        case StyleRuleBase::Unknown:
-        case StyleRuleBase::Charset:
-        case StyleRuleBase::Keyframe:
-        case StyleRuleBase::Supports:
+        case StyleRuleType::Style:
+        case StyleRuleType::FontFace:
+        case StyleRuleType::Page:
+        case StyleRuleType::Keyframes:
+        case StyleRuleType::Namespace:
+        case StyleRuleType::Unknown:
+        case StyleRuleType::Charset:
+        case StyleRuleType::Keyframe:
+        case StyleRuleType::Supports:
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-        case StyleRuleBase::Viewport:
+        case StyleRuleType::Viewport:
 #endif
             break;
         }
@@ -469,26 +469,26 @@
 {
     return traverseRules([&] (const StyleRuleBase& rule) {
         switch (rule.type()) {
-        case StyleRuleBase::Style: {
+        case StyleRuleType::Style: {
             auto* properties = downcast<StyleRule>(rule).propertiesWithoutDeferredParsing();
             return properties && properties->traverseSubresources(handler);
         }
-        case StyleRuleBase::FontFace:
+        case StyleRuleType::FontFace:
             return downcast<StyleRuleFontFace>(rule).properties().traverseSubresources(handler);
-        case StyleRuleBase::Import:
+        case StyleRuleType::Import:
             if (auto* cachedResource = downcast<StyleRuleImport>(rule).cachedCSSStyleSheet())
                 return handler(*cachedResource);
             return false;
-        case StyleRuleBase::Media:
-        case StyleRuleBase::Page:
-        case StyleRuleBase::Keyframes:
-        case StyleRuleBase::Namespace:
-        case StyleRuleBase::Unknown:
-        case StyleRuleBase::Charset:
-        case StyleRuleBase::Keyframe:
-        case StyleRuleBase::Supports:
+        case StyleRuleType::Media:
+        case StyleRuleType::Page:
+        case StyleRuleType::Keyframes:
+        case StyleRuleType::Namespace:
+        case StyleRuleType::Unknown:
+        case StyleRuleType::Charset:
+        case StyleRuleType::Keyframe:
+        case StyleRuleType::Supports:
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-        case StyleRuleBase::Viewport:
+        case StyleRuleType::Viewport:
 #endif
             return false;
         };

Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSParser.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -199,7 +199,7 @@
         Vector<CSSParserToken> resolvedTokens = resolvedData->tokens();
         
         ParsedPropertyVector parsedProperties;
-        if (!CSSPropertyParser::parseValue(shorthandID, false, resolvedTokens, m_context, parsedProperties, StyleRule::Style))
+        if (!CSSPropertyParser::parseValue(shorthandID, false, resolvedTokens, m_context, parsedProperties, StyleRuleType::Style))
             return nullptr;
         
         for (auto& property : parsedProperties) {

Modified: trunk/Source/WebCore/css/parser/CSSParserContext.h (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSParserContext.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -26,8 +26,10 @@
 #pragma once
 
 #include "CSSParserMode.h"
+#include "StyleRuleType.h"
 #include "TextEncoding.h"
 #include <wtf/HashFunctions.h>
+#include <wtf/Optional.h>
 #include <wtf/URL.h>
 #include <wtf/URLHash.h>
 #include <wtf/text/StringHash.h>
@@ -39,6 +41,7 @@
 struct CSSParserContext {
     WTF_MAKE_FAST_ALLOCATED;
 public:
+
     CSSParserContext(CSSParserMode, const URL& baseURL = URL());
     WEBCORE_EXPORT CSSParserContext(const Document&, const URL& baseURL = URL(), const String& charset = emptyString());
 
@@ -45,6 +48,7 @@
     URL baseURL;
     String charset;
     CSSParserMode mode { HTMLStandardMode };
+    Optional<StyleRuleType> enclosingRuleType;
     bool isHTMLDocument { false };
 #if ENABLE(TEXT_AUTOSIZING)
     bool textAutosizingEnabled { false };

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -85,11 +85,7 @@
 CSSParser::ParseResult CSSParserImpl::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
 {
     CSSParserImpl parser(context, string);
-    StyleRule::Type ruleType = StyleRule::Style;
-#if ENABLE(CSS_DEVICE_ADAPTATION)
-    if (declaration->cssParserMode() == CSSViewportRuleMode)
-        ruleType = StyleRule::Viewport;
-#endif
+    auto ruleType = context.enclosingRuleType.valueOr(StyleRuleType::Style);
     parser.consumeDeclarationValue(parser.tokenizer()->tokenRange(), propertyID, important, ruleType);
     if (parser.m_parsedProperties.isEmpty())
         return CSSParser::ParseResult::Error;
@@ -162,7 +158,7 @@
     context.mode = strictToCSSParserMode(element->isHTMLElement() && !element->document().inQuirksMode());
 
     CSSParserImpl parser(context, string);
-    parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), StyleRule::Style);
+    parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), StyleRuleType::Style);
     return createStyleProperties(parser.m_parsedProperties, context.mode);
 }
 
@@ -173,7 +169,7 @@
         return createStyleProperties(properties, context.mode);
     }
     CSSParserImpl parser(context, styleSheet);
-    parser.consumeDeclarationList(tokenRange, StyleRule::Style);
+    parser.consumeDeclarationList(tokenRange, StyleRuleType::Style);
     return createStyleProperties(parser.m_parsedProperties, context.mode);
 }
     
@@ -201,11 +197,7 @@
 bool CSSParserImpl::parseDeclarationList(MutableStyleProperties* declaration, const String& string, const CSSParserContext& context)
 {
     CSSParserImpl parser(context, string);
-    StyleRule::Type ruleType = StyleRule::Style;
-#if ENABLE(CSS_DEVICE_ADAPTATION)
-    if (declaration->cssParserMode() == CSSViewportRuleMode)
-        ruleType = StyleRule::Viewport;
-#endif
+    auto ruleType = context.enclosingRuleType.valueOr(StyleRuleType::Style);
     parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), ruleType);
     if (parser.m_parsedProperties.isEmpty())
         return false;
@@ -306,7 +298,7 @@
 bool CSSParserImpl::supportsDeclaration(CSSParserTokenRange& range)
 {
     ASSERT(m_parsedProperties.isEmpty());
-    consumeDeclaration(range, StyleRule::Style);
+    consumeDeclaration(range, StyleRuleType::Style);
     bool result = !m_parsedProperties.isEmpty();
     m_parsedProperties.clear();
     return result;
@@ -316,9 +308,9 @@
 {
     CSSParserObserverWrapper wrapper(observer);
     CSSParserImpl parser(context, declaration, nullptr, &wrapper);
-    observer.startRuleHeader(StyleRule::Style, 0);
+    observer.startRuleHeader(StyleRuleType::Style, 0);
     observer.endRuleHeader(1);
-    parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), StyleRule::Style);
+    parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), StyleRuleType::Style);
 }
 
 void CSSParserImpl::parseStyleSheetForInspector(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet, CSSParserObserver& observer)
@@ -510,7 +502,7 @@
 
     if (m_observerWrapper) {
         unsigned endOffset = m_observerWrapper->endOffset(prelude);
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Import, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Import, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(endOffset);
         m_observerWrapper->observer().startRuleBody(endOffset);
         m_observerWrapper->observer().endRuleBody(endOffset);
@@ -540,7 +532,7 @@
     Vector<RefPtr<StyleRuleBase>> rules;
 
     if (m_observerWrapper) {
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Media, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Media, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
         m_observerWrapper->observer().startRuleBody(m_observerWrapper->previousTokenStartOffset(block));
     }
@@ -566,7 +558,7 @@
         return StyleRuleSupports::create(prelude.serialize().stripWhiteSpace(), supported, makeUnique<DeferredStyleGroupRuleList>(block, *m_deferredParser));
 
     if (m_observerWrapper) {
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Supports, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Supports, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
         m_observerWrapper->observer().startRuleBody(m_observerWrapper->previousTokenStartOffset(block));
     }
@@ -591,7 +583,7 @@
 
     if (m_observerWrapper) {
         unsigned endOffset = m_observerWrapper->endOffset(prelude);
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Viewport, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Viewport, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(endOffset);
         m_observerWrapper->observer().startRuleBody(endOffset);
         m_observerWrapper->observer().endRuleBody(endOffset);
@@ -609,13 +601,13 @@
 
     if (m_observerWrapper) {
         unsigned endOffset = m_observerWrapper->endOffset(prelude);
-        m_observerWrapper->observer().startRuleHeader(StyleRule::FontFace, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::FontFace, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(endOffset);
         m_observerWrapper->observer().startRuleBody(endOffset);
         m_observerWrapper->observer().endRuleBody(endOffset);
     }
 
-    consumeDeclarationList(block, StyleRule::FontFace);
+    consumeDeclarationList(block, StyleRuleType::FontFace);
     return StyleRuleFontFace::create(createStyleProperties(m_parsedProperties, m_context.mode));
 }
 
@@ -638,7 +630,7 @@
         return StyleRuleKeyframes::create(name, makeUnique<DeferredStyleGroupRuleList>(block, *m_deferredParser));
 
     if (m_observerWrapper) {
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Keyframes, m_observerWrapper->startOffset(rangeCopy));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Keyframes, m_observerWrapper->startOffset(rangeCopy));
         m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
         m_observerWrapper->observer().startRuleBody(m_observerWrapper->previousTokenStartOffset(block));
         m_observerWrapper->observer().endRuleBody(m_observerWrapper->endOffset(block));
@@ -662,11 +654,11 @@
 
     if (m_observerWrapper) {
         unsigned endOffset = m_observerWrapper->endOffset(prelude);
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Page, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Page, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(endOffset);
     }
 
-    consumeDeclarationList(block, StyleRule::Style);
+    consumeDeclarationList(block, StyleRuleType::Style);
     
     return StyleRulePage::create(createStyleProperties(m_parsedProperties, m_context.mode), WTFMove(selectorList));
 }
@@ -690,11 +682,11 @@
         return nullptr;
 
     if (m_observerWrapper) {
-        m_observerWrapper->observer().startRuleHeader(StyleRule::Keyframe, m_observerWrapper->startOffset(prelude));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Keyframe, m_observerWrapper->startOffset(prelude));
         m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
     }
 
-    consumeDeclarationList(block, StyleRule::Keyframe);
+    consumeDeclarationList(block, StyleRuleType::Keyframe);
     return StyleRuleKeyframe::create(WTFMove(keyList), createStyleProperties(m_parsedProperties, m_context.mode));
 }
 
@@ -703,7 +695,7 @@
     // This is easier than hooking into the CSSSelectorParser
     selectors.consumeWhitespace();
     CSSParserTokenRange originalRange = selectors;
-    wrapper.observer().startRuleHeader(StyleRule::Style, wrapper.startOffset(originalRange));
+    wrapper.observer().startRuleHeader(StyleRuleType::Style, wrapper.startOffset(originalRange));
 
     while (!selectors.atEnd()) {
         const CSSParserToken* selectorStart = &selectors.peek();
@@ -739,15 +731,15 @@
         }
     }
 
-    consumeDeclarationList(block, StyleRule::Style);
+    consumeDeclarationList(block, StyleRuleType::Style);
     return StyleRule::create(createStyleProperties(m_parsedProperties, m_context.mode), m_context.hasDocumentSecurityOrigin, WTFMove(selectorList));
 }
 
-void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, StyleRule::Type ruleType)
+void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, StyleRuleType ruleType)
 {
     ASSERT(m_parsedProperties.isEmpty());
 
-    bool useObserver = m_observerWrapper && (ruleType == StyleRule::Style || ruleType == StyleRule::Keyframe);
+    bool useObserver = m_observerWrapper && (ruleType == StyleRuleType::Style || ruleType == StyleRuleType::Keyframe);
     if (useObserver) {
         m_observerWrapper->observer().startRuleBody(m_observerWrapper->previousTokenStartOffset(range));
         m_observerWrapper->skipCommentsBefore(range, true);
@@ -776,7 +768,7 @@
         }
         case AtKeywordToken: {
             // FIXME-NEWPARSER: Support apply
-            AllowedRulesType allowedRules = /* ruleType == StyleRule::Style && RuntimeEnabledFeatures::cssApplyAtRulesEnabled() ? ApplyRules :*/ NoRules;
+            AllowedRulesType allowedRules = /* ruleType == StyleRuleType::Style && RuntimeEnabledFeatures::cssApplyAtRulesEnabled() ? ApplyRules :*/ NoRules;
             RefPtr<StyleRuleBase> rule = consumeAtRule(range, allowedRules);
             ASSERT_UNUSED(rule, !rule);
             break;
@@ -795,7 +787,7 @@
     }
 }
 
-void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRule::Type ruleType)
+void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRuleType ruleType)
 {
     CSSParserTokenRange rangeCopy = range; // For inspector callbacks
 
@@ -826,13 +818,13 @@
         consumeCustomPropertyValue(range.makeSubRange(&range.peek(), declarationValueEnd), variableName, important);
     }
 
-    if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule::Keyframe))
+    if (important && (ruleType == StyleRuleType::FontFace || ruleType == StyleRuleType::Keyframe))
         return;
 
     if (propertyID != CSSPropertyInvalid)
         consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEnd), propertyID, important, ruleType);
 
-    if (m_observerWrapper && (ruleType == StyleRule::Style || ruleType == StyleRule::Keyframe)) {
+    if (m_observerWrapper && (ruleType == StyleRuleType::Style || ruleType == StyleRuleType::Keyframe)) {
         m_observerWrapper->observer().observeProperty(
             m_observerWrapper->startOffset(rangeCopy), m_observerWrapper->endOffset(rangeCopy),
             important, m_parsedProperties.size() != propertiesCount);
@@ -845,7 +837,7 @@
         m_parsedProperties.append(CSSProperty(CSSPropertyCustom, WTFMove(value), important));
 }
 
-void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSPropertyID propertyID, bool important, StyleRule::Type ruleType)
+void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSPropertyID propertyID, bool important, StyleRuleType ruleType)
 {
     CSSPropertyParser::parseValue(propertyID, important, range, m_context, m_parsedProperties, ruleType);
 }

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.h (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -138,9 +138,9 @@
     RefPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParserTokenRange prelude, CSSParserTokenRange block);
     RefPtr<StyleRule> consumeStyleRule(CSSParserTokenRange prelude, CSSParserTokenRange block);
 
-    void consumeDeclarationList(CSSParserTokenRange, StyleRule::Type);
-    void consumeDeclaration(CSSParserTokenRange, StyleRule::Type);
-    void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRule::Type);
+    void consumeDeclarationList(CSSParserTokenRange, StyleRuleType);
+    void consumeDeclaration(CSSParserTokenRange, StyleRuleType);
+    void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRuleType);
     void consumeCustomPropertyValue(CSSParserTokenRange, const AtomString& propertyName, bool important);
 
     static std::unique_ptr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange);

Modified: trunk/Source/WebCore/css/parser/CSSParserObserver.h (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSParserObserver.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSParserObserver.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -33,7 +33,7 @@
 class CSSParserObserver {
 public:
     virtual ~CSSParserObserver() { };
-    virtual void startRuleHeader(StyleRule::Type, unsigned offset) = 0;
+    virtual void startRuleHeader(StyleRuleType, unsigned offset) = 0;
     virtual void endRuleHeader(unsigned offset) = 0;
     virtual void observeSelector(unsigned startOffset, unsigned endOffset) = 0;
     virtual void startRuleBody(unsigned offset) = 0;

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -259,7 +259,7 @@
         addProperty(longhands[i], property, value.copyRef(), important);
 }
 
-bool CSSPropertyParser::parseValue(CSSPropertyID propertyID, bool important, const CSSParserTokenRange& range, const CSSParserContext& context, ParsedPropertyVector& parsedProperties, StyleRule::Type ruleType)
+bool CSSPropertyParser::parseValue(CSSPropertyID propertyID, bool important, const CSSParserTokenRange& range, const CSSParserContext& context, ParsedPropertyVector& parsedProperties, StyleRuleType ruleType)
 {
     int parsedPropertiesSize = parsedProperties.size();
 
@@ -267,11 +267,11 @@
     bool parseSuccess;
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-    if (ruleType == StyleRule::Viewport)
+    if (ruleType == StyleRuleType::Viewport)
         parseSuccess = parser.parseViewportDescriptor(propertyID, important);
     else
 #endif
-    if (ruleType == StyleRule::FontFace)
+    if (ruleType == StyleRuleType::FontFace)
         parseSuccess = parser.parseFontFaceDescriptor(propertyID);
     else
         parseSuccess = parser.parseValueStart(propertyID, important);

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2019-10-28 16:02:53 UTC (rev 251655)
@@ -42,7 +42,7 @@
 public:
     static bool parseValue(CSSPropertyID, bool important,
         const CSSParserTokenRange&, const CSSParserContext&,
-        Vector<CSSProperty, 256>&, StyleRule::Type);
+        Vector<CSSProperty, 256>&, StyleRuleType);
 
     // Parses a non-shorthand CSS property
     static RefPtr<CSSValue> parseSingleValue(CSSPropertyID, const CSSParserTokenRange&, const CSSParserContext&);

Modified: trunk/Source/WebCore/css/parser/CSSTokenizer.cpp (251654 => 251655)


--- trunk/Source/WebCore/css/parser/CSSTokenizer.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/css/parser/CSSTokenizer.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -327,8 +327,7 @@
 CSSParserToken CSSTokenizer::letterU(UChar cc)
 {
     if (m_input.peekWithoutReplacement(0) == '+'
-        && (isASCIIHexDigit(m_input.peekWithoutReplacement(1))
-            || m_input.peekWithoutReplacement(1) == '?')) {
+        && (isASCIIHexDigit(m_input.peekWithoutReplacement(1)) || m_input.peekWithoutReplacement(1) == '?')) {
         m_input.advance();
         return consumeUnicodeRange();
     }

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (251654 => 251655)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2019-10-28 15:06:07 UTC (rev 251654)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2019-10-28 16:02:53 UTC (rev 251655)
@@ -101,11 +101,11 @@
 static void flattenSourceData(RuleSourceDataList& dataList, RuleSourceDataList& target)
 {
     for (auto& data : dataList) {
-        if (data->type == WebCore::StyleRule::Style)
+        if (data->type == WebCore::StyleRuleType::Style)
             target.append(data.copyRef());
-        else if (data->type == WebCore::StyleRule::Media)
+        else if (data->type == WebCore::StyleRuleType::Media)
             flattenSourceData(data->childRules, target);
-        else if (data->type == WebCore::StyleRule::Supports)
+        else if (data->type == WebCore::StyleRuleType::Supports)
             flattenSourceData(data->childRules, target);
     }
 }
@@ -154,7 +154,7 @@
     }
     
 private:
-    void startRuleHeader(StyleRule::Type, unsigned) override;
+    void startRuleHeader(StyleRuleType, unsigned) override;
     void endRuleHeader(unsigned) override;
     void observeSelector(unsigned startOffset, unsigned endOffset) override;
     void startRuleBody(unsigned) override;
@@ -174,7 +174,7 @@
     RuleSourceDataList* m_ruleSourceDataResult { nullptr };
 };
 
-void StyleSheetHandler::startRuleHeader(StyleRule::Type type, unsigned offset)
+void StyleSheetHandler::startRuleHeader(StyleRuleType type, unsigned offset)
 {
     // Pop off data for a previous invalid rule.
     if (m_currentRuleData)
@@ -1568,7 +1568,7 @@
 Ref<CSSRuleSourceData> InspectorStyleSheetForInlineStyle::ruleSourceData() const
 {
     if (m_styleText.isEmpty()) {
-        auto result = CSSRuleSourceData::create(StyleRule::Style);
+        auto result = CSSRuleSourceData::create(StyleRuleType::Style);
         result->ruleBodyRange.start = 0;
         result->ruleBodyRange.end = 0;
         return result;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to