Changeset 276209 in webkit
- Timestamp:
- Apr 17, 2021, 3:38:29 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSStyleSheet.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSStyleSheet.h (modified) (3 diffs)
-
Source/WebCore/css/CSSStyleSheet.idl (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp (modified) (1 diff)
-
Source/WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/mac/DOM/DOMCSSStyleSheet.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r276203 r276209 1 2021-04-17 Tyler Wilcock <twilco.o@protonmail.com> 2 3 Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules(). 4 https://bugs.webkit.org/show_bug.cgi?id=197725 5 6 Reviewed by Darin Adler. 7 8 To match other browsers and the below WPT, CSSStyleSheet.rules now aliases 9 CSSStyleSheet.cssRulesForBindings, meaning we pass two more tests. 10 11 * web-platform-tests/css/cssom/CSSStyleSheet-expected.txt: 12 1 13 2021-04-17 Tim Nguyen <ntim@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-expected.txt
r267650 r276209 14 14 PASS addRule with no argument adds "undefined" selector 15 15 PASS addRule with index greater than length throws 16 FAIL cssRules and rules are the same object assert_equals: expected object "[object CSSRuleList]" but got object "[object CSSRuleList]" 16 PASS cssRules and rules are the same object 17 17 PASS cssRules returns the same object twice 18 FAIL rules returns the same object twice assert_equals: expected object "[object CSSRuleList]" but got object "[object CSSRuleList]" 18 PASS rules returns the same object twice 19 19 -
trunk/Source/WebCore/ChangeLog
r276208 r276209 1 2021-04-17 Tyler Wilcock <twilco.o@protonmail.com> 2 3 Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules(). 4 https://bugs.webkit.org/show_bug.cgi?id=197725 5 6 Reviewed by Darin Adler. 7 8 To match other browsers (Blink and Gecko) and pass a WPT, CSSStyleSheet.rules now aliases 9 CSSStyleSheet.cssRulesForBindings. CSSStyleSheet.rulesForBindings is deleted. 10 11 Tested by 12 imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet.html. 13 14 * css/CSSStyleSheet.cpp: 15 (WebCore::CSSStyleSheet::rulesForBindings): Deleted. 16 (WebCore::CSSStyleSheet::rules): Deleted. 17 18 * css/CSSStyleSheet.h: 19 Change `rules()` to be an inlined alias for `cssRulesForBindings()`. 20 21 * css/CSSStyleSheet.idl: 22 Remove [ImplementedAs=rulesForBindings], as this function has been 23 deleted. 24 1 25 2021-04-17 Tyler Wilcock <twilco.o@protonmail.com> 2 26 -
trunk/Source/WebCore/css/CSSStyleSheet.cpp
r270296 r276209 255 255 } 256 256 257 ExceptionOr<Ref<CSSRuleList>> CSSStyleSheet::rulesForBindings()258 {259 auto rules = this->rules();260 if (!rules)261 return Exception { SecurityError, "Not allowed to access cross-origin stylesheet"_s };262 return rules.releaseNonNull();263 }264 265 RefPtr<CSSRuleList> CSSStyleSheet::rules()266 {267 if (!canAccessRules())268 return nullptr;269 // IE behavior.270 auto ruleList = StaticCSSRuleList::create();271 unsigned ruleCount = length();272 for (unsigned i = 0; i < ruleCount; ++i)273 ruleList->rules().append(item(i));274 return ruleList;275 }276 277 257 ExceptionOr<unsigned> CSSStyleSheet::insertRule(const String& ruleString, unsigned index) 278 258 { -
trunk/Source/WebCore/css/CSSStyleSheet.h
r270296 r276209 21 21 #pragma once 22 22 23 #include "CSSRuleList.h" 23 24 #include "ExceptionOr.h" 24 25 #include "StyleSheet.h" … … 34 35 class CSSParser; 35 36 class CSSRule; 36 class CSSRuleList;37 37 class CSSStyleSheet; 38 38 class CachedCSSStyleSheet; … … 63 63 void setDisabled(bool) final; 64 64 65 WEBCORE_EXPORT RefPtr<CSSRuleList> cssRules(); 65 66 ExceptionOr<Ref<CSSRuleList>> cssRulesForBindings(); 66 ExceptionOr<Ref<CSSRuleList>> rules ForBindings();67 ExceptionOr<Ref<CSSRuleList>> rules() { return this->cssRulesForBindings(); } 67 68 68 WEBCORE_EXPORT RefPtr<CSSRuleList> cssRules();69 69 WEBCORE_EXPORT ExceptionOr<unsigned> insertRule(const String& rule, unsigned index); 70 70 WEBCORE_EXPORT ExceptionOr<void> deleteRule(unsigned index); 71 71 72 WEBCORE_EXPORT RefPtr<CSSRuleList> rules();73 72 WEBCORE_EXPORT ExceptionOr<int> addRule(const String& selector, const String& style, Optional<unsigned> index); 74 73 ExceptionOr<void> removeRule(unsigned index) { return deleteRule(index); } -
trunk/Source/WebCore/css/CSSStyleSheet.idl
r274832 r276209 27 27 undefined deleteRule(unsigned long index); 28 28 29 [ImplementedAs=rulesForBindings]readonly attribute CSSRuleList rules;29 readonly attribute CSSRuleList rules; 30 30 long addRule(optional DOMString selector = "undefined", optional DOMString style = "undefined", optional unsigned long index); 31 31 undefined removeRule(optional unsigned long index = 0); -
trunk/Source/WebKit/ChangeLog
r276204 r276209 1 2021-04-17 Tyler Wilcock <twilco.o@protonmail.com> 2 3 Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules(). 4 https://bugs.webkit.org/show_bug.cgi?id=197725 5 6 Reviewed by Darin Adler. 7 8 CSSStyleSheet.rules has been changed to alias CSSStyleSheet.cssRulesForBindings. Now, 9 to access just the CSSRuleList, CSSStyleSheet.cssRules must be called. 10 11 * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp: 12 (webkit_dom_css_style_sheet_get_rules): 13 Use CSSStyleSheet.cssRules instead of CSSStyleSheet.rules (deleted 14 with this patch) to get access to the CSSRuleList of this 15 stylesheet. 16 1 17 2021-04-17 Sam Weinig <weinig@apple.com> 2 18 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp
r234586 r276209 213 213 g_return_val_if_fail(WEBKIT_DOM_IS_CSS_STYLE_SHEET(self), 0); 214 214 WebCore::CSSStyleSheet* item = WebKit::core(self); 215 RefPtr<WebCore::CSSRuleList> gobjectResult = WTF::getPtr(item-> rules());215 RefPtr<WebCore::CSSRuleList> gobjectResult = WTF::getPtr(item->cssRules()); 216 216 return WebKit::kit(gobjectResult.get()); 217 217 } -
trunk/Source/WebKitLegacy/mac/ChangeLog
r276191 r276209 1 2021-04-17 Tyler Wilcock <twilco.o@protonmail.com> 2 3 Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules(). 4 https://bugs.webkit.org/show_bug.cgi?id=197725 5 6 Reviewed by Darin Adler. 7 8 CSSStyleSheet.rules has been changed to alias CSSStyleSheet.cssRulesForBindings. Now, 9 to access just the CSSRuleList, CSSStyleSheet.cssRules must be called. 10 11 * DOM/DOMCSSStyleSheet.mm: 12 (-[DOMCSSStyleSheet rules]): 13 Update this function to call IMPL->cssRules instead of IMPL->rules. 14 1 15 2021-04-16 Ryosuke Niwa <rniwa@webkit.org> 2 16 -
trunk/Source/WebKitLegacy/mac/DOM/DOMCSSStyleSheet.mm
r247570 r276209 60 60 { 61 61 WebCore::JSMainThreadNullState state; 62 return kit(WTF::getPtr(IMPL->rules())); 62 // Calling IMPL->cssRules (not IMPL->rules) is intentional, as `rules` should just be an alias for `cssRules`. 63 // See https://bugs.webkit.org/show_bug.cgi?id=197725 for more information. 64 return kit(WTF::getPtr(IMPL->cssRules())); 63 65 } 64 66
Note:
See TracChangeset
for help on using the changeset viewer.