mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implements StyleSheet.media
This commit is contained in:
parent
2af9648235
commit
66223f7596
18 changed files with 16 additions and 980 deletions
|
@ -10,6 +10,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::cssrulelist::{CSSRuleList, RulesSource};
|
||||
use crate::dom::element::Element;
|
||||
use crate::dom::medialist::MediaList;
|
||||
use crate::dom::node::{stylesheets_owner_from_node, Node};
|
||||
use crate::dom::stylesheet::StyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
|
@ -100,6 +101,14 @@ impl CSSStyleSheet {
|
|||
pub fn set_origin_clean(&self, origin_clean: bool) {
|
||||
self.origin_clean.set(origin_clean);
|
||||
}
|
||||
|
||||
pub fn medialist(&self) -> DomRoot<MediaList> {
|
||||
MediaList::new(
|
||||
self.global().as_window(),
|
||||
self,
|
||||
self.style_stylesheet().media.clone(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl CSSStyleSheetMethods for CSSStyleSheet {
|
||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::element::Element;
|
||||
use crate::dom::medialist::MediaList;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -51,6 +52,11 @@ impl StyleSheetMethods for StyleSheet {
|
|||
self.downcast::<CSSStyleSheet>().and_then(|s| s.get_owner())
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-stylesheet-media
|
||||
fn Media(&self) -> DomRoot<MediaList> {
|
||||
self.downcast::<CSSStyleSheet>().unwrap().medialist()
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-stylesheet-title
|
||||
fn GetTitle(&self) -> Option<DOMString> {
|
||||
self.title.clone()
|
||||
|
|
|
@ -12,7 +12,7 @@ interface StyleSheet {
|
|||
// readonly attribute StyleSheet? parentStyleSheet;
|
||||
readonly attribute DOMString? title;
|
||||
|
||||
// [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
attribute boolean disabled;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
[MediaList2.xhtml]
|
||||
[MediaList.mediaText]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList.length]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList getter]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList.item]
|
||||
expected: FAIL
|
|
@ -8,9 +8,6 @@
|
|||
[Existence and writability of CSSImportRule attributes]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet : MediaList mediaText attribute should be updated due to [PutForwards\]]
|
||||
expected: FAIL
|
||||
|
||||
[CSSImportRule : MediaList mediaText attribute should be updated due to [PutForwards\]]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
[CSSStyleDeclaration interface: style_element.style must inherit property "parentRule" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "deleteMedium(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: sheet.cssRules[4\].style must inherit property "setProperty(CSSOMString, CSSOMString, optional CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -20,9 +17,6 @@
|
|||
[Stringification of svg_element.style]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: calling item(unsigned long) on sheet.media with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleSheet interface: sheet must inherit property "ownerRule" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -53,18 +47,9 @@
|
|||
[CSSMarginRule interface: sheet.cssRules[2\].cssRules[0\] must inherit property "style" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "item(unsigned long)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: svg_element.style must inherit property "getPropertyValue(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "length" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet interface: sheet must inherit property "media" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[SVGStyleElement interface: attribute sheet]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -89,9 +74,6 @@
|
|||
[StyleSheet interface: attribute type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: calling appendMedium(CSSOMString) on sheet.media with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of sheet.cssRules[2\].cssRules[0\]]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -248,9 +230,6 @@
|
|||
[StyleSheet interface: sheet must inherit property "parentStyleSheet" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: calling deleteMedium(CSSOMString) on sheet.media with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CSSPageRule interface: sheet.cssRules[2\] must inherit property "selectorText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -275,9 +254,6 @@
|
|||
[CSSStyleDeclaration interface: sheet.cssRules[2\].style must inherit property "getPropertyPriority(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "mediaText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: sheet.cssRules[2\].cssRules[0\].style must inherit property "removeProperty(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -296,9 +272,6 @@
|
|||
[CSSStyleDeclaration interface: calling getPropertyValue(CSSOMString) on sheet.cssRules[4\].style with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "appendMedium(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: sheet.cssRules[4\].style must inherit property "length" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -323,9 +296,6 @@
|
|||
[SVGElement interface: svg_element must inherit property "style" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet interface: attribute media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSPageRule interface: attribute style]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -344,9 +314,6 @@
|
|||
[CSSStyleDeclaration interface: sheet.cssRules[4\].style must inherit property "getPropertyValue(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList must be primary interface of sheet.media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSRule interface: sheet.cssRules[2\].cssRules[0\] must inherit property "PAGE_RULE" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -407,9 +374,6 @@
|
|||
[CSSStyleDeclaration interface: svg_element.style must inherit property "cssText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of sheet.media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSRule interface: sheet.cssRules[2\].cssRules[0\] must inherit property "type" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[medialist-dynamic-001.html]
|
||||
expected: FAIL
|
|
@ -8,6 +8,3 @@
|
|||
[mediatest_medialist_serialize_element]
|
||||
expected: FAIL
|
||||
|
||||
[mediatest_medialist_serialize_empty]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -2,6 +2,3 @@
|
|||
[deleteMedium_no_matching_medium_to_remove]
|
||||
expected: FAIL
|
||||
|
||||
[deleteMedium_removes_correct_medium]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[medialist-interfaces-004.html]
|
||||
[appendMedium_correctly_appends_medium_to_empty_MediaList]
|
||||
expected: FAIL
|
||||
|
||||
[appendMedium_correctly_appends_medium_to_nonempty_MediaList]
|
||||
expected: FAIL
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
[MediaList2.xhtml]
|
||||
[MediaList.mediaText]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList.length]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList getter]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList.item]
|
||||
expected: FAIL
|
|
@ -21,6 +21,3 @@
|
|||
[CSSStyleDeclaration cssText attribute should be updated due to [PutForwards\]]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet : MediaList mediaText attribute should be updated due to [PutForwards\]]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -8,18 +8,12 @@
|
|||
[CSSStyleDeclaration interface: style_element.style must inherit property "parentRule" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "deleteMedium(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: sheet.cssRules[2\].style must inherit property "removeProperty(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of svg_element.style]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: calling item(unsigned long) on sheet.media with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleSheet interface: sheet must inherit property "ownerRule" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -56,18 +50,9 @@
|
|||
[CSSMarginRule interface: sheet.cssRules[2\].cssRules[0\] must inherit property "style" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "item(unsigned long)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: svg_element.style must inherit property "getPropertyValue(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "length" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet interface: sheet must inherit property "media" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[SVGStyleElement interface: attribute sheet]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -227,9 +212,6 @@
|
|||
[CSSStyleDeclaration interface: sheet.cssRules[2\].cssRules[0\].style must inherit property "getPropertyValue(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: calling appendMedium(CSSOMString) on sheet.media with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CSSRule interface: sheet.cssRules[4\] must inherit property "cssText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -248,9 +230,6 @@
|
|||
[CSSStyleDeclaration interface: sheet.cssRules[2\].cssRules[0\].style must inherit property "getPropertyPriority(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: calling deleteMedium(CSSOMString) on sheet.media with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CSSPageRule interface: sheet.cssRules[2\] must inherit property "selectorText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -275,9 +254,6 @@
|
|||
[CSSStyleDeclaration interface: sheet.cssRules[2\].style must inherit property "getPropertyPriority(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "mediaText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: sheet.cssRules[2\].style must inherit property "length" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -308,9 +284,6 @@
|
|||
[CSSStyleDeclaration interface: calling getPropertyValue(CSSOMString) on sheet.cssRules[4\].style with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: sheet.media must inherit property "appendMedium(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CSSStyleDeclaration interface: sheet.cssRules[4\].style must inherit property "length" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -335,9 +308,6 @@
|
|||
[SVGElement interface: svg_element must inherit property "style" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet interface: attribute media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSPageRule interface: attribute style]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -356,9 +326,6 @@
|
|||
[CSSStyleDeclaration interface: sheet.cssRules[4\].style must inherit property "getPropertyValue(CSSOMString)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList must be primary interface of sheet.media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSRule interface: sheet.cssRules[2\].cssRules[0\] must inherit property "PAGE_RULE" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -413,9 +380,6 @@
|
|||
[CSSStyleDeclaration interface: svg_element.style must inherit property "cssText" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of sheet.media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSRule interface: sheet.cssRules[2\].cssRules[0\] must inherit property "type" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[medialist-dynamic-001.html]
|
||||
expected: FAIL
|
|
@ -6,9 +6,6 @@
|
|||
[mediatest_medialist_serialize_comma]
|
||||
expected: FAIL
|
||||
|
||||
[mediatest_medialist_serialize_empty]
|
||||
expected: FAIL
|
||||
|
||||
[mediatest_medialist_serialize_lexicographical]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
[medialist-interfaces-002.html]
|
||||
type: testharness
|
||||
[deleteMedium_removes_correct_medium]
|
||||
expected: FAIL
|
||||
|
||||
[deleteMedium_no_matching_medium_to_remove]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
[medialist-interfaces-004.html]
|
||||
type: testharness
|
||||
[appendMedium_correctly_appends_medium_to_empty_MediaList]
|
||||
expected: FAIL
|
||||
|
||||
[appendMedium_correctly_appends_medium_to_nonempty_MediaList]
|
||||
expected: FAIL
|
||||
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue