Changeset 267576 in webkit
- Timestamp:
- Sep 25, 2020, 10:19:48 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 43 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/domListEnumeration-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/domListEnumeration.html (modified) (1 diff)
-
LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/non-numeric-values-numeric-parameters.html (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/conditional/idlharness-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/MediaList-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssimportrule-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt (modified) (8 diffs)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources-output.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources.make (modified) (1 diff)
-
Source/WebCore/Headers.cmake (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (2 diffs)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (7 diffs)
-
Source/WebCore/css/CSSConditionRule.cpp (added)
-
Source/WebCore/css/CSSConditionRule.h (added)
-
Source/WebCore/css/CSSConditionRule.idl (added)
-
Source/WebCore/css/CSSGroupingRule.cpp (modified) (5 diffs)
-
Source/WebCore/css/CSSGroupingRule.h (modified) (2 diffs)
-
Source/WebCore/css/CSSGroupingRule.idl (added)
-
Source/WebCore/css/CSSImportRule.idl (modified) (2 diffs)
-
Source/WebCore/css/CSSMediaRule.cpp (modified) (5 diffs)
-
Source/WebCore/css/CSSMediaRule.h (modified) (4 diffs)
-
Source/WebCore/css/CSSMediaRule.idl (modified) (2 diffs)
-
Source/WebCore/css/CSSRule.h (modified) (5 diffs)
-
Source/WebCore/css/CSSRule.idl (modified) (4 diffs)
-
Source/WebCore/css/CSSStyleRule.idl (modified) (2 diffs)
-
Source/WebCore/css/CSSStyleSheet.idl (modified) (2 diffs)
-
Source/WebCore/css/CSSSupportsRule.cpp (modified) (4 diffs)
-
Source/WebCore/css/CSSSupportsRule.h (modified) (3 diffs)
-
Source/WebCore/css/CSSSupportsRule.idl (modified) (2 diffs)
-
Source/WebCore/css/MediaList.cpp (modified) (2 diffs)
-
Source/WebCore/css/MediaList.idl (modified) (2 diffs)
-
Source/WebCore/css/StyleRule.cpp (modified) (9 diffs)
-
Source/WebCore/css/StyleRule.h (modified) (13 diffs)
-
Source/WebCore/css/StyleSheet.idl (modified) (3 diffs)
-
Source/WebCore/css/StyleSheetContents.cpp (modified) (1 diff)
-
Source/WebCore/css/StyleSheetList.idl (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSParserImpl.cpp (modified) (2 diffs)
-
Source/WebCore/style/RuleSet.cpp (modified) (1 diff)
-
Source/WebCore/style/UserAgentStyle.cpp (modified) (1 diff)
-
Source/WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/mac/DOM/DOMCSS.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r267574 r267576 1 2020-09-24 Darin Adler <darin@apple.com> 2 3 Add CSSConditionRule and CSSGroupingRule 4 https://bugs.webkit.org/show_bug.cgi?id=216855 5 6 Reviewed by Sam Weinig. 7 8 * fast/dom/domListEnumeration-expected.txt: 9 * fast/dom/domListEnumeration.html: 10 Updated since toString is now implemented and enumerable. 11 12 * fast/dom/non-numeric-values-numeric-parameters-expected.txt: 13 * fast/dom/non-numeric-values-numeric-parameters.html: 14 Updated test and expectations since CSSMediaRule's deleteRule no longer allows omitting 15 the index to delete rule 0 (both non-standard and inconsistent with CSSStyleSheet). 16 1 17 2020-09-25 Ryan Haddad <ryanhaddad@apple.com> 2 18 -
trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt
r202307 r267576 82 82 83 83 [object MediaList] 84 PASS resultArray.length is 884 PASS resultArray.length is 9 85 85 PASS resultArray[0].i is '0' 86 86 PASS resultArray[0].item is mediaList.item(0) -
trunk/LayoutTests/fast/dom/domListEnumeration.html
r217390 r267576 201 201 var mediaList = document.styleSheets[3].cssRules[0].media; 202 202 resultArray = iterateList(mediaList); 203 shouldBe("resultArray.length", " 8");203 shouldBe("resultArray.length", "9"); 204 204 shouldBe("resultArray[0].i", "'0'"); 205 205 shouldBe("resultArray[0].item", "mediaList.item(0)"); -
trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt
r235893 r267576 12 12 PASS nonNumericPolicy('document.createTextNode("a").replaceData(0, x, "b")') is 'any type allowed' 13 13 PASS nonNumericPolicy('createCSSMediaRule().insertRule(ruleText, x)') is 'any type allowed' 14 PASS nonNumericPolicy('createCSSMediaRule().deleteRule(x)') is 'any type allowed '14 PASS nonNumericPolicy('createCSSMediaRule().deleteRule(x)') is 'any type allowed (but not omitted)' 15 15 PASS nonNumericPolicy('createCSSRuleList().item(x)') is 'any type allowed (but not omitted)' 16 16 PASS nonNumericPolicy('createCSSStyleDeclaration().item(x)') is 'any type allowed (but not omitted)' -
trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters.html
r235893 r267576 204 204 205 205 shouldBe("nonNumericPolicy('createCSSMediaRule().insertRule(ruleText, x)')", "'any type allowed'"); 206 shouldBe("nonNumericPolicy('createCSSMediaRule().deleteRule(x)')", "'any type allowed '");206 shouldBe("nonNumericPolicy('createCSSMediaRule().deleteRule(x)')", "'any type allowed (but not omitted)'"); 207 207 208 208 // CSSRuleList -
trunk/LayoutTests/imported/w3c/ChangeLog
r267571 r267576 1 2020-09-24 Darin Adler <darin@apple.com> 2 3 Add CSSConditionRule and CSSGroupingRule 4 https://bugs.webkit.org/show_bug.cgi?id=216855 5 6 Reviewed by Sam Weinig. 7 8 * web-platform-tests/css/conditional/idlharness-expected.txt: 9 * web-platform-tests/css/cssom/MediaList-expected.txt: 10 * web-platform-tests/css/cssom/cssimportrule-expected.txt: 11 * web-platform-tests/css/cssom/idlharness-expected.txt: 12 Updated expectations to expect more tests to pass. 13 1 14 2020-09-25 Antoine Quint <graouts@webkit.org> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/conditional/idlharness-expected.txt
r266356 r267576 6 6 PASS Partial namespace CSS: original namespace defined 7 7 PASS Partial namespace CSS: member names are unique 8 FAIL CSSConditionRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 9 FAIL CSSConditionRule interface object length assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 10 FAIL CSSConditionRule interface object name assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 11 FAIL CSSConditionRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 12 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 13 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 14 FAIL CSSConditionRule interface: attribute conditionText assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 15 FAIL CSSMediaRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 8 PASS CSSConditionRule interface: existence and properties of interface object 9 PASS CSSConditionRule interface object length 10 PASS CSSConditionRule interface object name 11 PASS CSSConditionRule interface: existence and properties of interface prototype object 12 PASS CSSConditionRule interface: existence and properties of interface prototype object's "constructor" property 13 PASS CSSConditionRule interface: existence and properties of interface prototype object's @@unscopables property 14 PASS CSSConditionRule interface: attribute conditionText 15 PASS CSSMediaRule interface: existence and properties of interface object 16 16 PASS CSSMediaRule interface object length 17 17 PASS CSSMediaRule interface object name 18 FAIL CSSMediaRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 18 PASS CSSMediaRule interface: existence and properties of interface prototype object 19 19 PASS CSSMediaRule interface: existence and properties of interface prototype object's "constructor" property 20 20 PASS CSSMediaRule interface: existence and properties of interface prototype object's @@unscopables property 21 FAIL CSSMediaRule interface: attribute media assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" 21 PASS CSSMediaRule interface: attribute media 22 22 PASS CSSMediaRule must be primary interface of cssMediaRule 23 23 PASS Stringification of cssMediaRule 24 24 PASS CSSMediaRule interface: cssMediaRule must inherit property "media" with the proper type 25 FAIL CSSConditionRule interface: cssMediaRule must inherit property "conditionText" with the proper type assert_inherits: property "conditionText" not found in prototype chain 25 PASS CSSConditionRule interface: cssMediaRule must inherit property "conditionText" with the proper type 26 26 PASS CSSRule interface: cssMediaRule must inherit property "SUPPORTS_RULE" with the proper type 27 FAIL CSSSupportsRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 27 PASS CSSSupportsRule interface: existence and properties of interface object 28 28 PASS CSSSupportsRule interface object length 29 29 PASS CSSSupportsRule interface object name 30 FAIL CSSSupportsRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSConditionRule" expected property "CSSConditionRule" missing 30 PASS CSSSupportsRule interface: existence and properties of interface prototype object 31 31 PASS CSSSupportsRule interface: existence and properties of interface prototype object's "constructor" property 32 32 PASS CSSSupportsRule interface: existence and properties of interface prototype object's @@unscopables property -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/MediaList-expected.txt
r232005 r267576 1 1 2 FAIL CSSOM - MediaList interface assert_equals: MediaList toString method expected "screen and (min-width: 480px), print, projection" but got "[object MediaList]" 2 PASS CSSOM - MediaList interface 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssimportrule-expected.txt
r232005 r267576 6 6 PASS Existence and writability of CSSImportRule attributes 7 7 PASS Values of CSSImportRule attributes 8 FAIL CSSImportRule : MediaList mediaText attribute should be updated due to [PutForwards] assert_equals: expected "print" but got "screen" 8 PASS CSSImportRule : MediaList mediaText attribute should be updated due to [PutForwards] 9 9 PASS CSSStyleDeclaration cssText attribute should be updated due to [PutForwards] 10 FAIL StyleSheet : MediaList mediaText attribute should be updated due to [PutForwards] assert_equals: expected "screen" but got "" 10 PASS StyleSheet : MediaList mediaText attribute should be updated due to [PutForwards] 11 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt
r264522 r267576 54 54 PASS MediaList interface: existence and properties of interface prototype object's @@unscopables property 55 55 PASS MediaList interface: attribute mediaText 56 FAIL MediaList interface: stringifier assert_own_property: interface prototype object missing non-static operation expected property "toString" missing 56 PASS MediaList interface: stringifier 57 57 PASS MediaList interface: attribute length 58 58 PASS MediaList interface: operation item(unsigned long) … … 80 80 PASS StyleSheet interface: attribute parentStyleSheet 81 81 PASS StyleSheet interface: attribute title 82 FAIL StyleSheet interface: attribute media assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" 82 PASS StyleSheet interface: attribute media 83 83 PASS StyleSheet interface: attribute disabled 84 84 PASS CSSStyleSheet interface: existence and properties of interface object … … 163 163 PASS CSSRule interface: constant PAGE_RULE on interface object 164 164 PASS CSSRule interface: constant PAGE_RULE on interface prototype object 165 FAIL CSSRule interface: constant MARGIN_RULE on interface object assert_own_property: expected property "MARGIN_RULE" missing 166 FAIL CSSRule interface: constant MARGIN_RULE on interface prototype object assert_own_property: expected property "MARGIN_RULE" missing 165 PASS CSSRule interface: constant MARGIN_RULE on interface object 166 PASS CSSRule interface: constant MARGIN_RULE on interface prototype object 167 167 PASS CSSRule interface: constant NAMESPACE_RULE on interface object 168 168 PASS CSSRule interface: constant NAMESPACE_RULE on interface prototype object … … 189 189 PASS CSSRule interface: sheet.cssRules[4] must inherit property "FONT_FACE_RULE" with the proper type 190 190 PASS CSSRule interface: sheet.cssRules[4] must inherit property "PAGE_RULE" with the proper type 191 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 191 PASS CSSRule interface: sheet.cssRules[4] must inherit property "MARGIN_RULE" with the proper type 192 192 PASS CSSRule interface: sheet.cssRules[4] must inherit property "NAMESPACE_RULE" with the proper type 193 193 PASS CSSImportRule interface: existence and properties of interface object … … 198 198 PASS CSSImportRule interface: existence and properties of interface prototype object's @@unscopables property 199 199 PASS CSSImportRule interface: attribute href 200 FAIL CSSImportRule interface: attribute media assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" 200 PASS CSSImportRule interface: attribute media 201 201 PASS CSSImportRule interface: attribute styleSheet 202 202 PASS CSSImportRule must be primary interface of sheet.cssRules[0] … … 215 215 PASS CSSRule interface: sheet.cssRules[0] must inherit property "FONT_FACE_RULE" with the proper type 216 216 PASS CSSRule interface: sheet.cssRules[0] must inherit property "PAGE_RULE" with the proper type 217 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 217 PASS CSSRule interface: sheet.cssRules[0] must inherit property "MARGIN_RULE" with the proper type 218 218 PASS CSSRule interface: sheet.cssRules[0] must inherit property "NAMESPACE_RULE" with the proper type 219 FAIL CSSGroupingRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 220 FAIL CSSGroupingRule interface object length assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 221 FAIL CSSGroupingRule interface object name assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 222 FAIL CSSGroupingRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 223 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 224 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 225 FAIL CSSGroupingRule interface: attribute cssRules assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 226 FAIL CSSGroupingRule interface: operation insertRule(CSSOMString, optional unsigned long) assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 227 FAIL CSSGroupingRule interface: operation deleteRule(unsigned long) assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 228 FAIL CSSPageRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing 219 PASS CSSGroupingRule interface: existence and properties of interface object 220 PASS CSSGroupingRule interface object length 221 PASS CSSGroupingRule interface object name 222 PASS CSSGroupingRule interface: existence and properties of interface prototype object 223 PASS CSSGroupingRule interface: existence and properties of interface prototype object's "constructor" property 224 PASS CSSGroupingRule interface: existence and properties of interface prototype object's @@unscopables property 225 PASS CSSGroupingRule interface: attribute cssRules 226 PASS CSSGroupingRule interface: operation insertRule(CSSOMString, optional unsigned long) 227 PASS CSSGroupingRule interface: operation deleteRule(unsigned long) 228 FAIL CSSPageRule interface: existence and properties of interface object assert_equals: prototype of CSSPageRule is not CSSGroupingRule expected function "function CSSGroupingRule() { 229 [native code] 230 }" but got function "function CSSRule() { 231 [native code] 232 }" 229 233 PASS CSSPageRule interface object length 230 234 PASS CSSPageRule interface object name 231 FAIL CSSPageRule interface: existence and properties of interface prototype object assert_ own_property: self does not have own property "CSSGroupingRule" expected property "CSSGroupingRule" missing235 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]" 232 236 PASS CSSPageRule interface: existence and properties of interface prototype object's "constructor" property 233 237 PASS CSSPageRule interface: existence and properties of interface prototype object's @@unscopables property … … 253 257 PASS CSSRule interface: sheet.cssRules[2] must inherit property "FONT_FACE_RULE" with the proper type 254 258 PASS CSSRule interface: sheet.cssRules[2] must inherit property "PAGE_RULE" with the proper type 255 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 259 PASS CSSRule interface: sheet.cssRules[2] must inherit property "MARGIN_RULE" with the proper type 256 260 PASS CSSRule interface: sheet.cssRules[2] must inherit property "NAMESPACE_RULE" with the proper type 257 261 FAIL CSSMarginRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSMarginRule" expected property "CSSMarginRule" missing … … 301 305 PASS CSSRule interface: sheet.cssRules[1] must inherit property "FONT_FACE_RULE" with the proper type 302 306 PASS CSSRule interface: sheet.cssRules[1] must inherit property "PAGE_RULE" with the proper type 303 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 307 PASS CSSRule interface: sheet.cssRules[1] must inherit property "MARGIN_RULE" with the proper type 304 308 PASS CSSRule interface: sheet.cssRules[1] must inherit property "NAMESPACE_RULE" with the proper type 305 309 PASS CSSStyleDeclaration interface: existence and properties of interface object -
trunk/Source/WebCore/CMakeLists.txt
r267509 r267576 691 691 crypto/parameters/RsaPssParams.idl 692 692 693 css/CSSConditionRule.idl 693 694 css/CSSFontFaceRule.idl 695 css/CSSGroupingRule.idl 694 696 css/CSSImportRule.idl 695 697 css/CSSKeyframeRule.idl -
trunk/Source/WebCore/ChangeLog
r267573 r267576 1 2020-09-24 Darin Adler <darin@apple.com> 2 3 Add CSSConditionRule and CSSGroupingRule 4 https://bugs.webkit.org/show_bug.cgi?id=216855 5 6 Reviewed by Sam Weinig. 7 8 * CMakeLists.txt: Added CSSConditionRule.idl and CSSGroupingRule.idl. 9 10 * DerivedSources-input.xcfilelist: Updated. 11 * DerivedSources-output.xcfilelist: Updated. 12 13 * DerivedSources.make: Added CSSConditionRule.idl and CSSGroupingRule.idl. 14 * Headers.cmake: Added CSSConditionRule.h. 15 * Sources.txt: Add CSSConditionRule.cpp, JSCSSConditioRule.cpp, 16 and JSCSSGroupingRule.cpp. 17 18 * WebCore.xcodeproj/project.pbxproj: Added all the files. 19 20 * css/CSSConditionRule.cpp: Added. 21 * css/CSSConditionRule.h: Added. 22 * css/CSSConditionRule.idl: Added. 23 24 * css/CSSGroupingRule.cpp: 25 (WebCore::CSSGroupingRule::~CSSGroupingRule): Use a range-based for loop 26 and nullptr. 27 (WebCore::CSSGroupingRule::appendCSSTextForItems const): Use variadic 28 append to clean this up a bit. 29 (WebCore::CSSGroupingRule::item const): Use auto. 30 31 * css/CSSGroupingRule.h: Made m_groupRule private instead of protected. 32 Did some other tweaks. 33 34 * css/CSSGroupingRule.idl: Added. 35 36 * css/CSSImportRule.idl: Added [Exposed=Window], changed href to be a 37 USVString, added [SameObject, PutForwards=mediaText] to media 38 and [SameObject] to styleSheet. 39 40 * css/CSSMediaRule.cpp: 41 (WebCore::CSSMediaRule::CSSMediaRule): Derive from CSSConditionRule. 42 (WebCore::CSSMediaRule::mediaQueries const): Return a reference. 43 (WebCore::CSSMediaRule::cssText const): Streamline since we don't need a 44 null check. 45 (WebCore::CSSMediaRule::conditionText const): Added. 46 (WebCore::CSSMediaRule::setConditionText): Added. 47 (WebCore::CSSMediaRule::media const): Streamline since we don't need a 48 null check. 49 (WebCore::CSSMediaRule::reattach): Ditto. 50 51 * css/CSSMediaRule.h: Derive from CSSConditionRule. 52 53 * css/CSSMediaRule.idl: Derive from CSSConditionRule. Added 54 [Exposed=Window]. Added [SameObject, PutForwards=mediaText] to media. 55 Removed insertRule and deleteRule since they are now inherited from 56 CSSGroupingRule. 57 58 * css/CSSRule.h: Added MARGIN_RULE constant even though we don't have 59 that rule type. Moved inline functions out of the class body to help 60 clarity a bit. 61 62 * css/CSSRule.idl: Added [Exposed=Window], changed a few things to match 63 the specification. 64 65 * css/CSSStyleRule.idl: Added [Exposed=Window]. Added [SameObject] 66 to style. 67 68 * css/CSSStyleSheet.idl: Added [Exposed=Window]. 69 70 * css/CSSSupportsRule.cpp: 71 (WebCore::CSSSupportsRule::CSSSupportsRule): Derive from CSSConditionRule. 72 (WebCore::CSSSupportsRule::create): Added. 73 (WebCore::CSSSupportsRule::cssText const): Use variadic append. 74 (WebCore::CSSSupportsRule::conditionText const): Updated to use groupRule. 75 (WebCore::CSSSupportsRule::setConditionText): Added. Not implemented yet. 76 77 * css/CSSSupportsRule.h: Derive from CSSConditionRule. 78 79 * css/CSSSupportsRule.idl: Derive from CSSConditionRule. 80 Added [Exposed=Window]. 81 82 * css/MediaList.cpp: 83 (WebCore::MediaQuerySet::set): Use move instead of swap. 84 85 * css/MediaList.idl: Added [Exposed=Window] and marked mediaText as 86 the stringifier. 87 88 * css/StyleRule.cpp: 89 (WebCore::StyleRule::create): Moved here from the header. 90 (WebCore::StyleRule::copy const): Ditto. 91 (WebCore::StyleRulePage::create): Ditto. 92 (WebCore::StyleRuleGroup::StyleRuleGroup): Use move instead of swap. 93 (WebCore::StyleRuleMedia::create): Use move instead of swap. 94 (WebCore::StyleRuleMedia::copy const): Moved out of the header. 95 (WebCore::StyleRuleSupports::StyleRuleSupports): Ditto. 96 (WebCore::StyleRuleSupports::create): Ditto. 97 (WebCore::StyleRuleNamespace::StyleRuleNamespace): Ditto. 98 (WebCore::StyleRuleNamespace::create): Ditto. 99 100 * css/StyleRule.h: Moved function bodies out of the class 101 defintiion for clarity. 102 103 * css/StyleSheet.idl: Added [Exposed=Window] and 104 [SameObject, PutForwards=mediaText] for media. 105 106 * css/StyleSheetContents.cpp: 107 (WebCore::StyleSheetContents::parserAppendRule): Updated since 108 mediaQueries returns a reference. 109 110 * css/StyleSheetList.idl: Added [Exposed=Window]. 111 112 * css/parser/CSSParserImpl.cpp: 113 (WebCore::CSSParserImpl::consumeMediaRule): Use WTFMove since 114 the create function now takes an rvalue reference. 115 (WebCore::CSSParserImpl::consumeSupportsRule): Ditto. 116 117 * style/RuleSet.cpp: 118 (WebCore::Style::RuleSet::addChildRules): Updated since mediaQueries 119 returns a reference. 120 * style/UserAgentStyle.cpp: 121 (WebCore::Style::UserAgentStyle::addToDefaultStyle): Ditto. 122 1 123 2020-09-25 Peng Liu <peng.liu6@apple.com> 2 124 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r267472 r267576 588 588 $(PROJECT_DIR)/crypto/parameters/RsaOaepParams.idl 589 589 $(PROJECT_DIR)/crypto/parameters/RsaPssParams.idl 590 $(PROJECT_DIR)/css/CSSConditionRule.idl 590 591 $(PROJECT_DIR)/css/CSSFontFaceRule.idl 592 $(PROJECT_DIR)/css/CSSGroupingRule.idl 591 593 $(PROJECT_DIR)/css/CSSImportRule.idl 592 594 $(PROJECT_DIR)/css/CSSKeyframeRule.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r267472 r267576 246 246 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSAnimation.cpp 247 247 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSAnimation.h 248 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSConditionRule.cpp 249 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSConditionRule.h 248 250 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.cpp 249 251 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.h 252 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.cpp 253 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.h 250 254 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule.cpp 251 255 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule.h -
trunk/Source/WebCore/DerivedSources.make
r267472 r267576 643 643 $(WebCore)/crypto/parameters/RsaOaepParams.idl \ 644 644 $(WebCore)/crypto/parameters/RsaPssParams.idl \ 645 $(WebCore)/css/CSSConditionRule.idl \ 645 646 $(WebCore)/css/CSSFontFaceRule.idl \ 647 $(WebCore)/css/CSSGroupingRule.idl \ 646 648 $(WebCore)/css/CSSImportRule.idl \ 647 649 $(WebCore)/css/CSSKeyframeRule.idl \ -
trunk/Source/WebCore/Headers.cmake
r267571 r267576 311 311 312 312 css/CSSCalculationValue.h 313 css/CSSConditionRule.h 313 314 css/CSSCustomPropertyValue.h 314 315 css/CSSFontFaceRule.h -
trunk/Source/WebCore/Sources.txt
r267565 r267576 664 664 css/CSSCanvasValue.cpp 665 665 css/CSSComputedStyleDeclaration.cpp 666 css/CSSConditionRule.cpp 666 667 css/CSSContentDistributionValue.cpp 667 668 css/CSSCrossfadeValue.cpp … … 2695 2696 JSCDATASection.cpp 2696 2697 JSCSSAnimation.cpp 2698 JSCSSConditionRule.cpp 2697 2699 JSCSSFontFaceRule.cpp 2700 JSCSSGroupingRule.cpp 2698 2701 JSCSSImportRule.cpp 2699 2702 JSCSSKeyframeRule.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r267571 r267576 2653 2653 930841341CDDB15500B0958C /* JSDOMConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 930841331CDDB15500B0958C /* JSDOMConvert.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2654 2654 930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 930908900AF7EDE40081DF01 /* HitTestRequest.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2655 930AAC9A250EB8490013DA9F /* CSSConditionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AAC98250EB8170013DA9F /* CSSConditionRule.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2656 930AAC9F250ED4090013DA9F /* JSCSSConditionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */; }; 2657 930AACA2250ED4110013DA9F /* JSCSSGroupingRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */; }; 2655 2658 93153BDA14181F7A00FCF5BE /* missingImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BD914181F7A00FCF5BE /* missingImage@2x.png */; }; 2656 2659 93153BDC141959BC00FCF5BE /* textAreaResizeCorner.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */; }; … … 11041 11044 930841331CDDB15500B0958C /* JSDOMConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConvert.h; sourceTree = "<group>"; }; 11042 11045 930908900AF7EDE40081DF01 /* HitTestRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestRequest.h; sourceTree = "<group>"; }; 11046 930AAC96250EB8170013DA9F /* CSSConditionRule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSConditionRule.cpp; sourceTree = "<group>"; }; 11047 930AAC98250EB8170013DA9F /* CSSConditionRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSConditionRule.h; sourceTree = "<group>"; }; 11048 930AAC99250EB8180013DA9F /* CSSConditionRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSConditionRule.idl; sourceTree = "<group>"; }; 11049 930AAC9B250EC2F30013DA9F /* CSSGroupingRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSGroupingRule.idl; sourceTree = "<group>"; }; 11050 930AAC9C250ED4080013DA9F /* JSCSSConditionRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSConditionRule.cpp; sourceTree = "<group>"; }; 11051 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSConditionRule.h; sourceTree = "<group>"; }; 11052 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSGroupingRule.h; sourceTree = "<group>"; }; 11053 930AACA1250ED4110013DA9F /* JSCSSGroupingRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSGroupingRule.cpp; sourceTree = "<group>"; }; 11043 11054 930C90DC19CF965300D6C21A /* InlineIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIterator.cpp; sourceTree = "<group>"; }; 11044 11055 93153BD914181F7A00FCF5BE /* missingImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "missingImage@2x.png"; sourceTree = "<group>"; }; … … 24837 24848 isa = PBXGroup; 24838 24849 children = ( 24850 930AAC9C250ED4080013DA9F /* JSCSSConditionRule.cpp */, 24851 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */, 24839 24852 BC46C1F20C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp */, 24840 24853 BC46C1F30C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h */, 24854 930AACA1250ED4110013DA9F /* JSCSSGroupingRule.cpp */, 24855 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */, 24841 24856 BC46C1F40C0DDC8F0020CFC3 /* JSCSSImportRule.cpp */, 24842 24857 BC46C1F50C0DDC8F0020CFC3 /* JSCSSImportRule.h */, … … 28578 28593 BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */, 28579 28594 BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */, 28595 930AAC96250EB8170013DA9F /* CSSConditionRule.cpp */, 28596 930AAC98250EB8170013DA9F /* CSSConditionRule.h */, 28597 930AAC99250EB8180013DA9F /* CSSConditionRule.idl */, 28580 28598 9DAC7C521AF2CAA100437C44 /* CSSContentDistributionValue.cpp */, 28581 28599 9DAC7C531AF2CAA100437C44 /* CSSContentDistributionValue.h */, … … 28628 28646 FBF89044169E9F1F0052D86E /* CSSGroupingRule.cpp */, 28629 28647 FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */, 28648 930AAC9B250EC2F30013DA9F /* CSSGroupingRule.idl */, 28630 28649 BC772B360C4EA91E0083285F /* CSSHelper.h */, 28631 28650 BC23E76B0DAE88A9009FDC91 /* CSSImageGeneratorValue.cpp */, … … 30866 30885 BC6049CC0DB560C200204739 /* CSSCanvasValue.h in Headers */, 30867 30886 BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */, 30887 930AAC9A250EB8490013DA9F /* CSSConditionRule.h in Headers */, 30868 30888 9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */, 30869 30889 2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */, … … 31974 31994 7C9ACAC21F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.h in Headers */, 31975 31995 71B28427203CEC4C0036AA5D /* JSCSSAnimation.h in Headers */, 31996 930AAC9F250ED4090013DA9F /* JSCSSConditionRule.h in Headers */, 31976 31997 BC46C1FD0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h in Headers */, 31998 930AACA2250ED4110013DA9F /* JSCSSGroupingRule.h in Headers */, 31977 31999 BC46C1FF0C0DDC8F0020CFC3 /* JSCSSImportRule.h in Headers */, 31978 32000 316FE0720E6CCBEE00BF6088 /* JSCSSKeyframeRule.h in Headers */, -
trunk/Source/WebCore/css/CSSGroupingRule.cpp
r248846 r267576 1 1 /* 2 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.3 * Copyright (C) 2012-2020 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 #include "config.h" 32 33 32 #include "CSSGroupingRule.h" 34 33 … … 51 50 { 52 51 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); 53 for ( unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {54 if ( m_childRuleCSSOMWrappers[i])55 m_childRuleCSSOMWrappers[i]->setParentRule(0);52 for (auto& wrapper : m_childRuleCSSOMWrappers) { 53 if (wrapper) 54 wrapper->setParentRule(nullptr); 56 55 } 57 56 } … … 112 111 } 113 112 114 void CSSGroupingRule::appendC ssTextForItems(StringBuilder& result) const113 void CSSGroupingRule::appendCSSTextForItems(StringBuilder& result) const 115 114 { 116 unsigned size = length(); 117 for (unsigned i = 0; i < size; ++i) { 118 result.appendLiteral(" "); 119 result.append(item(i)->cssText()); 120 result.append('\n'); 121 } 115 for (unsigned i = 0, size = length(); i < size; ++i) 116 result.append(" ", item(i)->cssText(), '\n'); 122 117 } 123 118 … … 132 127 return nullptr; 133 128 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); 134 RefPtr<CSSRule>& rule = m_childRuleCSSOMWrappers[index];129 auto& rule = m_childRuleCSSOMWrappers[index]; 135 130 if (!rule) 136 131 rule = m_groupRule->childRules()[index]->createCSSOMWrapper(const_cast<CSSGroupingRule*>(this)); -
trunk/Source/WebCore/css/CSSGroupingRule.h
r207396 r267576 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2006, 2008, 2012Apple Inc. All rights reserved.4 * Copyright (C) 2002-2020 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) 6 6 * … … 37 37 38 38 WEBCORE_EXPORT CSSRuleList& cssRules() const; 39 40 39 WEBCORE_EXPORT ExceptionOr<unsigned> insertRule(const String& rule, unsigned index); 41 40 WEBCORE_EXPORT ExceptionOr<void> deleteRule(unsigned index); 42 43 // For CSSRuleList44 41 unsigned length() const; 45 42 CSSRule* item(unsigned index) const; 46 43 47 44 protected: 48 CSSGroupingRule(StyleRuleGroup& groupRule, CSSStyleSheet* parent);49 45 CSSGroupingRule(StyleRuleGroup&, CSSStyleSheet* parent); 46 const StyleRuleGroup& groupRule() const { return m_groupRule; } 50 47 void reattach(StyleRuleBase&) override; 51 52 void appendCssTextForItems(StringBuilder&) const; 53 54 Ref<StyleRuleGroup> m_groupRule; 48 void appendCSSTextForItems(StringBuilder&) const; 55 49 56 50 private: 51 Ref<StyleRuleGroup> m_groupRule; 57 52 mutable Vector<RefPtr<CSSRule>> m_childRuleCSSOMWrappers; 58 53 mutable std::unique_ptr<CSSRuleList> m_ruleListCSSOMWrapper; -
trunk/Source/WebCore/css/CSSImportRule.idl
r197060 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 19 19 */ 20 20 21 // Introduced in DOM Level 2: 21 [Exposed=Window] 22 22 interface CSSImportRule : CSSRule { 23 readonly attribute DOMString?href;24 readonly attribute MediaList media;25 readonly attribute CSSStyleSheet styleSheet;23 readonly attribute USVString href; 24 [SameObject, PutForwards=mediaText] readonly attribute MediaList media; 25 [SameObject] readonly attribute CSSStyleSheet styleSheet; 26 26 }; 27 27 -
trunk/Source/WebCore/css/CSSMediaRule.cpp
r249013 r267576 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2005, 2006, 2012Apple Inc.4 * Copyright (C) 2002-2020 Apple Inc. 5 5 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) 6 6 * … … 32 32 33 33 CSSMediaRule::CSSMediaRule(StyleRuleMedia& mediaRule, CSSStyleSheet* parent) 34 : CSS GroupingRule(mediaRule, parent)34 : CSSConditionRule(mediaRule, parent) 35 35 { 36 36 } … … 42 42 } 43 43 44 MediaQuerySet *CSSMediaRule::mediaQueries() const44 MediaQuerySet& CSSMediaRule::mediaQueries() const 45 45 { 46 return downcast<StyleRuleMedia>( m_groupRule.get()).mediaQueries();46 return downcast<StyleRuleMedia>(groupRule()).mediaQueries(); 47 47 } 48 48 … … 50 50 { 51 51 StringBuilder result; 52 result.appendLiteral("@media "); 53 if (mediaQueries()) { 54 result.append(mediaQueries()->mediaText(), ' '); 55 } 56 result.appendLiteral("{ \n"); 57 appendCssTextForItems(result); 52 result.append("@media ", conditionText(), " { \n"); 53 appendCSSTextForItems(result); 58 54 result.append('}'); 59 55 return result.toString(); 60 56 } 61 57 58 String CSSMediaRule::conditionText() const 59 { 60 return mediaQueries().mediaText(); 61 } 62 63 void CSSMediaRule::setConditionText(const String& text) 64 { 65 mediaQueries().set(text); 66 } 67 62 68 MediaList* CSSMediaRule::media() const 63 69 { 64 if (!mediaQueries())65 return nullptr;66 70 if (!m_mediaCSSOMWrapper) 67 m_mediaCSSOMWrapper = MediaList::create( mediaQueries(), const_cast<CSSMediaRule*>(this));71 m_mediaCSSOMWrapper = MediaList::create(&mediaQueries(), const_cast<CSSMediaRule*>(this)); 68 72 return m_mediaCSSOMWrapper.get(); 69 73 } … … 71 75 void CSSMediaRule::reattach(StyleRuleBase& rule) 72 76 { 73 CSS GroupingRule::reattach(rule);74 if (m_mediaCSSOMWrapper && mediaQueries())75 m_mediaCSSOMWrapper->reattach( mediaQueries());77 CSSConditionRule::reattach(rule); 78 if (m_mediaCSSOMWrapper) 79 m_mediaCSSOMWrapper->reattach(&mediaQueries()); 76 80 } 77 81 -
trunk/Source/WebCore/css/CSSMediaRule.h
r207396 r267576 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2006, 2008, 2012Apple Inc. All rights reserved.4 * Copyright (C) 2002-2020 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) 6 6 * … … 23 23 #pragma once 24 24 25 #include "CSS GroupingRule.h"25 #include "CSSConditionRule.h" 26 26 27 27 namespace WebCore { … … 31 31 class StyleRuleMedia; 32 32 33 class CSSMediaRule final : public CSS GroupingRule {33 class CSSMediaRule final : public CSSConditionRule { 34 34 public: 35 35 static Ref<CSSMediaRule> create(StyleRuleMedia& rule, CSSStyleSheet* sheet) { return adoptRef(*new CSSMediaRule(rule, sheet)); } 36 37 36 virtual ~CSSMediaRule(); 38 37 … … 45 44 void reattach(StyleRuleBase&) final; 46 45 String cssText() const final; 46 String conditionText() const final; 47 void setConditionText(const String&) final; 47 48 48 MediaQuerySet *mediaQueries() const;49 49 MediaQuerySet& mediaQueries() const; 50 50 51 mutable RefPtr<MediaList> m_mediaCSSOMWrapper; 51 52 }; -
trunk/Source/WebCore/css/CSSMediaRule.idl
r266311 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 19 19 */ 20 20 21 interface CSSMediaRule : CSSRule { 22 readonly attribute MediaList media; 23 readonly attribute CSSRuleList cssRules; 24 25 [MayThrowException] unsigned long insertRule(optional DOMString rule = "undefined", optional unsigned long index = 0); 26 [MayThrowException] undefined deleteRule(optional unsigned long index = 0); 21 [Exposed=Window] 22 interface CSSMediaRule : CSSConditionRule { 23 [SameObject, PutForwards=mediaText] readonly attribute MediaList media; 27 24 }; -
trunk/Source/WebCore/css/CSSRule.h
r256477 r267576 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2006, 2007, 2012Apple Inc. All rights reserved.4 * Copyright (C) 2002-2020 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) 6 6 * … … 45 45 FONT_FACE_RULE, 46 46 PAGE_RULE, 47 // 7 was VARIABLES_RULE; we now match other browsers with 7 as48 // KEYFRAMES_RULE:49 // <https://bugs.webkit.org/show_bug.cgi?id=71293>.50 47 KEYFRAMES_RULE, 51 48 KEYFRAME_RULE, 52 NAMESPACE_RULE = 10, // Matches other browsers. 49 MARGIN_RULE, 50 NAMESPACE_RULE, 53 51 SUPPORTS_RULE = 12, 54 52 }; 55 53 56 54 enum DeprecatedType { 57 WEBKIT_KEYFRAMES_RULE = 7,58 WEBKIT_KEYFRAME_RULE = 855 WEBKIT_KEYFRAMES_RULE = KEYFRAMES_RULE, 56 WEBKIT_KEYFRAME_RULE = KEYFRAME_RULE 59 57 }; 60 58 … … 63 61 virtual void reattach(StyleRuleBase&) = 0; 64 62 65 void setParentStyleSheet(CSSStyleSheet* styleSheet) 66 { 67 m_parentIsRule = false; 68 m_parentStyleSheet = styleSheet; 69 } 70 71 void setParentRule(CSSRule* rule) 72 { 73 m_parentIsRule = true; 74 m_parentRule = rule; 75 } 76 77 CSSStyleSheet* parentStyleSheet() const 78 { 79 if (m_parentIsRule) 80 return m_parentRule ? m_parentRule->parentStyleSheet() : 0; 81 return m_parentStyleSheet; 82 } 83 84 CSSRule* parentRule() const { return m_parentIsRule ? m_parentRule : 0; } 63 void setParentStyleSheet(CSSStyleSheet*); 64 void setParentRule(CSSRule*); 65 CSSStyleSheet* parentStyleSheet() const; 66 CSSRule* parentRule() const { return m_parentIsRule ? m_parentRule : nullptr; } 85 67 86 68 WEBCORE_EXPORT ExceptionOr<void> setCssText(const String&); 87 69 88 70 protected: 89 CSSRule(CSSStyleSheet* parent) 90 : m_hasCachedSelectorText(false) 91 , m_parentIsRule(false) 92 , m_parentStyleSheet(parent) 93 { 94 } 71 explicit CSSRule(CSSStyleSheet*); 95 72 96 73 bool hasCachedSelectorText() const { return m_hasCachedSelectorText; } … … 102 79 mutable unsigned char m_hasCachedSelectorText : 1; 103 80 unsigned char m_parentIsRule : 1; 104 105 81 union { 106 82 CSSRule* m_parentRule; … … 108 84 }; 109 85 }; 86 87 inline CSSRule::CSSRule(CSSStyleSheet* parent) 88 : m_hasCachedSelectorText(false) 89 , m_parentIsRule(false) 90 , m_parentStyleSheet(parent) 91 { 92 } 93 94 inline void CSSRule::setParentStyleSheet(CSSStyleSheet* styleSheet) 95 { 96 m_parentIsRule = false; 97 m_parentStyleSheet = styleSheet; 98 } 99 100 inline void CSSRule::setParentRule(CSSRule* rule) 101 { 102 m_parentIsRule = true; 103 m_parentRule = rule; 104 } 105 106 inline CSSStyleSheet* CSSRule::parentStyleSheet() const 107 { 108 if (m_parentIsRule) 109 return m_parentRule ? m_parentRule->parentStyleSheet() : nullptr; 110 return m_parentStyleSheet; 111 } 110 112 111 113 } // namespace WebCore -
trunk/Source/WebCore/css/CSSRule.idl
r256477 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007, 2009Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 22 22 CustomToJSObject, 23 23 ExportToWrappedFunction, 24 Exposed=Window, 24 25 GenerateIsReachable, 25 26 JSCustomHeader, 26 27 JSCustomMarkFunction, 27 28 ] interface CSSRule { 28 // RuleType 29 attribute DOMString? cssText; 30 readonly attribute CSSRule? parentRule; 31 readonly attribute CSSStyleSheet? parentStyleSheet; 32 33 readonly attribute unsigned short type; 29 34 const unsigned short UNKNOWN_RULE = 0; 30 35 const unsigned short STYLE_RULE = 1; … … 36 41 const unsigned short KEYFRAMES_RULE = 7; 37 42 const unsigned short KEYFRAME_RULE = 8; 43 const unsigned short MARGIN_RULE = 9; 38 44 const unsigned short NAMESPACE_RULE = 10; 39 45 const unsigned short SUPPORTS_RULE = 12; … … 42 48 const unsigned short WEBKIT_KEYFRAMES_RULE = 7; 43 49 const unsigned short WEBKIT_KEYFRAME_RULE = 8; 44 45 readonly attribute unsigned short type;46 47 attribute DOMString? cssText;48 49 readonly attribute CSSStyleSheet? parentStyleSheet;50 readonly attribute CSSRule? parentRule;51 50 }; -
trunk/Source/WebCore/css/CSSStyleRule.idl
r217917 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 19 19 */ 20 20 21 // Introduced in DOM Level 2: 21 [Exposed=Window] 22 22 interface CSSStyleRule : CSSRule { 23 23 attribute DOMString? selectorText; 24 25 [PutForwards=cssText] readonly attribute CSSStyleDeclaration style; 24 [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; 26 25 }; 27 -
trunk/Source/WebCore/css/CSSStyleSheet.idl
r266311 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 19 19 */ 20 20 21 [Exposed=Window] 21 22 interface CSSStyleSheet : StyleSheet { 22 23 readonly attribute CSSRule ownerRule; 23 24 readonly attribute CSSRuleList cssRules; 24 25 25 [MayThrowException] unsigned long insertRule(DOMString rule, optional unsigned long index = 0); 26 27 26 [MayThrowException] undefined deleteRule(unsigned long index); 28 27 29 28 readonly attribute CSSRuleList rules; 30 31 // The following two operations are WebKit-specific.32 29 [MayThrowException] long addRule(optional DOMString selector = "undefined", optional DOMString style = "undefined", optional unsigned long index); 33 30 [MayThrowException] undefined removeRule(optional unsigned long index = 0); -
trunk/Source/WebCore/css/CSSSupportsRule.cpp
r218890 r267576 1 /* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 1 /* 2 * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 3 * Copyright (C) 2020 Apple Inc. All rights reserved. 2 4 * 3 5 * Redistribution and use in source and binary forms, with or without … … 36 38 namespace WebCore { 37 39 38 CSSSupportsRule::CSSSupportsRule(StyleRuleSupports& supportsRule, CSSStyleSheet* parent)39 : CSS GroupingRule(supportsRule, parent)40 CSSSupportsRule::CSSSupportsRule(StyleRuleSupports& rule, CSSStyleSheet* parent) 41 : CSSConditionRule(rule, parent) 40 42 { 43 } 44 45 Ref<CSSSupportsRule> CSSSupportsRule::create(StyleRuleSupports& rule, CSSStyleSheet* parent) 46 { 47 return adoptRef(*new CSSSupportsRule(rule, parent)); 41 48 } 42 49 … … 44 51 { 45 52 StringBuilder result; 46 47 result.appendLiteral("@supports "); 48 result.append(conditionText()); 49 result.appendLiteral(" {\n"); 50 appendCssTextForItems(result); 53 result.append("@supports ", conditionText(), " {\n"); 54 appendCSSTextForItems(result); 51 55 result.append('}'); 52 53 56 return result.toString(); 54 57 } … … 56 59 String CSSSupportsRule::conditionText() const 57 60 { 58 return downcast<StyleRuleSupports>(m_groupRule.get()).conditionText(); 61 return downcast<StyleRuleSupports>(groupRule()).conditionText(); 62 } 63 64 void CSSSupportsRule::setConditionText(const String&) 65 { 66 // FIXME: Not implemented yet. 59 67 } 60 68 -
trunk/Source/WebCore/css/CSSSupportsRule.h
r223728 r267576 1 /* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 1 /* 2 * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 3 * Copyright (C) 2020 Apple Inc. All rights reserved. 2 4 * 3 5 * Redistribution and use in source and binary forms, with or without … … 29 31 #pragma once 30 32 31 #include "CSS GroupingRule.h"33 #include "CSSConditionRule.h" 32 34 33 35 namespace WebCore { … … 36 38 class StyleRuleSupports; 37 39 38 class CSSSupportsRule final : public CSS GroupingRule {40 class CSSSupportsRule final : public CSSConditionRule { 39 41 public: 40 static Ref<CSSSupportsRule> create(StyleRuleSupports& rule, CSSStyleSheet* sheet) 41 { 42 return adoptRef(*new CSSSupportsRule(rule, sheet)); 43 } 44 45 virtual ~CSSSupportsRule() = default; 42 static Ref<CSSSupportsRule> create(StyleRuleSupports&, CSSStyleSheet* parent); 46 43 47 44 String cssText() const final; 48 49 String conditionText() const;45 String conditionText() const final; 46 void setConditionText(const String&) final; 50 47 51 48 private: 52 49 CSSSupportsRule(StyleRuleSupports&, CSSStyleSheet*); 53 54 50 CSSRule::Type type() const final { return SUPPORTS_RULE; } 55 51 }; -
trunk/Source/WebCore/css/CSSSupportsRule.idl
r266311 r267576 1 /* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 1 /* 2 * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 3 * Copyright (C) 2020 Apple Inc. All rights reserved. 2 4 * 3 5 * Redistribution and use in source and binary forms, with or without … … 27 29 */ 28 30 29 interface CSSSupportsRule : CSSRule { 30 readonly attribute CSSRuleList cssRules; 31 readonly attribute DOMString conditionText; 32 33 [MayThrowException] unsigned long insertRule(DOMString rule, optional unsigned long index = 0); 34 [MayThrowException] undefined deleteRule(unsigned long index); 31 [Exposed=Window] 32 interface CSSSupportsRule : CSSConditionRule { 35 33 }; -
trunk/Source/WebCore/css/MediaList.cpp
r248602 r267576 1 1 /* 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004-20 17Apple Inc. All rights reserved.3 * Copyright (C) 2004-2020 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 83 83 { 84 84 auto result = create(mediaString); 85 m_queries .swap(result->m_queries);85 m_queries = WTFMove(result->m_queries); 86 86 return true; 87 87 } -
trunk/Source/WebCore/css/MediaList.idl
r266662 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 [ 27 27 ExportToWrappedFunction, 28 Exposed=Window, 28 29 GenerateIsReachable, 29 30 ImplementationLacksVTable, 30 31 JSCustomHeader, 31 32 ] interface MediaList { 32 attribute [LegacyNullToEmptyString] DOMString mediaText;33 stringifier attribute [LegacyNullToEmptyString] DOMString mediaText; 33 34 readonly attribute unsigned long length; 34 35 -
trunk/Source/WebCore/css/StyleRule.cpp
r257696 r267576 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2005, 2006, 2008, 2012Apple Inc. All rights reserved.4 * Copyright (C) 2002-2020 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 188 188 StyleRule::~StyleRule() = default; 189 189 190 Ref<StyleRule> StyleRule::create(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors) 191 { 192 return adoptRef(*new StyleRule(WTFMove(properties), hasDocumentSecurityOrigin, WTFMove(selectors))); 193 } 194 195 Ref<StyleRule> StyleRule::copy() const 196 { 197 return adoptRef(*new StyleRule(*this)); 198 } 199 190 200 const StyleProperties& StyleRule::properties() const 191 201 { … … 254 264 StyleRulePage::~StyleRulePage() = default; 255 265 266 Ref<StyleRulePage> StyleRulePage::create(Ref<StyleProperties>&& properties, CSSSelectorList&& selectors) 267 { 268 return adoptRef(*new StyleRulePage(WTFMove(properties), WTFMove(selectors))); 269 } 270 256 271 MutableStyleProperties& StyleRulePage::mutableProperties() 257 272 { … … 300 315 } 301 316 302 StyleRuleGroup::StyleRuleGroup(StyleRuleType type, Vector<RefPtr<StyleRuleBase>>& adoptRule)317 StyleRuleGroup::StyleRuleGroup(StyleRuleType type, Vector<RefPtr<StyleRuleBase>>&& rules) 303 318 : StyleRuleBase(type) 304 { 305 m_childRules.swap(adoptRule); 306 } 307 308 StyleRuleGroup::StyleRuleGroup(StyleRuleType type, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)319 , m_childRules(WTFMove(rules)) 320 { 321 } 322 323 StyleRuleGroup::StyleRuleGroup(StyleRuleType type, std::unique_ptr<DeferredStyleGroupRuleList>&& rules) 309 324 : StyleRuleBase(type) 310 , m_deferredRules(WTFMove( deferredRules))325 , m_deferredRules(WTFMove(rules)) 311 326 { 312 327 } … … 347 362 } 348 363 349 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)350 : StyleRuleGroup(StyleRuleType::Media, adoptRules)364 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>&& rules) 365 : StyleRuleGroup(StyleRuleType::Media, WTFMove(rules)) 351 366 , m_mediaQueries(WTFMove(media)) 352 367 { 353 368 } 354 369 355 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)356 : StyleRuleGroup(StyleRuleType::Media, WTFMove( deferredRules))370 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& rules) 371 : StyleRuleGroup(StyleRuleType::Media, WTFMove(rules)) 357 372 , m_mediaQueries(WTFMove(media)) 358 373 { 359 374 } 360 375 361 StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o) 362 : StyleRuleGroup(o) 363 { 364 if (o.m_mediaQueries) 365 m_mediaQueries = o.m_mediaQueries->copy(); 366 } 367 368 369 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules) 370 : StyleRuleGroup(StyleRuleType::Supports, adoptRules) 376 StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& other) 377 : StyleRuleGroup(other) 378 , m_mediaQueries(other.m_mediaQueries->copy()) 379 { 380 } 381 382 Ref<StyleRuleMedia> StyleRuleMedia::create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>&& rules) 383 { 384 return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(rules))); 385 } 386 387 Ref<StyleRuleMedia> StyleRuleMedia::create(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules) 388 { 389 return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(deferredChildRules))); 390 } 391 392 Ref<StyleRuleMedia> StyleRuleMedia::copy() const 393 { 394 return adoptRef(*new StyleRuleMedia(*this)); 395 } 396 397 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&& rules) 398 : StyleRuleGroup(StyleRuleType::Supports, WTFMove(rules)) 371 399 , m_conditionText(conditionText) 372 400 , m_conditionIsSupported(conditionIsSupported) … … 374 402 } 375 403 376 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)377 : StyleRuleGroup(StyleRuleType::Supports, WTFMove( deferredRules))404 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& rules) 405 : StyleRuleGroup(StyleRuleType::Supports, WTFMove(rules)) 378 406 , m_conditionText(conditionText) 379 407 , m_conditionIsSupported(conditionIsSupported) … … 388 416 } 389 417 418 Ref<StyleRuleSupports> StyleRuleSupports::create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&& rules) 419 { 420 return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(rules))); 421 } 422 423 Ref<StyleRuleSupports> StyleRuleSupports::create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& rules) 424 { 425 return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(rules))); 426 } 427 390 428 StyleRuleCharset::StyleRuleCharset() 391 429 : StyleRuleBase(StyleRuleType::Charset) … … 398 436 } 399 437 400 StyleRuleCharset::~StyleRuleCharset() = default; 401 402 StyleRuleNamespace::StyleRuleNamespace(AtomString prefix, AtomString uri) 438 StyleRuleNamespace::StyleRuleNamespace(const AtomString& prefix, const AtomString& uri) 403 439 : StyleRuleBase(StyleRuleType::Namespace) 404 440 , m_prefix(prefix) … … 416 452 StyleRuleNamespace::~StyleRuleNamespace() = default; 417 453 454 Ref<StyleRuleNamespace> StyleRuleNamespace::create(const AtomString& prefix, const AtomString& uri) 455 { 456 return adoptRef(*new StyleRuleNamespace(prefix, uri)); 457 } 458 418 459 } // namespace WebCore -
trunk/Source/WebCore/css/StyleRule.h
r256477 r267576 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2006, 2008, 2012, 2013Apple Inc. All rights reserved.4 * Copyright (C) 2002-2020 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 60 60 Ref<StyleRuleBase> copy() const; 61 61 62 void deref() const 63 { 64 if (derefBase()) 65 const_cast<StyleRuleBase&>(*this).destroy(); 66 } 62 void deref() const; 67 63 68 64 // FIXME: There shouldn't be any need for the null parent version. … … 71 67 72 68 protected: 73 StyleRuleBase(StyleRuleType type, bool hasDocumentSecurityOrigin = false) 74 : m_type(static_cast<unsigned>(type)) 75 , m_hasDocumentSecurityOrigin(hasDocumentSecurityOrigin) 76 { 77 } 78 79 StyleRuleBase(const StyleRuleBase& o) 80 : WTF::RefCountedBase() 81 , m_type(o.m_type) 82 , m_hasDocumentSecurityOrigin(o.m_hasDocumentSecurityOrigin) 83 { 84 } 85 69 explicit StyleRuleBase(StyleRuleType, bool hasDocumentSecurityOrigin = false); 70 StyleRuleBase(const StyleRuleBase&); 86 71 ~StyleRuleBase() = default; 87 72 … … 102 87 WTF_MAKE_STRUCT_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(StyleRule); 103 88 public: 104 static Ref<StyleRule> create(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors) 105 { 106 return adoptRef(*new StyleRule(WTFMove(properties), hasDocumentSecurityOrigin, WTFMove(selectors))); 107 } 108 89 static Ref<StyleRule> create(Ref<StylePropertiesBase>&&, bool hasDocumentSecurityOrigin, CSSSelectorList&&); 90 Ref<StyleRule> copy() const; 109 91 ~StyleRule(); 110 92 111 93 const CSSSelectorList& selectorList() const { return m_selectorList; } 112 94 113 95 const StyleProperties& properties() const; 114 96 MutableStyleProperties& mutableProperties(); … … 117 99 using StyleRuleBase::hasDocumentSecurityOrigin; 118 100 119 void wrapperAdoptSelectorList(CSSSelectorList&& selectors) 120 { 121 m_selectorList = WTFMove(selectors); 101 void wrapperAdoptSelectorList(CSSSelectorList&&); 102 103 Vector<RefPtr<StyleRule>> splitIntoMultipleRulesWithMaximumSelectorComponentCount(unsigned) const; 104 122 105 #if ENABLE(CSS_SELECTOR_JIT) 123 m_compiledSelectors = nullptr; 124 #endif 125 } 126 127 Ref<StyleRule> copy() const { return adoptRef(*new StyleRule(*this)); } 128 129 Vector<RefPtr<StyleRule>> splitIntoMultipleRulesWithMaximumSelectorComponentCount(unsigned) const; 130 131 #if ENABLE(CSS_SELECTOR_JIT) 132 CompiledSelector& compiledSelectorForListIndex(unsigned index) const 133 { 134 if (!m_compiledSelectors) 135 m_compiledSelectors = makeUniqueArray<CompiledSelector>(m_selectorList.listSize()); 136 return m_compiledSelectors[index]; 137 } 138 void releaseCompiledSelectors() const 139 { 140 m_compiledSelectors = nullptr; 141 } 106 CompiledSelector& compiledSelectorForListIndex(unsigned index) const; 107 void releaseCompiledSelectors() const { m_compiledSelectors = nullptr; } 142 108 #endif 143 109 … … 158 124 }; 159 125 160 inline const StyleProperties* StyleRule::propertiesWithoutDeferredParsing() const161 {162 return m_properties->type() != DeferredPropertiesType ? &downcast<StyleProperties>(m_properties.get()) : nullptr;163 }164 165 126 class StyleRuleFontFace final : public StyleRuleBase { 166 127 public: … … 183 144 class StyleRulePage final : public StyleRuleBase { 184 145 public: 185 static Ref<StyleRulePage> create(Ref<StyleProperties>&& properties, CSSSelectorList&& selectors) { return adoptRef(*new StyleRulePage(WTFMove(properties), WTFMove(selectors))); }146 static Ref<StyleRulePage> create(Ref<StyleProperties>&&, CSSSelectorList&&); 186 147 187 148 ~StyleRulePage(); … … 225 186 226 187 protected: 227 StyleRuleGroup(StyleRuleType, Vector<RefPtr<StyleRuleBase>>& );188 StyleRuleGroup(StyleRuleType, Vector<RefPtr<StyleRuleBase>>&&); 228 189 StyleRuleGroup(StyleRuleType, std::unique_ptr<DeferredStyleGroupRuleList>&&); 229 190 StyleRuleGroup(const StyleRuleGroup&); … … 236 197 }; 237 198 238 inline const Vector<RefPtr<StyleRuleBase>>* StyleRuleGroup::childRulesWithoutDeferredParsing() const239 {240 return !m_deferredRules ? &m_childRules : nullptr;241 }242 243 199 class StyleRuleMedia final : public StyleRuleGroup { 244 200 public: 245 static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules) 246 { 247 return adoptRef(*new StyleRuleMedia(WTFMove(media), adoptRules)); 248 } 249 250 static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules) 251 { 252 return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(deferredChildRules))); 253 } 254 255 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 256 257 Ref<StyleRuleMedia> copy() const { return adoptRef(*new StyleRuleMedia(*this)); } 258 259 private: 260 StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>& adoptRules); 201 static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>&&); 202 static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&&, std::unique_ptr<DeferredStyleGroupRuleList>&&); 203 Ref<StyleRuleMedia> copy() const; 204 205 MediaQuerySet& mediaQueries() const { return m_mediaQueries; } 206 207 private: 208 StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>&&); 261 209 StyleRuleMedia(Ref<MediaQuerySet>&&, std::unique_ptr<DeferredStyleGroupRuleList>&&); 262 210 StyleRuleMedia(const StyleRuleMedia&); 263 211 264 Ref Ptr<MediaQuerySet> m_mediaQueries;212 Ref<MediaQuerySet> m_mediaQueries; 265 213 }; 266 214 267 215 class StyleRuleSupports final : public StyleRuleGroup { 268 216 public: 269 static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules) 270 { 271 return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, adoptRules)); 272 } 273 274 static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules) 275 { 276 return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(deferredChildRules))); 277 } 217 static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&&); 218 static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&&); 219 Ref<StyleRuleSupports> copy() const { return adoptRef(*new StyleRuleSupports(*this)); } 278 220 279 221 String conditionText() const { return m_conditionText; } 280 222 bool conditionIsSupported() const { return m_conditionIsSupported; } 281 Ref<StyleRuleSupports> copy() const { return adoptRef(*new StyleRuleSupports(*this)); } 282 283 private: 284 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules); 223 224 private: 225 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>&&); 285 226 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&&); 286 287 227 StyleRuleSupports(const StyleRuleSupports&); 288 228 … … 294 234 class StyleRuleCharset final : public StyleRuleBase { 295 235 public: 296 static Ref<StyleRuleCharset> create() { return adoptRef(*new StyleRuleCharset()); } 297 298 ~StyleRuleCharset(); 299 236 static Ref<StyleRuleCharset> create() { return adoptRef(*new StyleRuleCharset); } 300 237 Ref<StyleRuleCharset> copy() const { return adoptRef(*new StyleRuleCharset(*this)); } 301 238 302 239 private: 303 explicitStyleRuleCharset();240 StyleRuleCharset(); 304 241 StyleRuleCharset(const StyleRuleCharset&); 305 242 }; … … 307 244 class StyleRuleNamespace final : public StyleRuleBase { 308 245 public: 309 static Ref<StyleRuleNamespace> create(AtomString prefix, AtomString uri) 310 { 311 return adoptRef(*new StyleRuleNamespace(prefix, uri)); 312 } 246 static Ref<StyleRuleNamespace> create(const AtomString& prefix, const AtomString& uri); 313 247 314 248 ~StyleRuleNamespace(); … … 320 254 321 255 private: 322 StyleRuleNamespace( AtomString prefix, AtomStringuri);256 StyleRuleNamespace(const AtomString& prefix, const AtomString& uri); 323 257 StyleRuleNamespace(const StyleRuleNamespace&); 324 258 325 259 AtomString m_prefix; 326 260 AtomString m_uri; 327 261 }; 328 262 263 inline StyleRuleBase::StyleRuleBase(StyleRuleType type, bool hasDocumentSecurityOrigin) 264 : m_type(static_cast<unsigned>(type)) 265 , m_hasDocumentSecurityOrigin(hasDocumentSecurityOrigin) 266 { 267 } 268 269 inline StyleRuleBase::StyleRuleBase(const StyleRuleBase& o) 270 : WTF::RefCountedBase() 271 , m_type(o.m_type) 272 , m_hasDocumentSecurityOrigin(o.m_hasDocumentSecurityOrigin) 273 { 274 } 275 276 inline void StyleRuleBase::deref() const 277 { 278 if (derefBase()) 279 const_cast<StyleRuleBase&>(*this).destroy(); 280 } 281 282 inline void StyleRule::wrapperAdoptSelectorList(CSSSelectorList&& selectors) 283 { 284 m_selectorList = WTFMove(selectors); 285 #if ENABLE(CSS_SELECTOR_JIT) 286 m_compiledSelectors = nullptr; 287 #endif 288 } 289 290 #if ENABLE(CSS_SELECTOR_JIT) 291 292 inline CompiledSelector& StyleRule::compiledSelectorForListIndex(unsigned index) const 293 { 294 if (!m_compiledSelectors) 295 m_compiledSelectors = makeUniqueArray<CompiledSelector>(m_selectorList.listSize()); 296 return m_compiledSelectors[index]; 297 } 298 299 #endif 300 301 inline const StyleProperties* StyleRule::propertiesWithoutDeferredParsing() const 302 { 303 return m_properties->type() != DeferredPropertiesType ? &downcast<StyleProperties>(m_properties.get()) : nullptr; 304 } 305 306 inline const Vector<RefPtr<StyleRuleBase>>* StyleRuleGroup::childRulesWithoutDeferredParsing() const 307 { 308 return !m_deferredRules ? &m_childRules : nullptr; 309 } 310 329 311 } // namespace WebCore 330 312 … … 354 336 355 337 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleKeyframe) 356 static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isKeyframeRule(); }338 static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isKeyframeRule(); } 357 339 SPECIALIZE_TYPE_TRAITS_END() 358 340 359 341 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleCharset) 360 static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isCharsetRule(); } 361 SPECIALIZE_TYPE_TRAITS_END() 362 342 static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isCharsetRule(); } 343 SPECIALIZE_TYPE_TRAITS_END() -
trunk/Source/WebCore/css/StyleSheet.idl
r204717 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008, 2009Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 22 22 CustomToJSObject, 23 23 ExportToWrappedFunction, 24 Exposed=Window, 24 25 GenerateIsReachable, 25 26 JSCustomHeader, … … 32 33 readonly attribute DOMString? href; 33 34 readonly attribute DOMString? title; 34 readonly attribute MediaList media;35 [SameObject, PutForwards=mediaText] readonly attribute MediaList media; 35 36 }; -
trunk/Source/WebCore/css/StyleSheetContents.cpp
r258789 r267576 153 153 154 154 if (is<StyleRuleMedia>(rule)) 155 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast<StyleRuleMedia>(rule.get()).mediaQueries());155 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), &downcast<StyleRuleMedia>(rule.get()).mediaQueries()); 156 156 157 157 // NOTE: The selector list has to fit into RuleData. <http://webkit.org/b/118369> -
trunk/Source/WebCore/css/StyleSheetList.idl
r238758 r267576 1 1 /* 2 * Copyright (C) 2006 , 2007, 2009Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 21 21 [ 22 22 ExportToWrappedFunction, 23 Exposed=Window, 23 24 GenerateIsReachable=ImplOwnerNodeRoot, 24 25 ImplementationLacksVTable, -
trunk/Source/WebCore/css/parser/CSSParserImpl.cpp
r263771 r267576 551 551 m_observerWrapper->observer().endRuleBody(m_observerWrapper->endOffset(block)); 552 552 553 return StyleRuleMedia::create(MediaQueryParser::parseMediaQuerySet(prelude, MediaQueryParserContext(m_context)).releaseNonNull(), rules);553 return StyleRuleMedia::create(MediaQueryParser::parseMediaQuerySet(prelude, MediaQueryParserContext(m_context)).releaseNonNull(), WTFMove(rules)); 554 554 } 555 555 556 556 RefPtr<StyleRuleSupports> CSSParserImpl::consumeSupportsRule(CSSParserTokenRange prelude, CSSParserTokenRange block) 557 557 { 558 CSSSupportsParser::SupportsResultsupported = CSSSupportsParser::supportsCondition(prelude, *this, CSSSupportsParser::ForAtRule);558 auto supported = CSSSupportsParser::supportsCondition(prelude, *this, CSSSupportsParser::ForAtRule); 559 559 if (supported == CSSSupportsParser::Invalid) 560 560 return nullptr; // Parse error, invalid @supports condition … … 578 578 m_observerWrapper->observer().endRuleBody(m_observerWrapper->endOffset(block)); 579 579 580 return StyleRuleSupports::create(prelude.serialize().stripWhiteSpace(), supported, rules);580 return StyleRuleSupports::create(prelude.serialize().stripWhiteSpace(), supported, WTFMove(rules)); 581 581 } 582 582 -
trunk/Source/WebCore/style/RuleSet.cpp
r264488 r267576 283 283 if (is<StyleRuleMedia>(*rule)) { 284 284 auto& mediaRule = downcast<StyleRuleMedia>(*rule); 285 if (mediaQueryCollector.pushAndEvaluate( mediaRule.mediaQueries()))285 if (mediaQueryCollector.pushAndEvaluate(&mediaRule.mediaQueries())) 286 286 addChildRules(mediaRule.childRules(), mediaQueryCollector, resolver, mode); 287 mediaQueryCollector.pop( mediaRule.mediaQueries());287 mediaQueryCollector.pop(&mediaRule.mediaQueries()); 288 288 continue; 289 289 } -
trunk/Source/WebCore/style/UserAgentStyle.cpp
r263977 r267576 169 169 continue; 170 170 auto& mediaRule = downcast<StyleRuleMedia>(*rule); 171 auto *mediaQuery = mediaRule.mediaQueries();172 if ( !mediaQuery)171 auto& mediaQuery = mediaRule.mediaQueries(); 172 if (screenEval().evaluate(mediaQuery, nullptr)) 173 173 continue; 174 if (screenEval().evaluate(*mediaQuery, nullptr)) 175 continue; 176 if (printEval().evaluate(*mediaQuery, nullptr)) 174 if (printEval().evaluate(mediaQuery, nullptr)) 177 175 continue; 178 176 mediaQueryStyleSheet->parserAppendRule(mediaRule.copy()); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r267575 r267576 1 2020-09-24 Darin Adler <darin@apple.com> 2 3 Add CSSConditionRule and CSSGroupingRule 4 https://bugs.webkit.org/show_bug.cgi?id=216855 5 6 Reviewed by Sam Weinig. 7 8 * DOM/DOMCSS.mm: 9 (kitClass): Added a default case since we don't intend to list every single rule type here. 10 1 11 2020-09-25 Sam Weinig <weinig@apple.com> 2 12 -
trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm
r256477 r267576 76 76 case WebCore::CSSRule::PAGE_RULE: 77 77 return [DOMCSSPageRule class]; 78 case WebCore::CSSRule::KEYFRAMES_RULE: 79 case WebCore::CSSRule::NAMESPACE_RULE: 80 case WebCore::CSSRule::KEYFRAME_RULE: 81 case WebCore::CSSRule::SUPPORTS_RULE: 78 default: 82 79 return [DOMCSSRule class]; 83 80 } 84 ASSERT_NOT_REACHED();85 return nil;86 81 } 87 82 … … 96 91 case WebCore::DeprecatedCSSOMValue::CSS_VALUE_LIST: 97 92 return [DOMCSSValueList class]; 98 case WebCore::DeprecatedCSSOMValue::CSS_INHERIT: 99 case WebCore::DeprecatedCSSOMValue::CSS_CUSTOM: 93 default: 100 94 return [DOMCSSValue class]; 101 95 } 102 ASSERT_NOT_REACHED();103 return nil;104 96 } 105 97
Note:
See TracChangeset
for help on using the changeset viewer.