Diff
Modified: trunk/LayoutTests/ChangeLog (267575 => 267576)
--- trunk/LayoutTests/ChangeLog 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/ChangeLog 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,3 +1,19 @@
+2020-09-24 Darin Adler <[email protected]>
+
+ Add CSSConditionRule and CSSGroupingRule
+ https://bugs.webkit.org/show_bug.cgi?id=216855
+
+ Reviewed by Sam Weinig.
+
+ * fast/dom/domListEnumeration-expected.txt:
+ * fast/dom/domListEnumeration.html:
+ Updated since toString is now implemented and enumerable.
+
+ * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+ * fast/dom/non-numeric-values-numeric-parameters.html:
+ Updated test and expectations since CSSMediaRule's deleteRule no longer allows omitting
+ the index to delete rule 0 (both non-standard and inconsistent with CSSStyleSheet).
+
2020-09-25 Ryan Haddad <[email protected]>
Unreviewed test gardening, land test expectations for rdar://69347249.
Modified: trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt (267575 => 267576)
--- trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -81,7 +81,7 @@
PASS resultArray[1].item is cssValueList.item(1)
[object MediaList]
-PASS resultArray.length is 8
+PASS resultArray.length is 9
PASS resultArray[0].i is '0'
PASS resultArray[0].item is mediaList.item(0)
PASS resultArray[1].i is '1'
Modified: trunk/LayoutTests/fast/dom/domListEnumeration.html (267575 => 267576)
--- trunk/LayoutTests/fast/dom/domListEnumeration.html 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/fast/dom/domListEnumeration.html 2020-09-25 17:19:48 UTC (rev 267576)
@@ -200,7 +200,7 @@
// MediaList
var mediaList = document.styleSheets[3].cssRules[0].media;
resultArray = iterateList(mediaList);
-shouldBe("resultArray.length", "8");
+shouldBe("resultArray.length", "9");
shouldBe("resultArray[0].i", "'0'");
shouldBe("resultArray[0].item", "mediaList.item(0)");
shouldBe("resultArray[1].i", "'1'");
Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (267575 => 267576)
--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -11,7 +11,7 @@
PASS nonNumericPolicy('document.createTextNode("a").replaceData(x, 0, "b")') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").replaceData(0, x, "b")') is 'any type allowed'
PASS nonNumericPolicy('createCSSMediaRule().insertRule(ruleText, x)') is 'any type allowed'
-PASS nonNumericPolicy('createCSSMediaRule().deleteRule(x)') is 'any type allowed'
+PASS nonNumericPolicy('createCSSMediaRule().deleteRule(x)') is 'any type allowed (but not omitted)'
PASS nonNumericPolicy('createCSSRuleList().item(x)') is 'any type allowed (but not omitted)'
PASS nonNumericPolicy('createCSSStyleDeclaration().item(x)') is 'any type allowed (but not omitted)'
PASS nonNumericPolicy('createCSSStyleSheet().insertRule(ruleText, x)') is 'any type allowed'
Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters.html (267575 => 267576)
--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters.html 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters.html 2020-09-25 17:19:48 UTC (rev 267576)
@@ -203,7 +203,7 @@
// CSSMediaRule
shouldBe("nonNumericPolicy('createCSSMediaRule().insertRule(ruleText, x)')", "'any type allowed'");
-shouldBe("nonNumericPolicy('createCSSMediaRule().deleteRule(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('createCSSMediaRule().deleteRule(x)')", "'any type allowed (but not omitted)'");
// CSSRuleList
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (267575 => 267576)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,3 +1,16 @@
+2020-09-24 Darin Adler <[email protected]>
+
+ Add CSSConditionRule and CSSGroupingRule
+ https://bugs.webkit.org/show_bug.cgi?id=216855
+
+ Reviewed by Sam Weinig.
+
+ * web-platform-tests/css/conditional/idlharness-expected.txt:
+ * web-platform-tests/css/cssom/MediaList-expected.txt:
+ * web-platform-tests/css/cssom/cssimportrule-expected.txt:
+ * web-platform-tests/css/cssom/idlharness-expected.txt:
+ Updated expectations to expect more tests to pass.
+
2020-09-25 Antoine Quint <[email protected]>
Reduce the reliance on PseudoElement in the animation code
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/conditional/idlharness-expected.txt (267575 => 267576)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/conditional/idlharness-expected.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/conditional/idlharness-expected.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -5,29 +5,29 @@
PASS Partial interface CSSRule: member names are unique
PASS Partial namespace CSS: original namespace defined
PASS Partial namespace CSS: member names are unique
-FAIL CSSConditionRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSConditionRule interface object length assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSConditionRule interface object name assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSConditionRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSConditionRule interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSConditionRule interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSConditionRule interface: attribute conditionText assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
-FAIL CSSMediaRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
+PASS CSSConditionRule interface: existence and properties of interface object
+PASS CSSConditionRule interface object length
+PASS CSSConditionRule interface object name
+PASS CSSConditionRule interface: existence and properties of interface prototype object
+PASS CSSConditionRule interface: existence and properties of interface prototype object's "constructor" property
+PASS CSSConditionRule interface: existence and properties of interface prototype object's @@unscopables property
+PASS CSSConditionRule interface: attribute conditionText
+PASS CSSMediaRule interface: existence and properties of interface object
PASS CSSMediaRule interface object length
PASS CSSMediaRule interface object name
-FAIL CSSMediaRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
+PASS CSSMediaRule interface: existence and properties of interface prototype object
PASS CSSMediaRule interface: existence and properties of interface prototype object's "constructor" property
PASS CSSMediaRule interface: existence and properties of interface prototype object's @@unscopables property
-FAIL CSSMediaRule interface: attribute media assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
+PASS CSSMediaRule interface: attribute media
PASS CSSMediaRule must be primary interface of cssMediaRule
PASS Stringification of cssMediaRule
PASS CSSMediaRule interface: cssMediaRule must inherit property "media" with the proper type
-FAIL CSSConditionRule interface: cssMediaRule must inherit property "conditionText" with the proper type assert_inherits: property "conditionText" not found in prototype chain
+PASS CSSConditionRule interface: cssMediaRule must inherit property "conditionText" with the proper type
PASS CSSRule interface: cssMediaRule must inherit property "SUPPORTS_RULE" with the proper type
-FAIL CSSSupportsRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
+PASS CSSSupportsRule interface: existence and properties of interface object
PASS CSSSupportsRule interface object length
PASS CSSSupportsRule interface object name
-FAIL CSSSupportsRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing
+PASS CSSSupportsRule interface: existence and properties of interface prototype object
PASS CSSSupportsRule interface: existence and properties of interface prototype object's "constructor" property
PASS CSSSupportsRule interface: existence and properties of interface prototype object's @@unscopables property
PASS CSSSupportsRule must be primary interface of cssSupportsRule
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/MediaList-expected.txt (267575 => 267576)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/MediaList-expected.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/MediaList-expected.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,3 +1,3 @@
-FAIL CSSOM - MediaList interface assert_equals: MediaList toString method expected "screen and (min-width: 480px), print, projection" but got "[object MediaList]"
+PASS CSSOM - MediaList interface
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssimportrule-expected.txt (267575 => 267576)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssimportrule-expected.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssimportrule-expected.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -5,7 +5,7 @@
PASS Values of CSSRule attributes
PASS Existence and writability of CSSImportRule attributes
PASS Values of CSSImportRule attributes
-FAIL CSSImportRule : MediaList mediaText attribute should be updated due to [PutForwards] assert_equals: expected "print" but got "screen"
+PASS CSSImportRule : MediaList mediaText attribute should be updated due to [PutForwards]
PASS CSSStyleDeclaration cssText attribute should be updated due to [PutForwards]
-FAIL StyleSheet : MediaList mediaText attribute should be updated due to [PutForwards] assert_equals: expected "screen" but got ""
+PASS StyleSheet : MediaList mediaText attribute should be updated due to [PutForwards]
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt (267575 => 267576)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -53,7 +53,7 @@
PASS MediaList interface: existence and properties of interface prototype object's "constructor" property
PASS MediaList interface: existence and properties of interface prototype object's @@unscopables property
PASS MediaList interface: attribute mediaText
-FAIL MediaList interface: stringifier assert_own_property: interface prototype object missing non-static operation expected property "toString" missing
+PASS MediaList interface: stringifier
PASS MediaList interface: attribute length
PASS MediaList interface: operation item(unsigned long)
PASS MediaList interface: operation appendMedium(CSSOMString)
@@ -79,7 +79,7 @@
PASS StyleSheet interface: attribute ownerNode
PASS StyleSheet interface: attribute parentStyleSheet
PASS StyleSheet interface: attribute title
-FAIL StyleSheet interface: attribute media assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
+PASS StyleSheet interface: attribute media
PASS StyleSheet interface: attribute disabled
PASS CSSStyleSheet interface: existence and properties of interface object
PASS CSSStyleSheet interface object length
@@ -162,8 +162,8 @@
PASS CSSRule interface: constant FONT_FACE_RULE on interface prototype object
PASS CSSRule interface: constant PAGE_RULE on interface object
PASS CSSRule interface: constant PAGE_RULE on interface prototype object
-FAIL CSSRule interface: constant MARGIN_RULE on interface object assert_own_property: expected property "MARGIN_RULE" missing
-FAIL CSSRule interface: constant MARGIN_RULE on interface prototype object assert_own_property: expected property "MARGIN_RULE" missing
+PASS CSSRule interface: constant MARGIN_RULE on interface object
+PASS CSSRule interface: constant MARGIN_RULE on interface prototype object
PASS CSSRule interface: constant NAMESPACE_RULE on interface object
PASS CSSRule interface: constant NAMESPACE_RULE on interface prototype object
PASS CSSStyleRule interface: existence and properties of interface object
@@ -188,7 +188,7 @@
PASS CSSRule interface: sheet.cssRules[4] must inherit property "MEDIA_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[4] must inherit property "FONT_FACE_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[4] must inherit property "PAGE_RULE" with the proper type
-FAIL CSSRule interface: sheet.cssRules[4] must inherit property "MARGIN_RULE" with the proper type assert_inherits: property "MARGIN_RULE" not found in prototype chain
+PASS CSSRule interface: sheet.cssRules[4] must inherit property "MARGIN_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[4] must inherit property "NAMESPACE_RULE" with the proper type
PASS CSSImportRule interface: existence and properties of interface object
PASS CSSImportRule interface object length
@@ -197,7 +197,7 @@
PASS CSSImportRule interface: existence and properties of interface prototype object's "constructor" property
PASS CSSImportRule interface: existence and properties of interface prototype object's @@unscopables property
PASS CSSImportRule interface: attribute href
-FAIL CSSImportRule interface: attribute media assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
+PASS CSSImportRule interface: attribute media
PASS CSSImportRule interface: attribute styleSheet
PASS CSSImportRule must be primary interface of sheet.cssRules[0]
PASS Stringification of sheet.cssRules[0]
@@ -214,21 +214,25 @@
PASS CSSRule interface: sheet.cssRules[0] must inherit property "MEDIA_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[0] must inherit property "FONT_FACE_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[0] must inherit property "PAGE_RULE" with the proper type
-FAIL CSSRule interface: sheet.cssRules[0] must inherit property "MARGIN_RULE" with the proper type assert_inherits: property "MARGIN_RULE" not found in prototype chain
+PASS CSSRule interface: sheet.cssRules[0] must inherit property "MARGIN_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[0] must inherit property "NAMESPACE_RULE" with the proper type
-FAIL CSSGroupingRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface object length assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface object name assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface: attribute cssRules assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface: operation insertRule(CSSOMString, optional unsigned long) assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSGroupingRule interface: operation deleteRule(unsigned long) assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
-FAIL CSSPageRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
+PASS CSSGroupingRule interface: existence and properties of interface object
+PASS CSSGroupingRule interface object length
+PASS CSSGroupingRule interface object name
+PASS CSSGroupingRule interface: existence and properties of interface prototype object
+PASS CSSGroupingRule interface: existence and properties of interface prototype object's "constructor" property
+PASS CSSGroupingRule interface: existence and properties of interface prototype object's @@unscopables property
+PASS CSSGroupingRule interface: attribute cssRules
+PASS CSSGroupingRule interface: operation insertRule(CSSOMString, optional unsigned long)
+PASS CSSGroupingRule interface: operation deleteRule(unsigned long)
+FAIL CSSPageRule interface: existence and properties of interface object assert_equals: prototype of CSSPageRule is not CSSGroupingRule expected function "function CSSGroupingRule() {
+ [native code]
+}" but got function "function CSSRule() {
+ [native code]
+}"
PASS CSSPageRule interface object length
PASS CSSPageRule interface object name
-FAIL CSSPageRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing
+FAIL CSSPageRule interface: existence and properties of interface prototype object assert_equals: prototype of CSSPageRule.prototype is not CSSGroupingRule.prototype expected object "[object CSSGroupingRule]" but got object "[object CSSRule]"
PASS CSSPageRule interface: existence and properties of interface prototype object's "constructor" property
PASS CSSPageRule interface: existence and properties of interface prototype object's @@unscopables property
PASS CSSPageRule interface: attribute selectorText
@@ -252,7 +256,7 @@
PASS CSSRule interface: sheet.cssRules[2] must inherit property "MEDIA_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[2] must inherit property "FONT_FACE_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[2] must inherit property "PAGE_RULE" with the proper type
-FAIL CSSRule interface: sheet.cssRules[2] must inherit property "MARGIN_RULE" with the proper type assert_inherits: property "MARGIN_RULE" not found in prototype chain
+PASS CSSRule interface: sheet.cssRules[2] must inherit property "MARGIN_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[2] must inherit property "NAMESPACE_RULE" with the proper type
FAIL CSSMarginRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSMarginRule" expected property "CSSMarginRule" missing
FAIL CSSMarginRule interface object length assert_own_property: self does not have own property "CSSMarginRule" expected property "CSSMarginRule" missing
@@ -300,7 +304,7 @@
PASS CSSRule interface: sheet.cssRules[1] must inherit property "MEDIA_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[1] must inherit property "FONT_FACE_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[1] must inherit property "PAGE_RULE" with the proper type
-FAIL CSSRule interface: sheet.cssRules[1] must inherit property "MARGIN_RULE" with the proper type assert_inherits: property "MARGIN_RULE" not found in prototype chain
+PASS CSSRule interface: sheet.cssRules[1] must inherit property "MARGIN_RULE" with the proper type
PASS CSSRule interface: sheet.cssRules[1] must inherit property "NAMESPACE_RULE" with the proper type
PASS CSSStyleDeclaration interface: existence and properties of interface object
PASS CSSStyleDeclaration interface object length
Modified: trunk/Source/WebCore/CMakeLists.txt (267575 => 267576)
--- trunk/Source/WebCore/CMakeLists.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -690,7 +690,9 @@
crypto/parameters/RsaOaepParams.idl
crypto/parameters/RsaPssParams.idl
+ css/CSSConditionRule.idl
css/CSSFontFaceRule.idl
+ css/CSSGroupingRule.idl
css/CSSImportRule.idl
css/CSSKeyframeRule.idl
css/CSSKeyframesRule.idl
Modified: trunk/Source/WebCore/ChangeLog (267575 => 267576)
--- trunk/Source/WebCore/ChangeLog 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/ChangeLog 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,3 +1,125 @@
+2020-09-24 Darin Adler <[email protected]>
+
+ Add CSSConditionRule and CSSGroupingRule
+ https://bugs.webkit.org/show_bug.cgi?id=216855
+
+ Reviewed by Sam Weinig.
+
+ * CMakeLists.txt: Added CSSConditionRule.idl and CSSGroupingRule.idl.
+
+ * DerivedSources-input.xcfilelist: Updated.
+ * DerivedSources-output.xcfilelist: Updated.
+
+ * DerivedSources.make: Added CSSConditionRule.idl and CSSGroupingRule.idl.
+ * Headers.cmake: Added CSSConditionRule.h.
+ * Sources.txt: Add CSSConditionRule.cpp, JSCSSConditioRule.cpp,
+ and JSCSSGroupingRule.cpp.
+
+ * WebCore.xcodeproj/project.pbxproj: Added all the files.
+
+ * css/CSSConditionRule.cpp: Added.
+ * css/CSSConditionRule.h: Added.
+ * css/CSSConditionRule.idl: Added.
+
+ * css/CSSGroupingRule.cpp:
+ (WebCore::CSSGroupingRule::~CSSGroupingRule): Use a range-based for loop
+ and nullptr.
+ (WebCore::CSSGroupingRule::appendCSSTextForItems const): Use variadic
+ append to clean this up a bit.
+ (WebCore::CSSGroupingRule::item const): Use auto.
+
+ * css/CSSGroupingRule.h: Made m_groupRule private instead of protected.
+ Did some other tweaks.
+
+ * css/CSSGroupingRule.idl: Added.
+
+ * css/CSSImportRule.idl: Added [Exposed=Window], changed href to be a
+ USVString, added [SameObject, PutForwards=mediaText] to media
+ and [SameObject] to styleSheet.
+
+ * css/CSSMediaRule.cpp:
+ (WebCore::CSSMediaRule::CSSMediaRule): Derive from CSSConditionRule.
+ (WebCore::CSSMediaRule::mediaQueries const): Return a reference.
+ (WebCore::CSSMediaRule::cssText const): Streamline since we don't need a
+ null check.
+ (WebCore::CSSMediaRule::conditionText const): Added.
+ (WebCore::CSSMediaRule::setConditionText): Added.
+ (WebCore::CSSMediaRule::media const): Streamline since we don't need a
+ null check.
+ (WebCore::CSSMediaRule::reattach): Ditto.
+
+ * css/CSSMediaRule.h: Derive from CSSConditionRule.
+
+ * css/CSSMediaRule.idl: Derive from CSSConditionRule. Added
+ [Exposed=Window]. Added [SameObject, PutForwards=mediaText] to media.
+ Removed insertRule and deleteRule since they are now inherited from
+ CSSGroupingRule.
+
+ * css/CSSRule.h: Added MARGIN_RULE constant even though we don't have
+ that rule type. Moved inline functions out of the class body to help
+ clarity a bit.
+
+ * css/CSSRule.idl: Added [Exposed=Window], changed a few things to match
+ the specification.
+
+ * css/CSSStyleRule.idl: Added [Exposed=Window]. Added [SameObject]
+ to style.
+
+ * css/CSSStyleSheet.idl: Added [Exposed=Window].
+
+ * css/CSSSupportsRule.cpp:
+ (WebCore::CSSSupportsRule::CSSSupportsRule): Derive from CSSConditionRule.
+ (WebCore::CSSSupportsRule::create): Added.
+ (WebCore::CSSSupportsRule::cssText const): Use variadic append.
+ (WebCore::CSSSupportsRule::conditionText const): Updated to use groupRule.
+ (WebCore::CSSSupportsRule::setConditionText): Added. Not implemented yet.
+
+ * css/CSSSupportsRule.h: Derive from CSSConditionRule.
+
+ * css/CSSSupportsRule.idl: Derive from CSSConditionRule.
+ Added [Exposed=Window].
+
+ * css/MediaList.cpp:
+ (WebCore::MediaQuerySet::set): Use move instead of swap.
+
+ * css/MediaList.idl: Added [Exposed=Window] and marked mediaText as
+ the stringifier.
+
+ * css/StyleRule.cpp:
+ (WebCore::StyleRule::create): Moved here from the header.
+ (WebCore::StyleRule::copy const): Ditto.
+ (WebCore::StyleRulePage::create): Ditto.
+ (WebCore::StyleRuleGroup::StyleRuleGroup): Use move instead of swap.
+ (WebCore::StyleRuleMedia::create): Use move instead of swap.
+ (WebCore::StyleRuleMedia::copy const): Moved out of the header.
+ (WebCore::StyleRuleSupports::StyleRuleSupports): Ditto.
+ (WebCore::StyleRuleSupports::create): Ditto.
+ (WebCore::StyleRuleNamespace::StyleRuleNamespace): Ditto.
+ (WebCore::StyleRuleNamespace::create): Ditto.
+
+ * css/StyleRule.h: Moved function bodies out of the class
+ defintiion for clarity.
+
+ * css/StyleSheet.idl: Added [Exposed=Window] and
+ [SameObject, PutForwards=mediaText] for media.
+
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::parserAppendRule): Updated since
+ mediaQueries returns a reference.
+
+ * css/StyleSheetList.idl: Added [Exposed=Window].
+
+ * css/parser/CSSParserImpl.cpp:
+ (WebCore::CSSParserImpl::consumeMediaRule): Use WTFMove since
+ the create function now takes an rvalue reference.
+ (WebCore::CSSParserImpl::consumeSupportsRule): Ditto.
+
+ * style/RuleSet.cpp:
+ (WebCore::Style::RuleSet::addChildRules): Updated since mediaQueries
+ returns a reference.
+ * style/UserAgentStyle.cpp:
+ (WebCore::Style::UserAgentStyle::addToDefaultStyle): Ditto.
+
2020-09-25 Peng Liu <[email protected]>
Clean up VideoLayerManagerObjC
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (267575 => 267576)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-09-25 17:19:48 UTC (rev 267576)
@@ -587,7 +587,9 @@
$(PROJECT_DIR)/crypto/parameters/RsaKeyGenParams.idl
$(PROJECT_DIR)/crypto/parameters/RsaOaepParams.idl
$(PROJECT_DIR)/crypto/parameters/RsaPssParams.idl
+$(PROJECT_DIR)/css/CSSConditionRule.idl
$(PROJECT_DIR)/css/CSSFontFaceRule.idl
+$(PROJECT_DIR)/css/CSSGroupingRule.idl
$(PROJECT_DIR)/css/CSSImportRule.idl
$(PROJECT_DIR)/css/CSSKeyframeRule.idl
$(PROJECT_DIR)/css/CSSKeyframesRule.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (267575 => 267576)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-09-25 17:19:48 UTC (rev 267576)
@@ -245,8 +245,12 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCDATASection.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSAnimation.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSAnimation.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSConditionRule.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSConditionRule.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSKeyframeRule.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (267575 => 267576)
--- trunk/Source/WebCore/DerivedSources.make 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/DerivedSources.make 2020-09-25 17:19:48 UTC (rev 267576)
@@ -642,7 +642,9 @@
$(WebCore)/crypto/parameters/RsaKeyGenParams.idl \
$(WebCore)/crypto/parameters/RsaOaepParams.idl \
$(WebCore)/crypto/parameters/RsaPssParams.idl \
+ $(WebCore)/css/CSSConditionRule.idl \
$(WebCore)/css/CSSFontFaceRule.idl \
+ $(WebCore)/css/CSSGroupingRule.idl \
$(WebCore)/css/CSSImportRule.idl \
$(WebCore)/css/CSSKeyframeRule.idl \
$(WebCore)/css/CSSKeyframesRule.idl \
Modified: trunk/Source/WebCore/Headers.cmake (267575 => 267576)
--- trunk/Source/WebCore/Headers.cmake 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/Headers.cmake 2020-09-25 17:19:48 UTC (rev 267576)
@@ -310,6 +310,7 @@
crypto/SerializedCryptoKeyWrap.h
css/CSSCalculationValue.h
+ css/CSSConditionRule.h
css/CSSCustomPropertyValue.h
css/CSSFontFaceRule.h
css/CSSFontFamily.h
Modified: trunk/Source/WebCore/Sources.txt (267575 => 267576)
--- trunk/Source/WebCore/Sources.txt 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/Sources.txt 2020-09-25 17:19:48 UTC (rev 267576)
@@ -663,6 +663,7 @@
css/CSSCalculationValue.cpp
css/CSSCanvasValue.cpp
css/CSSComputedStyleDeclaration.cpp
+css/CSSConditionRule.cpp
css/CSSContentDistributionValue.cpp
css/CSSCrossfadeValue.cpp
css/CSSCursorImageValue.cpp
@@ -2694,7 +2695,9 @@
JSByteLengthQueuingStrategy.cpp
JSCDATASection.cpp
JSCSSAnimation.cpp
+JSCSSConditionRule.cpp
JSCSSFontFaceRule.cpp
+JSCSSGroupingRule.cpp
JSCSSImportRule.cpp
JSCSSKeyframeRule.cpp
JSCSSKeyframesRule.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (267575 => 267576)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-09-25 17:19:48 UTC (rev 267576)
@@ -2652,6 +2652,9 @@
9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 9307F1D60AF2D59000DBA31A /* HitTestResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
930841341CDDB15500B0958C /* JSDOMConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 930841331CDDB15500B0958C /* JSDOMConvert.h */; settings = {ATTRIBUTES = (Private, ); }; };
930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 930908900AF7EDE40081DF01 /* HitTestRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 930AAC9A250EB8490013DA9F /* CSSConditionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AAC98250EB8170013DA9F /* CSSConditionRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 930AAC9F250ED4090013DA9F /* JSCSSConditionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */; };
+ 930AACA2250ED4110013DA9F /* JSCSSGroupingRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */; };
93153BDA14181F7A00FCF5BE /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 93153BD914181F7A00FCF5BE /* [email protected] */; };
93153BDC141959BC00FCF5BE /* textAreaResizeCorner.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */; };
93153BE214195A5700FCF5BE /* missingImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BE114195A5700FCF5BE /* missingImage.png */; };
@@ -11040,6 +11043,14 @@
9307F1D60AF2D59000DBA31A /* HitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestResult.h; sourceTree = "<group>"; };
930841331CDDB15500B0958C /* JSDOMConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConvert.h; sourceTree = "<group>"; };
930908900AF7EDE40081DF01 /* HitTestRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestRequest.h; sourceTree = "<group>"; };
+ 930AAC96250EB8170013DA9F /* CSSConditionRule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSConditionRule.cpp; sourceTree = "<group>"; };
+ 930AAC98250EB8170013DA9F /* CSSConditionRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSConditionRule.h; sourceTree = "<group>"; };
+ 930AAC99250EB8180013DA9F /* CSSConditionRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSConditionRule.idl; sourceTree = "<group>"; };
+ 930AAC9B250EC2F30013DA9F /* CSSGroupingRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSGroupingRule.idl; sourceTree = "<group>"; };
+ 930AAC9C250ED4080013DA9F /* JSCSSConditionRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSConditionRule.cpp; sourceTree = "<group>"; };
+ 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSConditionRule.h; sourceTree = "<group>"; };
+ 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSGroupingRule.h; sourceTree = "<group>"; };
+ 930AACA1250ED4110013DA9F /* JSCSSGroupingRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSGroupingRule.cpp; sourceTree = "<group>"; };
930C90DC19CF965300D6C21A /* InlineIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIterator.cpp; sourceTree = "<group>"; };
93153BD914181F7A00FCF5BE /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = textAreaResizeCorner.png; sourceTree = "<group>"; };
@@ -24836,8 +24847,12 @@
A83B790E0CCAFF97000B0825 /* CSS */ = {
isa = PBXGroup;
children = (
+ 930AAC9C250ED4080013DA9F /* JSCSSConditionRule.cpp */,
+ 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */,
BC46C1F20C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp */,
BC46C1F30C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h */,
+ 930AACA1250ED4110013DA9F /* JSCSSGroupingRule.cpp */,
+ 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */,
BC46C1F40C0DDC8F0020CFC3 /* JSCSSImportRule.cpp */,
BC46C1F50C0DDC8F0020CFC3 /* JSCSSImportRule.h */,
316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */,
@@ -28577,6 +28592,9 @@
BC6049CB0DB560C200204739 /* CSSCanvasValue.h */,
BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */,
BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */,
+ 930AAC96250EB8170013DA9F /* CSSConditionRule.cpp */,
+ 930AAC98250EB8170013DA9F /* CSSConditionRule.h */,
+ 930AAC99250EB8180013DA9F /* CSSConditionRule.idl */,
9DAC7C521AF2CAA100437C44 /* CSSContentDistributionValue.cpp */,
9DAC7C531AF2CAA100437C44 /* CSSContentDistributionValue.h */,
2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */,
@@ -28627,6 +28645,7 @@
CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */,
FBF89044169E9F1F0052D86E /* CSSGroupingRule.cpp */,
FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */,
+ 930AAC9B250EC2F30013DA9F /* CSSGroupingRule.idl */,
BC772B360C4EA91E0083285F /* CSSHelper.h */,
BC23E76B0DAE88A9009FDC91 /* CSSImageGeneratorValue.cpp */,
BC23EE910DAED2BC009FDC91 /* CSSImageGeneratorValue.h */,
@@ -30865,6 +30884,7 @@
49AE2D8F134EE50C0072920A /* CSSCalculationValue.h in Headers */,
BC6049CC0DB560C200204739 /* CSSCanvasValue.h in Headers */,
BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */,
+ 930AAC9A250EB8490013DA9F /* CSSConditionRule.h in Headers */,
9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */,
2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */,
@@ -31973,7 +31993,9 @@
7C9ACAC01F3CF1AF00F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h in Headers */,
7C9ACAC21F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.h in Headers */,
71B28427203CEC4C0036AA5D /* JSCSSAnimation.h in Headers */,
+ 930AAC9F250ED4090013DA9F /* JSCSSConditionRule.h in Headers */,
BC46C1FD0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h in Headers */,
+ 930AACA2250ED4110013DA9F /* JSCSSGroupingRule.h in Headers */,
BC46C1FF0C0DDC8F0020CFC3 /* JSCSSImportRule.h in Headers */,
316FE0720E6CCBEE00BF6088 /* JSCSSKeyframeRule.h in Headers */,
316FE0740E6CCBEE00BF6088 /* JSCSSKeyframesRule.h in Headers */,
Added: trunk/Source/WebCore/css/CSSConditionRule.cpp (0 => 267576)
--- trunk/Source/WebCore/css/CSSConditionRule.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSConditionRule.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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.
+ */
+
+#include "config.h"
+#include "CSSConditionRule.h"
+
+namespace WebCore {
+
+CSSConditionRule::CSSConditionRule(StyleRuleGroup& group, CSSStyleSheet* parent)
+ : CSSGroupingRule(group, parent)
+{
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSConditionRule.h (0 => 267576)
--- trunk/Source/WebCore/css/CSSConditionRule.h (rev 0)
+++ trunk/Source/WebCore/css/CSSConditionRule.h 2020-09-25 17:19:48 UTC (rev 267576)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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
+
+#include "CSSGroupingRule.h"
+
+namespace WebCore {
+
+class CSSConditionRule : public CSSGroupingRule {
+public:
+ virtual String conditionText() const = 0;
+ virtual void setConditionText(const String&) = 0;
+
+protected:
+ CSSConditionRule(StyleRuleGroup&, CSSStyleSheet* parent);
+};
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSConditionRule.idl (0 => 267576)
--- trunk/Source/WebCore/css/CSSConditionRule.idl (rev 0)
+++ trunk/Source/WebCore/css/CSSConditionRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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.
+ */
+
+typedef USVString CSSOMString;
+
+[Exposed=Window] interface CSSConditionRule : CSSGroupingRule {
+ attribute CSSOMString conditionText;
+};
Modified: trunk/Source/WebCore/css/CSSGroupingRule.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/CSSGroupingRule.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSGroupingRule.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "CSSGroupingRule.h"
#include "CSSParser.h"
@@ -50,9 +49,9 @@
CSSGroupingRule::~CSSGroupingRule()
{
ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
- for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {
- if (m_childRuleCSSOMWrappers[i])
- m_childRuleCSSOMWrappers[i]->setParentRule(0);
+ for (auto& wrapper : m_childRuleCSSOMWrappers) {
+ if (wrapper)
+ wrapper->setParentRule(nullptr);
}
}
@@ -111,14 +110,10 @@
return { };
}
-void CSSGroupingRule::appendCssTextForItems(StringBuilder& result) const
+void CSSGroupingRule::appendCSSTextForItems(StringBuilder& result) const
{
- unsigned size = length();
- for (unsigned i = 0; i < size; ++i) {
- result.appendLiteral(" ");
- result.append(item(i)->cssText());
- result.append('\n');
- }
+ for (unsigned i = 0, size = length(); i < size; ++i)
+ result.append(" ", item(i)->cssText(), '\n');
}
unsigned CSSGroupingRule::length() const
@@ -131,7 +126,7 @@
if (index >= length())
return nullptr;
ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
- RefPtr<CSSRule>& rule = m_childRuleCSSOMWrappers[index];
+ auto& rule = m_childRuleCSSOMWrappers[index];
if (!rule)
rule = m_groupRule->childRules()[index]->createCSSOMWrapper(const_cast<CSSGroupingRule*>(this));
return rule.get();
Modified: trunk/Source/WebCore/css/CSSGroupingRule.h (267575 => 267576)
--- trunk/Source/WebCore/css/CSSGroupingRule.h 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSGroupingRule.h 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll ([email protected])
* (C) 2002-2003 Dirk Mueller ([email protected])
- * Copyright (C) 2002, 2006, 2008, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2002-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -36,24 +36,19 @@
virtual ~CSSGroupingRule();
WEBCORE_EXPORT CSSRuleList& cssRules() const;
-
WEBCORE_EXPORT ExceptionOr<unsigned> insertRule(const String& rule, unsigned index);
WEBCORE_EXPORT ExceptionOr<void> deleteRule(unsigned index);
-
- // For CSSRuleList
unsigned length() const;
CSSRule* item(unsigned index) const;
protected:
- CSSGroupingRule(StyleRuleGroup& groupRule, CSSStyleSheet* parent);
-
+ CSSGroupingRule(StyleRuleGroup&, CSSStyleSheet* parent);
+ const StyleRuleGroup& groupRule() const { return m_groupRule; }
void reattach(StyleRuleBase&) override;
+ void appendCSSTextForItems(StringBuilder&) const;
- void appendCssTextForItems(StringBuilder&) const;
-
+private:
Ref<StyleRuleGroup> m_groupRule;
-
-private:
mutable Vector<RefPtr<CSSRule>> m_childRuleCSSOMWrappers;
mutable std::unique_ptr<CSSRuleList> m_ruleListCSSOMWrapper;
};
Added: trunk/Source/WebCore/css/CSSGroupingRule.idl (0 => 267576)
--- trunk/Source/WebCore/css/CSSGroupingRule.idl (rev 0)
+++ trunk/Source/WebCore/css/CSSGroupingRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2020 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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.
+ */
+
+typedef USVString CSSOMString;
+
+[Exposed=Window]
+interface CSSGroupingRule : CSSRule {
+ [SameObject] readonly attribute CSSRuleList cssRules;
+ [MayThrowException] unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
+ [MayThrowException] undefined deleteRule(unsigned long index);
+};
Modified: trunk/Source/WebCore/css/CSSImportRule.idl (267575 => 267576)
--- trunk/Source/WebCore/css/CSSImportRule.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSImportRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -18,10 +18,10 @@
* Boston, MA 02110-1301, USA.
*/
-// Introduced in DOM Level 2:
+[Exposed=Window]
interface CSSImportRule : CSSRule {
- readonly attribute DOMString? href;
- readonly attribute MediaList media;
- readonly attribute CSSStyleSheet styleSheet;
+ readonly attribute USVString href;
+ [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
+ [SameObject] readonly attribute CSSStyleSheet styleSheet;
};
Modified: trunk/Source/WebCore/css/CSSMediaRule.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/CSSMediaRule.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSMediaRule.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,7 +1,7 @@
/**
* (C) 1999-2003 Lars Knoll ([email protected])
* (C) 2002-2003 Dirk Mueller ([email protected])
- * Copyright (C) 2002, 2005, 2006, 2012 Apple Inc.
+ * Copyright (C) 2002-2020 Apple Inc.
* Copyright (C) 2006 Samuel Weinig ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@
namespace WebCore {
CSSMediaRule::CSSMediaRule(StyleRuleMedia& mediaRule, CSSStyleSheet* parent)
- : CSSGroupingRule(mediaRule, parent)
+ : CSSConditionRule(mediaRule, parent)
{
}
@@ -41,38 +41,42 @@
m_mediaCSSOMWrapper->clearParentRule();
}
-MediaQuerySet* CSSMediaRule::mediaQueries() const
+MediaQuerySet& CSSMediaRule::mediaQueries() const
{
- return downcast<StyleRuleMedia>(m_groupRule.get()).mediaQueries();
+ return downcast<StyleRuleMedia>(groupRule()).mediaQueries();
}
String CSSMediaRule::cssText() const
{
StringBuilder result;
- result.appendLiteral("@media ");
- if (mediaQueries()) {
- result.append(mediaQueries()->mediaText(), ' ');
- }
- result.appendLiteral("{ \n");
- appendCssTextForItems(result);
+ result.append("@media ", conditionText(), " { \n");
+ appendCSSTextForItems(result);
result.append('}');
return result.toString();
}
+String CSSMediaRule::conditionText() const
+{
+ return mediaQueries().mediaText();
+}
+
+void CSSMediaRule::setConditionText(const String& text)
+{
+ mediaQueries().set(text);
+}
+
MediaList* CSSMediaRule::media() const
{
- if (!mediaQueries())
- return nullptr;
if (!m_mediaCSSOMWrapper)
- m_mediaCSSOMWrapper = MediaList::create(mediaQueries(), const_cast<CSSMediaRule*>(this));
+ m_mediaCSSOMWrapper = MediaList::create(&mediaQueries(), const_cast<CSSMediaRule*>(this));
return m_mediaCSSOMWrapper.get();
}
void CSSMediaRule::reattach(StyleRuleBase& rule)
{
- CSSGroupingRule::reattach(rule);
- if (m_mediaCSSOMWrapper && mediaQueries())
- m_mediaCSSOMWrapper->reattach(mediaQueries());
+ CSSConditionRule::reattach(rule);
+ if (m_mediaCSSOMWrapper)
+ m_mediaCSSOMWrapper->reattach(&mediaQueries());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSMediaRule.h (267575 => 267576)
--- trunk/Source/WebCore/css/CSSMediaRule.h 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSMediaRule.h 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll ([email protected])
* (C) 2002-2003 Dirk Mueller ([email protected])
- * Copyright (C) 2002, 2006, 2008, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2002-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
#pragma once
-#include "CSSGroupingRule.h"
+#include "CSSConditionRule.h"
namespace WebCore {
@@ -30,10 +30,9 @@
class MediaQuerySet;
class StyleRuleMedia;
-class CSSMediaRule final : public CSSGroupingRule {
+class CSSMediaRule final : public CSSConditionRule {
public:
static Ref<CSSMediaRule> create(StyleRuleMedia& rule, CSSStyleSheet* sheet) { return adoptRef(*new CSSMediaRule(rule, sheet)); }
-
virtual ~CSSMediaRule();
WEBCORE_EXPORT MediaList* media() const;
@@ -44,9 +43,11 @@
CSSRule::Type type() const final { return MEDIA_RULE; }
void reattach(StyleRuleBase&) final;
String cssText() const final;
+ String conditionText() const final;
+ void setConditionText(const String&) final;
- MediaQuerySet* mediaQueries() const;
-
+ MediaQuerySet& mediaQueries() const;
+
mutable RefPtr<MediaList> m_mediaCSSOMWrapper;
};
Modified: trunk/Source/WebCore/css/CSSMediaRule.idl (267575 => 267576)
--- trunk/Source/WebCore/css/CSSMediaRule.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSMediaRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -18,10 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-interface CSSMediaRule : CSSRule {
- readonly attribute MediaList media;
- readonly attribute CSSRuleList cssRules;
-
- [MayThrowException] unsigned long insertRule(optional DOMString rule = "undefined", optional unsigned long index = 0);
- [MayThrowException] undefined deleteRule(optional unsigned long index = 0);
+[Exposed=Window]
+interface CSSMediaRule : CSSConditionRule {
+ [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
};
Modified: trunk/Source/WebCore/css/CSSRule.h (267575 => 267576)
--- trunk/Source/WebCore/css/CSSRule.h 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSRule.h 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll ([email protected])
* (C) 2002-2003 Dirk Mueller ([email protected])
- * Copyright (C) 2002, 2006, 2007, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2002-2020 Apple Inc. All rights reserved.
* Copyright (C) 2011 Andreas Kling ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -44,18 +44,16 @@
MEDIA_RULE,
FONT_FACE_RULE,
PAGE_RULE,
- // 7 was VARIABLES_RULE; we now match other browsers with 7 as
- // KEYFRAMES_RULE:
- // <https://bugs.webkit.org/show_bug.cgi?id=71293>.
KEYFRAMES_RULE,
KEYFRAME_RULE,
- NAMESPACE_RULE = 10, // Matches other browsers.
+ MARGIN_RULE,
+ NAMESPACE_RULE,
SUPPORTS_RULE = 12,
};
enum DeprecatedType {
- WEBKIT_KEYFRAMES_RULE = 7,
- WEBKIT_KEYFRAME_RULE = 8
+ WEBKIT_KEYFRAMES_RULE = KEYFRAMES_RULE,
+ WEBKIT_KEYFRAME_RULE = KEYFRAME_RULE
};
virtual Type type() const = 0;
@@ -62,36 +60,15 @@
virtual String cssText() const = 0;
virtual void reattach(StyleRuleBase&) = 0;
- void setParentStyleSheet(CSSStyleSheet* styleSheet)
- {
- m_parentIsRule = false;
- m_parentStyleSheet = styleSheet;
- }
+ void setParentStyleSheet(CSSStyleSheet*);
+ void setParentRule(CSSRule*);
+ CSSStyleSheet* parentStyleSheet() const;
+ CSSRule* parentRule() const { return m_parentIsRule ? m_parentRule : nullptr; }
- void setParentRule(CSSRule* rule)
- {
- m_parentIsRule = true;
- m_parentRule = rule;
- }
-
- CSSStyleSheet* parentStyleSheet() const
- {
- if (m_parentIsRule)
- return m_parentRule ? m_parentRule->parentStyleSheet() : 0;
- return m_parentStyleSheet;
- }
-
- CSSRule* parentRule() const { return m_parentIsRule ? m_parentRule : 0; }
-
WEBCORE_EXPORT ExceptionOr<void> setCssText(const String&);
protected:
- CSSRule(CSSStyleSheet* parent)
- : m_hasCachedSelectorText(false)
- , m_parentIsRule(false)
- , m_parentStyleSheet(parent)
- {
- }
+ explicit CSSRule(CSSStyleSheet*);
bool hasCachedSelectorText() const { return m_hasCachedSelectorText; }
void setHasCachedSelectorText(bool hasCachedSelectorText) const { m_hasCachedSelectorText = hasCachedSelectorText; }
@@ -101,7 +78,6 @@
private:
mutable unsigned char m_hasCachedSelectorText : 1;
unsigned char m_parentIsRule : 1;
-
union {
CSSRule* m_parentRule;
CSSStyleSheet* m_parentStyleSheet;
@@ -108,6 +84,32 @@
};
};
+inline CSSRule::CSSRule(CSSStyleSheet* parent)
+ : m_hasCachedSelectorText(false)
+ , m_parentIsRule(false)
+ , m_parentStyleSheet(parent)
+{
+}
+
+inline void CSSRule::setParentStyleSheet(CSSStyleSheet* styleSheet)
+{
+ m_parentIsRule = false;
+ m_parentStyleSheet = styleSheet;
+}
+
+inline void CSSRule::setParentRule(CSSRule* rule)
+{
+ m_parentIsRule = true;
+ m_parentRule = rule;
+}
+
+inline CSSStyleSheet* CSSRule::parentStyleSheet() const
+{
+ if (m_parentIsRule)
+ return m_parentRule ? m_parentRule->parentStyleSheet() : nullptr;
+ return m_parentStyleSheet;
+}
+
} // namespace WebCore
#define SPECIALIZE_TYPE_TRAITS_CSS_RULE(ToValueTypeName, predicate) \
Modified: trunk/Source/WebCore/css/CSSRule.idl (267575 => 267576)
--- trunk/Source/WebCore/css/CSSRule.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -21,11 +21,16 @@
[
CustomToJSObject,
ExportToWrappedFunction,
+ Exposed=Window,
GenerateIsReachable,
JSCustomHeader,
JSCustomMarkFunction,
] interface CSSRule {
- // RuleType
+ attribute DOMString? cssText;
+ readonly attribute CSSRule? parentRule;
+ readonly attribute CSSStyleSheet? parentStyleSheet;
+
+ readonly attribute unsigned short type;
const unsigned short UNKNOWN_RULE = 0;
const unsigned short STYLE_RULE = 1;
const unsigned short CHARSET_RULE = 2;
@@ -35,6 +40,7 @@
const unsigned short PAGE_RULE = 6;
const unsigned short KEYFRAMES_RULE = 7;
const unsigned short KEYFRAME_RULE = 8;
+ const unsigned short MARGIN_RULE = 9;
const unsigned short NAMESPACE_RULE = 10;
const unsigned short SUPPORTS_RULE = 12;
@@ -41,11 +47,4 @@
// Legacy synonyms for the above, kept to avoid breaking existing content.
const unsigned short WEBKIT_KEYFRAMES_RULE = 7;
const unsigned short WEBKIT_KEYFRAME_RULE = 8;
-
- readonly attribute unsigned short type;
-
- attribute DOMString? cssText;
-
- readonly attribute CSSStyleSheet? parentStyleSheet;
- readonly attribute CSSRule? parentRule;
};
Modified: trunk/Source/WebCore/css/CSSStyleRule.idl (267575 => 267576)
--- trunk/Source/WebCore/css/CSSStyleRule.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSStyleRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -18,10 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-// Introduced in DOM Level 2:
+[Exposed=Window]
interface CSSStyleRule : CSSRule {
attribute DOMString? selectorText;
-
- [PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
+ [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};
-
Modified: trunk/Source/WebCore/css/CSSStyleSheet.idl (267575 => 267576)
--- trunk/Source/WebCore/css/CSSStyleSheet.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSStyleSheet.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -18,17 +18,14 @@
* Boston, MA 02110-1301, USA.
*/
+[Exposed=Window]
interface CSSStyleSheet : StyleSheet {
readonly attribute CSSRule ownerRule;
readonly attribute CSSRuleList cssRules;
-
[MayThrowException] unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
-
[MayThrowException] undefined deleteRule(unsigned long index);
readonly attribute CSSRuleList rules;
-
- // The following two operations are WebKit-specific.
[MayThrowException] long addRule(optional DOMString selector = "undefined", optional DOMString style = "undefined", optional unsigned long index);
[MayThrowException] undefined removeRule(optional unsigned long index = 0);
};
Modified: trunk/Source/WebCore/css/CSSSupportsRule.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/CSSSupportsRule.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSSupportsRule.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,4 +1,6 @@
-/* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
+/*
+ * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
+ * Copyright (C) 2020 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
@@ -35,27 +37,33 @@
namespace WebCore {
-CSSSupportsRule::CSSSupportsRule(StyleRuleSupports& supportsRule, CSSStyleSheet* parent)
- : CSSGroupingRule(supportsRule, parent)
+CSSSupportsRule::CSSSupportsRule(StyleRuleSupports& rule, CSSStyleSheet* parent)
+ : CSSConditionRule(rule, parent)
{
}
+Ref<CSSSupportsRule> CSSSupportsRule::create(StyleRuleSupports& rule, CSSStyleSheet* parent)
+{
+ return adoptRef(*new CSSSupportsRule(rule, parent));
+}
+
String CSSSupportsRule::cssText() const
{
StringBuilder result;
-
- result.appendLiteral("@supports ");
- result.append(conditionText());
- result.appendLiteral(" {\n");
- appendCssTextForItems(result);
+ result.append("@supports ", conditionText(), " {\n");
+ appendCSSTextForItems(result);
result.append('}');
-
return result.toString();
}
String CSSSupportsRule::conditionText() const
{
- return downcast<StyleRuleSupports>(m_groupRule.get()).conditionText();
+ return downcast<StyleRuleSupports>(groupRule()).conditionText();
}
+void CSSSupportsRule::setConditionText(const String&)
+{
+ // FIXME: Not implemented yet.
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSSupportsRule.h (267575 => 267576)
--- trunk/Source/WebCore/css/CSSSupportsRule.h 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSSupportsRule.h 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,4 +1,6 @@
-/* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
+/*
+ * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
+ * Copyright (C) 2020 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
@@ -28,7 +30,7 @@
#pragma once
-#include "CSSGroupingRule.h"
+#include "CSSConditionRule.h"
namespace WebCore {
@@ -35,22 +37,16 @@
class CSSRule;
class StyleRuleSupports;
-class CSSSupportsRule final : public CSSGroupingRule {
+class CSSSupportsRule final : public CSSConditionRule {
public:
- static Ref<CSSSupportsRule> create(StyleRuleSupports& rule, CSSStyleSheet* sheet)
- {
- return adoptRef(*new CSSSupportsRule(rule, sheet));
- }
+ static Ref<CSSSupportsRule> create(StyleRuleSupports&, CSSStyleSheet* parent);
- virtual ~CSSSupportsRule() = default;
-
String cssText() const final;
+ String conditionText() const final;
+ void setConditionText(const String&) final;
- String conditionText() const;
-
private:
CSSSupportsRule(StyleRuleSupports&, CSSStyleSheet*);
-
CSSRule::Type type() const final { return SUPPORTS_RULE; }
};
Modified: trunk/Source/WebCore/css/CSSSupportsRule.idl (267575 => 267576)
--- trunk/Source/WebCore/css/CSSSupportsRule.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/CSSSupportsRule.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,4 +1,6 @@
-/* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
+/*
+ * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
+ * Copyright (C) 2020 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
@@ -26,10 +28,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-interface CSSSupportsRule : CSSRule {
- readonly attribute CSSRuleList cssRules;
- readonly attribute DOMString conditionText;
-
- [MayThrowException] unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
- [MayThrowException] undefined deleteRule(unsigned long index);
+[Exposed=Window]
+interface CSSSupportsRule : CSSConditionRule {
};
Modified: trunk/Source/WebCore/css/MediaList.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/MediaList.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/MediaList.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll ([email protected])
- * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2020 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -82,7 +82,7 @@
bool MediaQuerySet::set(const String& mediaString)
{
auto result = create(mediaString);
- m_queries.swap(result->m_queries);
+ m_queries = WTFMove(result->m_queries);
return true;
}
Modified: trunk/Source/WebCore/css/MediaList.idl (267575 => 267576)
--- trunk/Source/WebCore/css/MediaList.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/MediaList.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,11 +25,12 @@
[
ExportToWrappedFunction,
+ Exposed=Window,
GenerateIsReachable,
ImplementationLacksVTable,
JSCustomHeader,
] interface MediaList {
- attribute [LegacyNullToEmptyString] DOMString mediaText;
+ stringifier attribute [LegacyNullToEmptyString] DOMString mediaText;
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
Modified: trunk/Source/WebCore/css/StyleRule.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/StyleRule.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/StyleRule.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll ([email protected])
* (C) 2002-2003 Dirk Mueller ([email protected])
- * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2002-2020 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -187,6 +187,16 @@
StyleRule::~StyleRule() = default;
+Ref<StyleRule> StyleRule::create(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
+{
+ return adoptRef(*new StyleRule(WTFMove(properties), hasDocumentSecurityOrigin, WTFMove(selectors)));
+}
+
+Ref<StyleRule> StyleRule::copy() const
+{
+ return adoptRef(*new StyleRule(*this));
+}
+
const StyleProperties& StyleRule::properties() const
{
if (m_properties->type() == DeferredPropertiesType)
@@ -253,6 +263,11 @@
StyleRulePage::~StyleRulePage() = default;
+Ref<StyleRulePage> StyleRulePage::create(Ref<StyleProperties>&& properties, CSSSelectorList&& selectors)
+{
+ return adoptRef(*new StyleRulePage(WTFMove(properties), WTFMove(selectors)));
+}
+
MutableStyleProperties& StyleRulePage::mutableProperties()
{
if (!is<MutableStyleProperties>(m_properties.get()))
@@ -299,15 +314,15 @@
m_parser->parseKeyframeList(m_tokens, keyframesRule);
}
-StyleRuleGroup::StyleRuleGroup(StyleRuleType type, Vector<RefPtr<StyleRuleBase>>& adoptRule)
+StyleRuleGroup::StyleRuleGroup(StyleRuleType type, Vector<RefPtr<StyleRuleBase>>&& rules)
: StyleRuleBase(type)
+ , m_childRules(WTFMove(rules))
{
- m_childRules.swap(adoptRule);
}
-StyleRuleGroup::StyleRuleGroup(StyleRuleType type, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
+StyleRuleGroup::StyleRuleGroup(StyleRuleType type, std::unique_ptr<DeferredStyleGroupRuleList>&& rules)
: StyleRuleBase(type)
- , m_deferredRules(WTFMove(deferredRules))
+ , m_deferredRules(WTFMove(rules))
{
}
@@ -346,35 +361,48 @@
m_deferredRules = nullptr;
}
-StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
- : StyleRuleGroup(StyleRuleType::Media, adoptRules)
+StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>&& rules)
+ : StyleRuleGroup(StyleRuleType::Media, WTFMove(rules))
, m_mediaQueries(WTFMove(media))
{
}
-StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
- : StyleRuleGroup(StyleRuleType::Media, WTFMove(deferredRules))
+StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& rules)
+ : StyleRuleGroup(StyleRuleType::Media, WTFMove(rules))
, m_mediaQueries(WTFMove(media))
{
}
-StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o)
- : StyleRuleGroup(o)
+StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& other)
+ : StyleRuleGroup(other)
+ , m_mediaQueries(other.m_mediaQueries->copy())
{
- if (o.m_mediaQueries)
- m_mediaQueries = o.m_mediaQueries->copy();
}
+Ref<StyleRuleMedia> StyleRuleMedia::create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>&& rules)
+{
+ return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(rules)));
+}
-StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules)
- : StyleRuleGroup(StyleRuleType::Supports, adoptRules)
+Ref<StyleRuleMedia> StyleRuleMedia::create(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules)
+{
+ return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(deferredChildRules)));
+}
+
+Ref<StyleRuleMedia> StyleRuleMedia::copy() const
+{
+ return adoptRef(*new StyleRuleMedia(*this));
+}
+
+StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&& rules)
+ : StyleRuleGroup(StyleRuleType::Supports, WTFMove(rules))
, m_conditionText(conditionText)
, m_conditionIsSupported(conditionIsSupported)
{
}
-StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
- : StyleRuleGroup(StyleRuleType::Supports, WTFMove(deferredRules))
+StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& rules)
+ : StyleRuleGroup(StyleRuleType::Supports, WTFMove(rules))
, m_conditionText(conditionText)
, m_conditionIsSupported(conditionIsSupported)
{
@@ -387,6 +415,16 @@
{
}
+Ref<StyleRuleSupports> StyleRuleSupports::create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&& rules)
+{
+ return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(rules)));
+}
+
+Ref<StyleRuleSupports> StyleRuleSupports::create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& rules)
+{
+ return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(rules)));
+}
+
StyleRuleCharset::StyleRuleCharset()
: StyleRuleBase(StyleRuleType::Charset)
{
@@ -397,9 +435,7 @@
{
}
-StyleRuleCharset::~StyleRuleCharset() = default;
-
-StyleRuleNamespace::StyleRuleNamespace(AtomString prefix, AtomString uri)
+StyleRuleNamespace::StyleRuleNamespace(const AtomString& prefix, const AtomString& uri)
: StyleRuleBase(StyleRuleType::Namespace)
, m_prefix(prefix)
, m_uri(uri)
@@ -415,4 +451,9 @@
StyleRuleNamespace::~StyleRuleNamespace() = default;
+Ref<StyleRuleNamespace> StyleRuleNamespace::create(const AtomString& prefix, const AtomString& uri)
+{
+ return adoptRef(*new StyleRuleNamespace(prefix, uri));
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/StyleRule.h (267575 => 267576)
--- trunk/Source/WebCore/css/StyleRule.h 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/StyleRule.h 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll ([email protected])
* (C) 2002-2003 Dirk Mueller ([email protected])
- * Copyright (C) 2002, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2002-2020 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -59,11 +59,7 @@
Ref<StyleRuleBase> copy() const;
- void deref() const
- {
- if (derefBase())
- const_cast<StyleRuleBase&>(*this).destroy();
- }
+ void deref() const;
// FIXME: There shouldn't be any need for the null parent version.
Ref<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = nullptr) const;
@@ -70,19 +66,8 @@
Ref<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const;
protected:
- StyleRuleBase(StyleRuleType type, bool hasDocumentSecurityOrigin = false)
- : m_type(static_cast<unsigned>(type))
- , m_hasDocumentSecurityOrigin(hasDocumentSecurityOrigin)
- {
- }
-
- StyleRuleBase(const StyleRuleBase& o)
- : WTF::RefCountedBase()
- , m_type(o.m_type)
- , m_hasDocumentSecurityOrigin(o.m_hasDocumentSecurityOrigin)
- {
- }
-
+ explicit StyleRuleBase(StyleRuleType, bool hasDocumentSecurityOrigin = false);
+ StyleRuleBase(const StyleRuleBase&);
~StyleRuleBase() = default;
bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; }
@@ -101,15 +86,12 @@
class StyleRule final : public StyleRuleBase {
WTF_MAKE_STRUCT_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(StyleRule);
public:
- static Ref<StyleRule> create(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
- {
- return adoptRef(*new StyleRule(WTFMove(properties), hasDocumentSecurityOrigin, WTFMove(selectors)));
- }
-
+ static Ref<StyleRule> create(Ref<StylePropertiesBase>&&, bool hasDocumentSecurityOrigin, CSSSelectorList&&);
+ Ref<StyleRule> copy() const;
~StyleRule();
const CSSSelectorList& selectorList() const { return m_selectorList; }
-
+
const StyleProperties& properties() const;
MutableStyleProperties& mutableProperties();
const StyleProperties* propertiesWithoutDeferredParsing() const;
@@ -116,29 +98,13 @@
using StyleRuleBase::hasDocumentSecurityOrigin;
- void wrapperAdoptSelectorList(CSSSelectorList&& selectors)
- {
- m_selectorList = WTFMove(selectors);
-#if ENABLE(CSS_SELECTOR_JIT)
- m_compiledSelectors = nullptr;
-#endif
- }
+ void wrapperAdoptSelectorList(CSSSelectorList&&);
- Ref<StyleRule> copy() const { return adoptRef(*new StyleRule(*this)); }
-
Vector<RefPtr<StyleRule>> splitIntoMultipleRulesWithMaximumSelectorComponentCount(unsigned) const;
#if ENABLE(CSS_SELECTOR_JIT)
- CompiledSelector& compiledSelectorForListIndex(unsigned index) const
- {
- if (!m_compiledSelectors)
- m_compiledSelectors = makeUniqueArray<CompiledSelector>(m_selectorList.listSize());
- return m_compiledSelectors[index];
- }
- void releaseCompiledSelectors() const
- {
- m_compiledSelectors = nullptr;
- }
+ CompiledSelector& compiledSelectorForListIndex(unsigned index) const;
+ void releaseCompiledSelectors() const { m_compiledSelectors = nullptr; }
#endif
static unsigned averageSizeInBytes();
@@ -157,11 +123,6 @@
#endif
};
-inline const StyleProperties* StyleRule::propertiesWithoutDeferredParsing() const
-{
- return m_properties->type() != DeferredPropertiesType ? &downcast<StyleProperties>(m_properties.get()) : nullptr;
-}
-
class StyleRuleFontFace final : public StyleRuleBase {
public:
static Ref<StyleRuleFontFace> create(Ref<StyleProperties>&& properties) { return adoptRef(*new StyleRuleFontFace(WTFMove(properties))); }
@@ -182,7 +143,7 @@
class StyleRulePage final : public StyleRuleBase {
public:
- static Ref<StyleRulePage> create(Ref<StyleProperties>&& properties, CSSSelectorList&& selectors) { return adoptRef(*new StyleRulePage(WTFMove(properties), WTFMove(selectors))); }
+ static Ref<StyleRulePage> create(Ref<StyleProperties>&&, CSSSelectorList&&);
~StyleRulePage();
@@ -224,7 +185,7 @@
void wrapperRemoveRule(unsigned);
protected:
- StyleRuleGroup(StyleRuleType, Vector<RefPtr<StyleRuleBase>>&);
+ StyleRuleGroup(StyleRuleType, Vector<RefPtr<StyleRuleBase>>&&);
StyleRuleGroup(StyleRuleType, std::unique_ptr<DeferredStyleGroupRuleList>&&);
StyleRuleGroup(const StyleRuleGroup&);
@@ -235,55 +196,34 @@
mutable std::unique_ptr<DeferredStyleGroupRuleList> m_deferredRules;
};
-inline const Vector<RefPtr<StyleRuleBase>>* StyleRuleGroup::childRulesWithoutDeferredParsing() const
-{
- return !m_deferredRules ? &m_childRules : nullptr;
-}
-
class StyleRuleMedia final : public StyleRuleGroup {
public:
- static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
- {
- return adoptRef(*new StyleRuleMedia(WTFMove(media), adoptRules));
- }
+ static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>&&);
+ static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&&, std::unique_ptr<DeferredStyleGroupRuleList>&&);
+ Ref<StyleRuleMedia> copy() const;
- static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules)
- {
- return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(deferredChildRules)));
- }
+ MediaQuerySet& mediaQueries() const { return m_mediaQueries; }
- MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
-
- Ref<StyleRuleMedia> copy() const { return adoptRef(*new StyleRuleMedia(*this)); }
-
private:
- StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>& adoptRules);
+ StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>&&);
StyleRuleMedia(Ref<MediaQuerySet>&&, std::unique_ptr<DeferredStyleGroupRuleList>&&);
StyleRuleMedia(const StyleRuleMedia&);
- RefPtr<MediaQuerySet> m_mediaQueries;
+ Ref<MediaQuerySet> m_mediaQueries;
};
class StyleRuleSupports final : public StyleRuleGroup {
public:
- static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules)
- {
- return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
- }
-
- static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules)
- {
- return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(deferredChildRules)));
- }
+ static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&&);
+ static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&&);
+ Ref<StyleRuleSupports> copy() const { return adoptRef(*new StyleRuleSupports(*this)); }
String conditionText() const { return m_conditionText; }
bool conditionIsSupported() const { return m_conditionIsSupported; }
- Ref<StyleRuleSupports> copy() const { return adoptRef(*new StyleRuleSupports(*this)); }
private:
- StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules);
+ StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&&);
StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&&);
-
StyleRuleSupports(const StyleRuleSupports&);
String m_conditionText;
@@ -293,23 +233,17 @@
// This is only used by the CSS parser.
class StyleRuleCharset final : public StyleRuleBase {
public:
- static Ref<StyleRuleCharset> create() { return adoptRef(*new StyleRuleCharset()); }
-
- ~StyleRuleCharset();
-
+ static Ref<StyleRuleCharset> create() { return adoptRef(*new StyleRuleCharset); }
Ref<StyleRuleCharset> copy() const { return adoptRef(*new StyleRuleCharset(*this)); }
private:
- explicit StyleRuleCharset();
+ StyleRuleCharset();
StyleRuleCharset(const StyleRuleCharset&);
};
class StyleRuleNamespace final : public StyleRuleBase {
public:
- static Ref<StyleRuleNamespace> create(AtomString prefix, AtomString uri)
- {
- return adoptRef(*new StyleRuleNamespace(prefix, uri));
- }
+ static Ref<StyleRuleNamespace> create(const AtomString& prefix, const AtomString& uri);
~StyleRuleNamespace();
@@ -319,13 +253,61 @@
AtomString uri() const { return m_uri; }
private:
- StyleRuleNamespace(AtomString prefix, AtomString uri);
+ StyleRuleNamespace(const AtomString& prefix, const AtomString& uri);
StyleRuleNamespace(const StyleRuleNamespace&);
-
+
AtomString m_prefix;
AtomString m_uri;
};
+inline StyleRuleBase::StyleRuleBase(StyleRuleType type, bool hasDocumentSecurityOrigin)
+ : m_type(static_cast<unsigned>(type))
+ , m_hasDocumentSecurityOrigin(hasDocumentSecurityOrigin)
+{
+}
+
+inline StyleRuleBase::StyleRuleBase(const StyleRuleBase& o)
+ : WTF::RefCountedBase()
+ , m_type(o.m_type)
+ , m_hasDocumentSecurityOrigin(o.m_hasDocumentSecurityOrigin)
+{
+}
+
+inline void StyleRuleBase::deref() const
+{
+ if (derefBase())
+ const_cast<StyleRuleBase&>(*this).destroy();
+}
+
+inline void StyleRule::wrapperAdoptSelectorList(CSSSelectorList&& selectors)
+{
+ m_selectorList = WTFMove(selectors);
+#if ENABLE(CSS_SELECTOR_JIT)
+ m_compiledSelectors = nullptr;
+#endif
+}
+
+#if ENABLE(CSS_SELECTOR_JIT)
+
+inline CompiledSelector& StyleRule::compiledSelectorForListIndex(unsigned index) const
+{
+ if (!m_compiledSelectors)
+ m_compiledSelectors = makeUniqueArray<CompiledSelector>(m_selectorList.listSize());
+ return m_compiledSelectors[index];
+}
+
+#endif
+
+inline const StyleProperties* StyleRule::propertiesWithoutDeferredParsing() const
+{
+ return m_properties->type() != DeferredPropertiesType ? &downcast<StyleProperties>(m_properties.get()) : nullptr;
+}
+
+inline const Vector<RefPtr<StyleRuleBase>>* StyleRuleGroup::childRulesWithoutDeferredParsing() const
+{
+ return !m_deferredRules ? &m_childRules : nullptr;
+}
+
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRule)
@@ -353,10 +335,9 @@
SPECIALIZE_TYPE_TRAITS_END()
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleKeyframe)
-static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isKeyframeRule(); }
+ static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isKeyframeRule(); }
SPECIALIZE_TYPE_TRAITS_END()
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleCharset)
-static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isCharsetRule(); }
+ static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isCharsetRule(); }
SPECIALIZE_TYPE_TRAITS_END()
-
Modified: trunk/Source/WebCore/css/StyleSheet.idl (267575 => 267576)
--- trunk/Source/WebCore/css/StyleSheet.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/StyleSheet.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
[
CustomToJSObject,
ExportToWrappedFunction,
+ Exposed=Window,
GenerateIsReachable,
JSCustomHeader,
JSCustomMarkFunction,
@@ -31,5 +32,5 @@
readonly attribute StyleSheet parentStyleSheet;
readonly attribute DOMString? href;
readonly attribute DOMString? title;
- readonly attribute MediaList media;
+ [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
};
Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/StyleSheetContents.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -152,7 +152,7 @@
}
if (is<StyleRuleMedia>(rule))
- reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast<StyleRuleMedia>(rule.get()).mediaQueries());
+ reportMediaQueryWarningIfNeeded(singleOwnerDocument(), &downcast<StyleRuleMedia>(rule.get()).mediaQueries());
// NOTE: The selector list has to fit into RuleData. <http://webkit.org/b/118369>
// If we're adding a rule with a huge number of selectors, split it up into multiple rules
Modified: trunk/Source/WebCore/css/StyleSheetList.idl (267575 => 267576)
--- trunk/Source/WebCore/css/StyleSheetList.idl 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/StyleSheetList.idl 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
[
ExportToWrappedFunction,
+ Exposed=Window,
GenerateIsReachable=ImplOwnerNodeRoot,
ImplementationLacksVTable,
] interface StyleSheetList {
Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (267575 => 267576)
--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -550,12 +550,12 @@
if (m_observerWrapper)
m_observerWrapper->observer().endRuleBody(m_observerWrapper->endOffset(block));
- return StyleRuleMedia::create(MediaQueryParser::parseMediaQuerySet(prelude, MediaQueryParserContext(m_context)).releaseNonNull(), rules);
+ return StyleRuleMedia::create(MediaQueryParser::parseMediaQuerySet(prelude, MediaQueryParserContext(m_context)).releaseNonNull(), WTFMove(rules));
}
RefPtr<StyleRuleSupports> CSSParserImpl::consumeSupportsRule(CSSParserTokenRange prelude, CSSParserTokenRange block)
{
- CSSSupportsParser::SupportsResult supported = CSSSupportsParser::supportsCondition(prelude, *this, CSSSupportsParser::ForAtRule);
+ auto supported = CSSSupportsParser::supportsCondition(prelude, *this, CSSSupportsParser::ForAtRule);
if (supported == CSSSupportsParser::Invalid)
return nullptr; // Parse error, invalid @supports condition
@@ -577,7 +577,7 @@
if (m_observerWrapper)
m_observerWrapper->observer().endRuleBody(m_observerWrapper->endOffset(block));
- return StyleRuleSupports::create(prelude.serialize().stripWhiteSpace(), supported, rules);
+ return StyleRuleSupports::create(prelude.serialize().stripWhiteSpace(), supported, WTFMove(rules));
}
RefPtr<StyleRuleFontFace> CSSParserImpl::consumeFontFaceRule(CSSParserTokenRange prelude, CSSParserTokenRange block)
Modified: trunk/Source/WebCore/style/RuleSet.cpp (267575 => 267576)
--- trunk/Source/WebCore/style/RuleSet.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/style/RuleSet.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -282,9 +282,9 @@
}
if (is<StyleRuleMedia>(*rule)) {
auto& mediaRule = downcast<StyleRuleMedia>(*rule);
- if (mediaQueryCollector.pushAndEvaluate(mediaRule.mediaQueries()))
+ if (mediaQueryCollector.pushAndEvaluate(&mediaRule.mediaQueries()))
addChildRules(mediaRule.childRules(), mediaQueryCollector, resolver, mode);
- mediaQueryCollector.pop(mediaRule.mediaQueries());
+ mediaQueryCollector.pop(&mediaRule.mediaQueries());
continue;
}
if (is<StyleRuleFontFace>(*rule)) {
Modified: trunk/Source/WebCore/style/UserAgentStyle.cpp (267575 => 267576)
--- trunk/Source/WebCore/style/UserAgentStyle.cpp 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebCore/style/UserAgentStyle.cpp 2020-09-25 17:19:48 UTC (rev 267576)
@@ -168,13 +168,11 @@
if (!is<StyleRuleMedia>(*rule))
continue;
auto& mediaRule = downcast<StyleRuleMedia>(*rule);
- auto* mediaQuery = mediaRule.mediaQueries();
- if (!mediaQuery)
+ auto& mediaQuery = mediaRule.mediaQueries();
+ if (screenEval().evaluate(mediaQuery, nullptr))
continue;
- if (screenEval().evaluate(*mediaQuery, nullptr))
+ if (printEval().evaluate(mediaQuery, nullptr))
continue;
- if (printEval().evaluate(*mediaQuery, nullptr))
- continue;
mediaQueryStyleSheet->parserAppendRule(mediaRule.copy());
}
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (267575 => 267576)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2020-09-25 17:19:48 UTC (rev 267576)
@@ -1,3 +1,13 @@
+2020-09-24 Darin Adler <[email protected]>
+
+ Add CSSConditionRule and CSSGroupingRule
+ https://bugs.webkit.org/show_bug.cgi?id=216855
+
+ Reviewed by Sam Weinig.
+
+ * DOM/DOMCSS.mm:
+ (kitClass): Added a default case since we don't intend to list every single rule type here.
+
2020-09-25 Sam Weinig <[email protected]>
[Preferences] Start generating experimental feature preferences for legacy WebKit
Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm (267575 => 267576)
--- trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm 2020-09-25 17:04:46 UTC (rev 267575)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm 2020-09-25 17:19:48 UTC (rev 267576)
@@ -75,14 +75,9 @@
return [DOMCSSFontFaceRule class];
case WebCore::CSSRule::PAGE_RULE:
return [DOMCSSPageRule class];
- case WebCore::CSSRule::KEYFRAMES_RULE:
- case WebCore::CSSRule::NAMESPACE_RULE:
- case WebCore::CSSRule::KEYFRAME_RULE:
- case WebCore::CSSRule::SUPPORTS_RULE:
+ default:
return [DOMCSSRule class];
}
- ASSERT_NOT_REACHED();
- return nil;
}
//------------------------------------------------------------------------------------------
@@ -95,12 +90,9 @@
return [DOMCSSPrimitiveValue class];
case WebCore::DeprecatedCSSOMValue::CSS_VALUE_LIST:
return [DOMCSSValueList class];
- case WebCore::DeprecatedCSSOMValue::CSS_INHERIT:
- case WebCore::DeprecatedCSSOMValue::CSS_CUSTOM:
+ default:
return [DOMCSSValue class];
}
- ASSERT_NOT_REACHED();
- return nil;
}
//------------------------------------------------------------------------------------------