Auto merge of #14241 - Manishearth:mut-cssom, r=SimonSapin

CSSOM: Whole ton of things

CSSOM is now starting to be useful!

Based on #14190. Only the <s>last commit</s> last two commits need review.

cc @xidorn . This doesn't change the style API, but adds useful methods.

part of #11420

This adds:
 - `insertRule()` and `deleteRule()` on `CSSStyleSheet`, `CSSGroupingRule`
 - `.style` getters on link and style elements
 - Keyframes-backed `CSSRules` and `CSSKeyframesRule.cssRules`
 - `CSSGroupingRule.cssRules`
 - `prefix` and `namespaceURI` attributes of `CSSNamespaceRule`
 - Fixups regarding parent stylesheets

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14241)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-23 10:27:49 -08:00 committed by GitHub
commit 996756687c
34 changed files with 656 additions and 192 deletions

View file

@ -1,6 +1,5 @@
[css-style-declaration-modifications.htm]
type: testharness
expected: ERROR
[CSSStyleDeclaration_accessible]
expected: FAIL

View file

@ -1,6 +1,5 @@
[cssimportrule.htm]
type: testharness
expected: ERROR
[CSSRule and CSSImportRule types]
expected: FAIL

View file

@ -1,3 +1,20 @@
[cssstylerule.htm]
type: testharness
expected: ERROR
[Rule_type_property]
expected: FAIL
[Rule_properties]
expected: FAIL
[Rule_properties_readonly]
expected: FAIL
[Rule_properties_values]
expected: FAIL
[StyleRule_properties]
expected: FAIL
[StyleRule_properties_values]
expected: FAIL

View file

@ -120,51 +120,18 @@
[CSSStyleSheet interface: attribute ownerRule]
expected: FAIL
[CSSStyleSheet interface: operation insertRule(DOMString,unsigned long)]
expected: FAIL
[CSSStyleSheet interface: operation deleteRule(unsigned long)]
expected: FAIL
[CSSStyleSheet must be primary interface of style_element.sheet]
expected: FAIL
[Stringification of style_element.sheet]
expected: FAIL
[CSSStyleSheet interface: style_element.sheet must inherit property "ownerRule" with the proper type (0)]
expected: FAIL
[CSSStyleSheet interface: style_element.sheet must inherit property "cssRules" with the proper type (1)]
expected: FAIL
[CSSStyleSheet interface: style_element.sheet must inherit property "insertRule" with the proper type (2)]
expected: FAIL
[CSSStyleSheet interface: calling insertRule(DOMString,unsigned long) on style_element.sheet with too few arguments must throw TypeError]
expected: FAIL
[CSSStyleSheet interface: style_element.sheet must inherit property "deleteRule" with the proper type (3)]
expected: FAIL
[CSSStyleSheet interface: calling deleteRule(unsigned long) on style_element.sheet with too few arguments must throw TypeError]
expected: FAIL
[StyleSheet interface: style_element.sheet must inherit property "type" with the proper type (0)]
expected: FAIL
[StyleSheet interface: style_element.sheet must inherit property "href" with the proper type (1)]
expected: FAIL
[StyleSheet interface: style_element.sheet must inherit property "ownerNode" with the proper type (2)]
expected: FAIL
[StyleSheet interface: style_element.sheet must inherit property "parentStyleSheet" with the proper type (3)]
expected: FAIL
[StyleSheet interface: style_element.sheet must inherit property "title" with the proper type (4)]
expected: FAIL
[StyleSheet interface: style_element.sheet must inherit property "media" with the proper type (5)]
expected: FAIL
@ -177,21 +144,6 @@
[CSSRuleList interface: existence and properties of interface prototype object]
expected: FAIL
[CSSRuleList must be primary interface of style_element.sheet.cssRules]
expected: FAIL
[Stringification of style_element.sheet.cssRules]
expected: FAIL
[CSSRuleList interface: style_element.sheet.cssRules must inherit property "item" with the proper type (0)]
expected: FAIL
[CSSRuleList interface: calling item(unsigned long) on style_element.sheet.cssRules with too few arguments must throw TypeError]
expected: FAIL
[CSSRuleList interface: style_element.sheet.cssRules must inherit property "length" with the proper type (1)]
expected: FAIL
[CSSRule interface: attribute parentRule]
expected: FAIL
@ -201,54 +153,15 @@
[CSSStyleRule interface: attribute style]
expected: FAIL
[CSSStyleRule must be primary interface of style_element.sheet.cssRules[0\]]
expected: FAIL
[Stringification of style_element.sheet.cssRules[0\]]
expected: FAIL
[CSSStyleRule interface: style_element.sheet.cssRules[0\] must inherit property "selectorText" with the proper type (0)]
expected: FAIL
[CSSStyleRule interface: style_element.sheet.cssRules[0\] must inherit property "style" with the proper type (1)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "STYLE_RULE" with the proper type (0)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "CHARSET_RULE" with the proper type (1)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "IMPORT_RULE" with the proper type (2)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "MEDIA_RULE" with the proper type (3)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "FONT_FACE_RULE" with the proper type (4)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "PAGE_RULE" with the proper type (5)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "MARGIN_RULE" with the proper type (6)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "NAMESPACE_RULE" with the proper type (7)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "type" with the proper type (8)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "cssText" with the proper type (9)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "parentRule" with the proper type (10)]
expected: FAIL
[CSSRule interface: style_element.sheet.cssRules[0\] must inherit property "parentStyleSheet" with the proper type (11)]
expected: FAIL
[CSSImportRule interface: existence and properties of interface object]
expected: FAIL
@ -270,15 +183,6 @@
[CSSImportRule interface: attribute styleSheet]
expected: FAIL
[CSSGroupingRule interface: attribute cssRules]
expected: FAIL
[CSSGroupingRule interface: operation insertRule(DOMString,unsigned long)]
expected: FAIL
[CSSGroupingRule interface: operation deleteRule(unsigned long)]
expected: FAIL
[CSSMediaRule interface: attribute media]
expected: FAIL
@ -318,12 +222,6 @@
[CSSMarginRule interface: attribute style]
expected: FAIL
[CSSNamespaceRule interface: attribute namespaceURI]
expected: FAIL
[CSSNamespaceRule interface: attribute prefix]
expected: FAIL
[CSSStyleDeclaration interface: attribute parentRule]
expected: FAIL

View file

@ -1,8 +1,5 @@
[medialist-interfaces-002.htm]
type: testharness
[deleteMedium_called_without_argument]
expected: FAIL
[deleteMedium_removes_correct_medium]
expected: FAIL

View file

@ -1,8 +0,0 @@
[style-sheet-interfaces-002.htm]
type: testharness
[add_rule]
expected: FAIL
[delete_rule]
expected: FAIL

View file

@ -1359,9 +1359,6 @@
[HTMLLinkElement interface: document.createElement("link") must inherit property "sizes" with the proper type (7)]
expected: FAIL
[HTMLLinkElement interface: document.createElement("link") must inherit property "sheet" with the proper type (11)]
expected: FAIL
[HTMLMetaElement interface: attribute httpEquiv]
expected: FAIL
@ -1392,9 +1389,6 @@
[HTMLStyleElement interface: document.createElement("style") must inherit property "scoped" with the proper type (2)]
expected: FAIL
[HTMLStyleElement interface: document.createElement("style") must inherit property "sheet" with the proper type (3)]
expected: FAIL
[HTMLBodyElement interface: attribute link]
expected: FAIL

View file

@ -3,9 +3,6 @@
[The LinkStyle interface's sheet attribute must return null; the disabled attribute must be false]
expected: FAIL
[The LinkStyle interface's sheet attribute must return null if the corresponding element is not in a Document]
expected: FAIL
[The LinkStyle interface's sheet attribute must return StyleSheet object; the disabled attribute must be same as the StyleSheet's disabled attribute]
expected: FAIL

View file

@ -22,6 +22,7 @@ test_interfaces([
"CSS",
"CSSFontFaceRule",
"CSSGroupingRule",
"CSSKeyframeRule",
"CSSKeyframesRule",
"CSSMediaRule",
"CSSNamespaceRule",