diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 850bef189c7..6f211f82bef 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -99,6 +99,7 @@ use style::media_queries::MediaList; use style::properties::PropertyDeclarationBlock; use style::selector_parser::{PseudoElement, Snapshot}; use style::stylesheets::{CssRules, KeyframesRule, MediaRule, NamespaceRule, StyleRule, ImportRule}; +use style::stylesheets::SupportsRule; use style::values::specified::Length; use style::viewport::ViewportRule; use time::Duration; @@ -531,6 +532,12 @@ unsafe impl JSTraceable for RwLock { } } +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + unsafe impl JSTraceable for RwLock { unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing. diff --git a/components/script/dom/css.rs b/components/script/dom/css.rs index 2e04aed50bc..bf264f14322 100644 --- a/components/script/dom/css.rs +++ b/components/script/dom/css.rs @@ -2,11 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use cssparser::serialize_identifier; +use cssparser::{Parser, serialize_identifier}; +use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::Reflector; use dom::bindings::str::DOMString; use dom::window::Window; +use style::parser::ParserContext; +use style::supports::{Declaration, parse_condition_or_declaration}; #[dom_struct] pub struct CSS { @@ -14,10 +17,31 @@ pub struct CSS { } impl CSS { - // http://dev.w3.org/csswg/cssom/#serialize-an-identifier + /// http://dev.w3.org/csswg/cssom/#serialize-an-identifier pub fn Escape(_: &Window, ident: DOMString) -> Fallible { let mut escaped = String::new(); serialize_identifier(&ident, &mut escaped).unwrap(); Ok(DOMString::from(escaped)) } + + /// https://drafts.csswg.org/css-conditional/#dom-css-supports + pub fn Supports(win: &Window, property: DOMString, value: DOMString) -> bool { + let decl = Declaration { prop: property.into(), val: value.into() }; + let url = win.Document().url(); + let context = ParserContext::new_for_cssom(&url); + decl.eval(&context) + } + + /// https://drafts.csswg.org/css-conditional/#dom-css-supports + pub fn Supports_(win: &Window, condition: DOMString) -> bool { + let mut input = Parser::new(&condition); + let cond = parse_condition_or_declaration(&mut input); + if let Ok(cond) = cond { + let url = win.Document().url(); + let context = ParserContext::new_for_cssom(&url); + cond.eval(&context) + } else { + false + } + } } diff --git a/components/script/dom/cssconditionrule.rs b/components/script/dom/cssconditionrule.rs new file mode 100644 index 00000000000..dace5f612c7 --- /dev/null +++ b/components/script/dom/cssconditionrule.rs @@ -0,0 +1,53 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::bindings::codegen::Bindings::CSSConditionRuleBinding::CSSConditionRuleMethods; +use dom::bindings::inheritance::Castable; +use dom::bindings::str::DOMString; +use dom::cssgroupingrule::CSSGroupingRule; +use dom::cssmediarule::CSSMediaRule; +use dom::cssstylesheet::CSSStyleSheet; +use dom::csssupportsrule::CSSSupportsRule; +use parking_lot::RwLock; +use std::sync::Arc; +use style::stylesheets::CssRules as StyleCssRules; + +#[dom_struct] +pub struct CSSConditionRule { + cssgroupingrule: CSSGroupingRule, +} + +impl CSSConditionRule { + pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, + rules: Arc>) -> CSSConditionRule { + CSSConditionRule { + cssgroupingrule: CSSGroupingRule::new_inherited(parent_stylesheet, rules), + } + } + +} + +impl CSSConditionRuleMethods for CSSConditionRule { + /// https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext + fn ConditionText(&self) -> DOMString { + if let Some(rule) = self.downcast::() { + rule.get_condition_text() + } else if let Some(rule) = self.downcast::() { + rule.get_condition_text() + } else { + unreachable!() + } + } + + /// https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext + fn SetConditionText(&self, text: DOMString) { + if let Some(rule) = self.downcast::() { + rule.set_condition_text(text) + } else if let Some(rule) = self.downcast::() { + rule.set_condition_text(text) + } else { + unreachable!() + } + } +} diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index b6b04dde9d8..438b390aea5 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -2,24 +2,26 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use cssparser::Parser; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::str::DOMString; -use dom::cssgroupingrule::CSSGroupingRule; +use dom::cssconditionrule::CSSConditionRule; use dom::cssrule::SpecificCSSRule; use dom::cssstylesheet::CSSStyleSheet; use dom::medialist::MediaList; use dom::window::Window; use parking_lot::RwLock; use std::sync::Arc; +use style::media_queries::parse_media_query_list; use style::stylesheets::MediaRule; use style_traits::ToCss; #[dom_struct] pub struct CSSMediaRule { - cssrule: CSSGroupingRule, + cssrule: CSSConditionRule, #[ignore_heap_size_of = "Arc"] mediarule: Arc>, medialist: MutNullableJS, @@ -30,7 +32,7 @@ impl CSSMediaRule { -> CSSMediaRule { let list = mediarule.read().rules.clone(); CSSMediaRule { - cssrule: CSSGroupingRule::new_inherited(parent_stylesheet, list), + cssrule: CSSConditionRule::new_inherited(parent_stylesheet, list), mediarule: mediarule, medialist: MutNullableJS::new(None), } @@ -48,6 +50,22 @@ impl CSSMediaRule { self.medialist.or_init(|| MediaList::new(self.global().as_window(), self.mediarule.read().media_queries.clone())) } + + /// https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface + pub fn get_condition_text(&self) -> DOMString { + let rule = self.mediarule.read(); + let list = rule.media_queries.read(); + list.to_css_string().into() + } + + /// https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface + pub fn set_condition_text(&self, text: DOMString) { + let mut input = Parser::new(&text); + let new_medialist = parse_media_query_list(&mut input); + let rule = self.mediarule.read(); + let mut list = rule.media_queries.write(); + *list = new_medialist; + } } impl SpecificCSSRule for CSSMediaRule { diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs index 8323d7e22b0..4fa4041a8d7 100644 --- a/components/script/dom/cssrule.rs +++ b/components/script/dom/cssrule.rs @@ -15,6 +15,7 @@ use dom::cssmediarule::CSSMediaRule; use dom::cssnamespacerule::CSSNamespaceRule; use dom::cssstylerule::CSSStyleRule; use dom::cssstylesheet::CSSStyleSheet; +use dom::csssupportsrule::CSSSupportsRule; use dom::cssviewportrule::CSSViewportRule; use dom::window::Window; use std::cell::Cell; @@ -59,6 +60,8 @@ impl CSSRule { rule as &SpecificCSSRule } else if let Some(rule) = self.downcast::() { rule as &SpecificCSSRule + } else if let Some(rule) = self.downcast::() { + rule as &SpecificCSSRule } else { unreachable!() } @@ -77,6 +80,7 @@ impl CSSRule { StyleCssRule::Media(s) => Root::upcast(CSSMediaRule::new(window, parent_stylesheet, s)), StyleCssRule::Namespace(s) => Root::upcast(CSSNamespaceRule::new(window, parent_stylesheet, s)), StyleCssRule::Viewport(s) => Root::upcast(CSSViewportRule::new(window, parent_stylesheet, s)), + StyleCssRule::Supports(s) => Root::upcast(CSSSupportsRule::new(window, parent_stylesheet, s)), } } diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs new file mode 100644 index 00000000000..3e52fa3afc5 --- /dev/null +++ b/components/script/dom/csssupportsrule.rs @@ -0,0 +1,77 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use cssparser::Parser; +use dom::bindings::codegen::Bindings::CSSSupportsRuleBinding; +use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; +use dom::bindings::js::Root; +use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::str::DOMString; +use dom::cssconditionrule::CSSConditionRule; +use dom::cssrule::SpecificCSSRule; +use dom::cssstylesheet::CSSStyleSheet; +use dom::window::Window; +use parking_lot::RwLock; +use std::sync::Arc; +use style::parser::ParserContext; +use style::stylesheets::SupportsRule; +use style::supports::SupportsCondition; +use style_traits::ToCss; + +#[dom_struct] +pub struct CSSSupportsRule { + cssrule: CSSConditionRule, + #[ignore_heap_size_of = "Arc"] + supportsrule: Arc>, +} + +impl CSSSupportsRule { + fn new_inherited(parent_stylesheet: &CSSStyleSheet, supportsrule: Arc>) + -> CSSSupportsRule { + let list = supportsrule.read().rules.clone(); + CSSSupportsRule { + cssrule: CSSConditionRule::new_inherited(parent_stylesheet, list), + supportsrule: supportsrule, + } + } + + #[allow(unrooted_must_root)] + pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, + supportsrule: Arc>) -> Root { + reflect_dom_object(box CSSSupportsRule::new_inherited(parent_stylesheet, supportsrule), + window, + CSSSupportsRuleBinding::Wrap) + } + + /// https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface + pub fn get_condition_text(&self) -> DOMString { + let rule = self.supportsrule.read(); + rule.condition.to_css_string().into() + } + + /// https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface + pub fn set_condition_text(&self, text: DOMString) { + let mut input = Parser::new(&text); + let cond = SupportsCondition::parse(&mut input); + if let Ok(cond) = cond { + let url = self.global().as_window().Document().url(); + let context = ParserContext::new_for_cssom(&url); + let enabled = cond.eval(&context); + let mut rule = self.supportsrule.write(); + rule.condition = cond; + rule.enabled = enabled; + } + } +} + +impl SpecificCSSRule for CSSSupportsRule { + fn ty(&self) -> u16 { + use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleConstants; + CSSRuleConstants::SUPPORTS_RULE + } + + fn get_css(&self) -> DOMString { + self.supportsrule.read().to_css_string().into() + } +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 55b56977cd9..0fd610ed46b 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -240,6 +240,7 @@ pub mod console; mod create; pub mod crypto; pub mod css; +pub mod cssconditionrule; pub mod cssfontfacerule; pub mod cssgroupingrule; pub mod cssimportrule; @@ -252,6 +253,7 @@ pub mod cssrulelist; pub mod cssstyledeclaration; pub mod cssstylerule; pub mod cssstylesheet; +pub mod csssupportsrule; pub mod cssviewportrule; pub mod customevent; pub mod dedicatedworkerglobalscope; diff --git a/components/script/dom/webidls/CSS.webidl b/components/script/dom/webidls/CSS.webidl index 438c6814ccb..5f4aa4f0bef 100644 --- a/components/script/dom/webidls/CSS.webidl +++ b/components/script/dom/webidls/CSS.webidl @@ -11,3 +11,9 @@ interface CSS { [Throws] static DOMString escape(DOMString ident); }; + +// https://drafts.csswg.org/css-conditional-3/#the-css-interface +partial interface CSS { + static boolean supports(DOMString property, DOMString value); + static boolean supports(DOMString conditionText); +}; diff --git a/components/script/dom/webidls/CSSConditionRule.webidl b/components/script/dom/webidls/CSSConditionRule.webidl new file mode 100644 index 00000000000..889153a085e --- /dev/null +++ b/components/script/dom/webidls/CSSConditionRule.webidl @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://drafts.csswg.org/css-conditional/#cssconditionrule +[Abstract, Exposed=Window] +interface CSSConditionRule : CSSGroupingRule { + attribute DOMString conditionText; +}; diff --git a/components/script/dom/webidls/CSSMediaRule.webidl b/components/script/dom/webidls/CSSMediaRule.webidl index 9ed133fb065..0f44c382620 100644 --- a/components/script/dom/webidls/CSSMediaRule.webidl +++ b/components/script/dom/webidls/CSSMediaRule.webidl @@ -3,7 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://drafts.csswg.org/cssom/#the-cssmediarule-interface +// https://drafts.csswg.org/css-conditional/#cssmediarule [Exposed=Window] -interface CSSMediaRule : CSSGroupingRule { +interface CSSMediaRule : CSSConditionRule { [SameObject, PutForwards=mediaText] readonly attribute MediaList media; }; diff --git a/components/script/dom/webidls/CSSRule.webidl b/components/script/dom/webidls/CSSRule.webidl index cda06ab1254..d36111b0cc0 100644 --- a/components/script/dom/webidls/CSSRule.webidl +++ b/components/script/dom/webidls/CSSRule.webidl @@ -31,3 +31,7 @@ partial interface CSSRule { const unsigned short VIEWPORT_RULE = 15; }; +// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface +partial interface CSSRule { + const unsigned short SUPPORTS_RULE = 12; +}; diff --git a/components/script/dom/webidls/CSSSupportsRule.webidl b/components/script/dom/webidls/CSSSupportsRule.webidl new file mode 100644 index 00000000000..73f147c6181 --- /dev/null +++ b/components/script/dom/webidls/CSSSupportsRule.webidl @@ -0,0 +1,8 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://drafts.csswg.org/css-conditional/#csssupportsrule +[Exposed=Window] +interface CSSSupportsRule : CSSConditionRule { +}; diff --git a/components/style/lib.rs b/components/style/lib.rs index 7cb15e22852..45954458a20 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -122,6 +122,7 @@ pub mod sequential; pub mod sink; pub mod str; pub mod stylesheets; +pub mod supports; pub mod thread_state; pub mod timer; pub mod traversal; diff --git a/components/style/parser.rs b/components/style/parser.rs index d1e37ce4527..60efcb8a4be 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -11,7 +11,7 @@ use error_reporting::ParseErrorReporter; #[cfg(feature = "gecko")] use gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI}; use servo_url::ServoUrl; -use stylesheets::Origin; +use stylesheets::{MemoryHoleReporter, Origin}; /// Extra data that the style backend may need to parse stylesheets. #[cfg(not(feature = "gecko"))] @@ -78,6 +78,11 @@ impl<'a> ParserContext<'a> { let extra_data = ParserContextExtraData::default(); Self::new_with_extra_data(stylesheet_origin, base_url, error_reporter, extra_data) } + + /// Create a parser context for on-the-fly parsing in CSSOM + pub fn new_for_cssom(base_url: &'a ServoUrl) -> ParserContext<'a> { + Self::new(Origin::User, base_url, Box::new(MemoryHoleReporter)) + } } /// Defaults to a no-op. diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index f6ed4ec618e..78867e81862 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -28,6 +28,7 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use style_traits::ToCss; use stylist::FnvHashMap; +use supports::SupportsCondition; use values::specified::url::SpecifiedUrl; use viewport::ViewportRule; @@ -215,6 +216,7 @@ pub enum CssRule { FontFace(Arc>), Viewport(Arc>), Keyframes(Arc>), + Supports(Arc>), } #[allow(missing_docs)] @@ -274,6 +276,7 @@ impl CssRule { CssRule::Keyframes(_) => CssRuleType::Keyframes, CssRule::Namespace(_) => CssRuleType::Namespace, CssRule::Viewport(_) => CssRuleType::Viewport, + CssRule::Supports(_) => CssRuleType::Supports, } } @@ -290,9 +293,10 @@ impl CssRule { /// /// Note that only some types of rules can contain rules. An empty slice is /// used for others. + /// + /// This will not recurse down unsupported @supports rules pub fn with_nested_rules_and_mq(&self, mut f: F) -> R - where F: FnMut(&[CssRule], Option<&MediaList>) -> R - { + where F: FnMut(&[CssRule], Option<&MediaList>) -> R { match *self { CssRule::Import(ref lock) => { let rule = lock.read(); @@ -315,6 +319,16 @@ impl CssRule { let rules = &media_rule.rules.read().0; f(rules, Some(&mq)) } + CssRule::Supports(ref lock) => { + let supports_rule = lock.read(); + let enabled = supports_rule.enabled; + if enabled { + let rules = &supports_rule.rules.read().0; + f(rules, None) + } else { + f(&[], None) + } + } } } @@ -367,6 +381,7 @@ impl ToCss for CssRule { CssRule::Viewport(ref lock) => lock.read().to_css(dest), CssRule::Keyframes(ref lock) => lock.read().to_css(dest), CssRule::Media(ref lock) => lock.read().to_css(dest), + CssRule::Supports(ref lock) => lock.read().to_css(dest), } } } @@ -441,7 +456,12 @@ impl ToCss for KeyframesRule { try!(dest.write_str(&*self.name.to_string())); try!(dest.write_str(" { ")); let iter = self.keyframes.iter(); + let mut first = true; for lock in iter { + if !first { + try!(dest.write_str(" ")); + } + first = false; let keyframe = lock.read(); try!(keyframe.to_css(dest)); } @@ -460,9 +480,34 @@ impl ToCss for MediaRule { // Serialization of MediaRule is not specced. // https://drafts.csswg.org/cssom/#serialize-a-css-rule CSSMediaRule fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - try!(dest.write_str("@media (")); + try!(dest.write_str("@media ")); try!(self.media_queries.read().to_css(dest)); - try!(dest.write_str(") {")); + try!(dest.write_str(" {")); + for rule in self.rules.read().0.iter() { + try!(dest.write_str(" ")); + try!(rule.to_css(dest)); + } + dest.write_str(" }") + } +} + + +#[derive(Debug)] +/// An @supports rule +pub struct SupportsRule { + /// The parsed condition + pub condition: SupportsCondition, + /// Child rules + pub rules: Arc>, + /// The result of evaluating the condition + pub enabled: bool, +} + +impl ToCss for SupportsRule { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + try!(dest.write_str("@supports ")); + try!(self.condition.to_css(dest)); + try!(dest.write_str(" {")); for rule in self.rules.read().0.iter() { try!(dest.write_str(" ")); try!(rule.to_css(dest)); @@ -712,6 +757,7 @@ rule_filter! { effective_font_face_rules(FontFace => FontFaceRule), effective_viewport_rules(Viewport => ViewportRule), effective_keyframes_rules(Keyframes => KeyframesRule), + effective_supports_rules(Supports => SupportsRule), } /// The stylesheet loader is the abstraction used to trigger network requests @@ -758,6 +804,8 @@ enum AtRulePrelude { FontFace, /// A @media rule prelude, with its media queries. Media(Arc>), + /// An @supports rule, with its conditional + Supports(SupportsCondition), /// A @viewport rule prelude. Viewport, /// A @keyframes rule, with its animation name. @@ -913,6 +961,10 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { let media_queries = parse_media_query_list(input); Ok(AtRuleType::WithBlock(AtRulePrelude::Media(Arc::new(RwLock::new(media_queries))))) }, + "supports" => { + let cond = SupportsCondition::parse(input)?; + Ok(AtRuleType::WithBlock(AtRulePrelude::Supports(cond))) + }, "font-face" => { Ok(AtRuleType::WithBlock(AtRulePrelude::FontFace)) }, @@ -949,6 +1001,14 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { rules: self.parse_nested_rules(input), })))) } + AtRulePrelude::Supports(cond) => { + let enabled = cond.eval(self.context); + Ok(CssRule::Supports(Arc::new(RwLock::new(SupportsRule { + condition: cond, + rules: self.parse_nested_rules(input), + enabled: enabled, + })))) + } AtRulePrelude::Viewport => { Ok(CssRule::Viewport(Arc::new(RwLock::new( try!(ViewportRule::parse(input, self.context)))))) diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 0f147f0be9b..45e6b0f9529 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -408,14 +408,15 @@ impl Stylist { fn mq_eval_changed(rules: &[CssRule], before: &Device, after: &Device) -> bool { for rule in rules { - if rule.with_nested_rules_and_mq(|rules, mq| { + let changed = rule.with_nested_rules_and_mq(|rules, mq| { if let Some(mq) = mq { if mq.evaluate(before) != mq.evaluate(after) { return true } } mq_eval_changed(rules, before, after) - }) { + }); + if changed { return true } } diff --git a/components/style/supports.rs b/components/style/supports.rs new file mode 100644 index 00000000000..455772a9eed --- /dev/null +++ b/components/style/supports.rs @@ -0,0 +1,231 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports) + +use cssparser::{parse_important, Parser, Token}; +use parser::ParserContext; +use properties::{PropertyDeclaration, PropertyId}; +use std::fmt; +use style_traits::ToCss; + +#[derive(Debug)] +/// An @supports condition +/// +/// https://drafts.csswg.org/css-conditional-3/#at-supports +pub enum SupportsCondition { + /// `not (condition)` + Not(Box), + /// `(condition)` + Parenthesized(Box), + /// `(condition) and (condition) and (condition) ..` + And(Vec), + /// `(condition) or (condition) or (condition) ..` + Or(Vec), + /// `property-ident: value` (value can be any tokens) + Declaration(Declaration), + /// `(any tokens)` or `func(any tokens)` + FutureSyntax(String), +} + +impl SupportsCondition { + /// Parse a condition + /// + /// https://drafts.csswg.org/css-conditional/#supports_condition + pub fn parse(input: &mut Parser) -> Result { + if let Ok(_) = input.try(|i| i.expect_ident_matching("not")) { + let inner = SupportsCondition::parse_in_parens(input)?; + return Ok(SupportsCondition::Not(Box::new(inner))); + } + + let in_parens = SupportsCondition::parse_in_parens(input)?; + + let (keyword, wrapper) = match input.next() { + Err(()) => { + // End of input + return Ok(in_parens) + } + Ok(Token::Ident(ident)) => { + match_ignore_ascii_case! { ident, + "and" => ("and", SupportsCondition::And as fn(_) -> _), + "or" => ("or", SupportsCondition::Or as fn(_) -> _), + _ => return Err(()) + } + } + _ => return Err(()) + }; + + let mut conditions = Vec::with_capacity(2); + conditions.push(in_parens); + loop { + conditions.push(SupportsCondition::parse_in_parens(input)?); + if input.try(|input| input.expect_ident_matching(keyword)).is_err() { + // Did not find the expected keyword. + // If we found some other token, + // it will be rejected by `Parser::parse_entirely` somewhere up the stack. + return Ok(wrapper(conditions)) + } + } + } + + /// https://drafts.csswg.org/css-conditional-3/#supports_condition_in_parens + fn parse_in_parens(input: &mut Parser) -> Result { + // Whitespace is normally taken care of in `Parser::next`, + // but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases. + while input.try(Parser::expect_whitespace).is_ok() {} + let pos = input.position(); + match input.next()? { + Token::ParenthesisBlock => { + input.parse_nested_block(|input| { + // `input.try()` not needed here since the alternative uses `consume_all()`. + parse_condition_or_declaration(input).or_else(|()| { + consume_all(input); + Ok(SupportsCondition::FutureSyntax(input.slice_from(pos).to_owned())) + }) + }) + } + Token::Function(_) => { + input.parse_nested_block(|i| Ok(consume_all(i))).unwrap(); + Ok(SupportsCondition::FutureSyntax(input.slice_from(pos).to_owned())) + } + _ => Err(()) + } + } + + /// Evaluate a supports condition + pub fn eval(&self, cx: &ParserContext) -> bool { + match *self { + SupportsCondition::Not(ref cond) => !cond.eval(cx), + SupportsCondition::Parenthesized(ref cond) => cond.eval(cx), + SupportsCondition::And(ref vec) => vec.iter().all(|c| c.eval(cx)), + SupportsCondition::Or(ref vec) => vec.iter().any(|c| c.eval(cx)), + SupportsCondition::Declaration(ref decl) => decl.eval(cx), + SupportsCondition::FutureSyntax(_) => false + } + } +} + +/// supports_condition | declaration +/// https://drafts.csswg.org/css-conditional/#dom-css-supports-conditiontext-conditiontext +pub fn parse_condition_or_declaration(input: &mut Parser) -> Result { + if let Ok(condition) = input.try(SupportsCondition::parse) { + Ok(SupportsCondition::Parenthesized(Box::new(condition))) + } else { + Declaration::parse(input).map(SupportsCondition::Declaration) + } +} + +impl ToCss for SupportsCondition { + fn to_css(&self, dest: &mut W) -> fmt::Result + where W: fmt::Write { + match *self { + SupportsCondition::Not(ref cond) => { + dest.write_str("not ")?; + cond.to_css(dest) + } + SupportsCondition::Parenthesized(ref cond) => { + dest.write_str("(")?; + cond.to_css(dest)?; + dest.write_str(")") + } + SupportsCondition::And(ref vec) => { + let mut first = true; + for cond in vec { + if !first { + dest.write_str(" and ")?; + } + first = false; + cond.to_css(dest)?; + } + Ok(()) + } + SupportsCondition::Or(ref vec) => { + let mut first = true; + for cond in vec { + if !first { + dest.write_str(" or ")?; + } + first = false; + cond.to_css(dest)?; + } + Ok(()) + } + SupportsCondition::Declaration(ref decl) => { + dest.write_str("(")?; + decl.to_css(dest)?; + dest.write_str(")") + } + SupportsCondition::FutureSyntax(ref s) => dest.write_str(&s), + } + } +} + +#[derive(Debug)] +/// A possibly-invalid property declaration +pub struct Declaration { + /// The property name + pub prop: String, + /// The property value + pub val: String, +} + +impl ToCss for Declaration { + fn to_css(&self, dest: &mut W) -> fmt::Result + where W: fmt::Write { + dest.write_str(&self.prop)?; + dest.write_str(":")?; + // no space, the `val` already contains any possible spaces + dest.write_str(&self.val) + } +} + +/// Slurps up input till exhausted, return string from source position +fn parse_anything(input: &mut Parser) -> String { + let pos = input.position(); + consume_all(input); + input.slice_from(pos).to_owned() +} + +/// consume input till done +fn consume_all(input: &mut Parser) { + while let Ok(_) = input.next() {} +} + +impl Declaration { + /// Parse a declaration + pub fn parse(input: &mut Parser) -> Result { + let prop = input.expect_ident()?.into_owned(); + input.expect_colon()?; + let val = parse_anything(input); + Ok(Declaration { prop: prop, val: val }) + } + + /// Determine if a declaration parses + /// + /// https://drafts.csswg.org/css-conditional-3/#support-definition + pub fn eval(&self, cx: &ParserContext) -> bool { + use properties::PropertyDeclarationParseResult::*; + let id = if let Ok(id) = PropertyId::parse((&*self.prop).into()) { + id + } else { + return false + }; + let mut input = Parser::new(&self.val); + let mut list = Vec::new(); + let res = PropertyDeclaration::parse(id, cx, &mut input, + &mut list, /* in_keyframe */ false); + let _ = input.try(parse_important); + if !input.is_exhausted() { + return false; + } + match res { + UnknownProperty => false, + ExperimentalProperty => false, // only happens for experimental props + // that haven't been enabled + InvalidValue => false, + AnimationPropertyInKeyframeBlock => unreachable!(), + ValidOrIgnoredDeclaration => true, + } + } +} diff --git a/components/url/lib.rs b/components/url/lib.rs index 575baebe6e0..2a3069ff36b 100644 --- a/components/url/lib.rs +++ b/components/url/lib.rs @@ -185,3 +185,9 @@ impl Index> for ServoUrl { &self.0[range] } } + +impl From for ServoUrl { + fn from(url: Url) -> Self { + ServoUrl::from_url(url) + } +} diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 1f03addfc6a..04b0542a079 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -276,6 +276,11 @@ class MachCommands(CommandBase): args += ["%s" % ' '.join(features + ["testing"])] else: args += ["testing"] + + args += test_patterns + + if nocapture: + args += ["--", "--nocapture"] return call(args, env=env, cwd=self.servo_crate()) @Command('test-stylo', diff --git a/rust-stable-version b/rust-stable-version index 0eed1a29efd..feaae22bac7 100644 --- a/rust-stable-version +++ b/rust-stable-version @@ -1 +1 @@ -1.12.0 +1.13.0 diff --git a/tests/unit/style/parsing/mod.rs b/tests/unit/style/parsing/mod.rs index 1fede915771..2521f5a9822 100644 --- a/tests/unit/style/parsing/mod.rs +++ b/tests/unit/style/parsing/mod.rs @@ -39,6 +39,25 @@ macro_rules! assert_roundtrip_with_context { } } +macro_rules! assert_roundtrip { + ($fun:expr, $string:expr) => { + assert_roundtrip!($fun, $string, $string); + }; + ($fun:expr,$input:expr, $output:expr) => { + let mut parser = Parser::new($input); + let parsed = $fun(&mut parser) + .expect(&format!("Failed to parse {}", $input)); + let serialized = ToCss::to_css_string(&parsed); + assert_eq!(serialized, $output); + + let mut parser = Parser::new(&serialized); + let re_parsed = $fun(&mut parser) + .expect(&format!("Failed to parse serialization {}", $input)); + let re_serialized = ToCss::to_css_string(&re_parsed); + assert_eq!(serialized, re_serialized); + } +} + macro_rules! parse_longhand { ($name:ident, $s:expr) => {{ let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); @@ -58,3 +77,4 @@ mod inherited_text; mod mask; mod position; mod selectors; +mod supports; diff --git a/tests/unit/style/parsing/supports.rs b/tests/unit/style/parsing/supports.rs new file mode 100644 index 00000000000..b38f1b09bc0 --- /dev/null +++ b/tests/unit/style/parsing/supports.rs @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use cssparser::Parser; +use style::supports::SupportsCondition; +use style_traits::ToCss; + +#[test] +fn test_supports_condition() { + assert_roundtrip!(SupportsCondition::parse, "(margin: 1px)"); + assert_roundtrip!(SupportsCondition::parse, "not (--be: to be)"); + assert_roundtrip!(SupportsCondition::parse, "(color: blue) and future-extension(4)"); +} diff --git a/tests/wpt/include_css.ini b/tests/wpt/include_css.ini index 426b9f124b9..edbb2d268cb 100644 --- a/tests/wpt/include_css.ini +++ b/tests/wpt/include_css.ini @@ -21,6 +21,13 @@ skip: true [xhtml1print] skip: true +[css-conditional-3_dev] + skip: false + [xhtml1] + skip: true + [xhtml1print] + skip: true + [css-flexbox-1_dev] skip: false [xhtml1] diff --git a/tests/wpt/metadata-css/css-conditional-3_dev/html/001.htm.ini b/tests/wpt/metadata-css/css-conditional-3_dev/html/001.htm.ini new file mode 100644 index 00000000000..58e5e598f9f --- /dev/null +++ b/tests/wpt/metadata-css/css-conditional-3_dev/html/001.htm.ini @@ -0,0 +1,8 @@ +[001.htm] + type: testharness + [Inserting @font-face inside @supports works] + expected: FAIL + + [Inserting an @supports inside a style rule should fail] + expected: FAIL + diff --git a/tests/wpt/metadata-css/css-transitions-1_dev/html/changing-while-transition.htm.ini b/tests/wpt/metadata-css/css-transitions-1_dev/html/changing-while-transition.htm.ini index cf6048d1988..c942e8df49b 100644 --- a/tests/wpt/metadata-css/css-transitions-1_dev/html/changing-while-transition.htm.ini +++ b/tests/wpt/metadata-css/css-transitions-1_dev/html/changing-while-transition.htm.ini @@ -2,3 +2,4 @@ type: testharness [changing transition-property / values] expected: FAIL + diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-external-supports-01.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-external-supports-01.htm.ini deleted file mode 100644 index 2dcc7082d9a..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-external-supports-01.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-external-supports-01.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-01.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-01.htm.ini deleted file mode 100644 index d9af1a2c62e..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-01.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-01.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-02.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-02.htm.ini deleted file mode 100644 index 2a76c3bef8c..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-02.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-02.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-03.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-03.htm.ini deleted file mode 100644 index 10b78166bb5..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-03.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-03.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-04.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-04.htm.ini deleted file mode 100644 index 858c344490d..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-04.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-04.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-05.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-05.htm.ini deleted file mode 100644 index 8c9c589af2a..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-05.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-05.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-06.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-06.htm.ini deleted file mode 100644 index 6655f9efcf2..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-06.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-06.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-07.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-07.htm.ini deleted file mode 100644 index bcc47cf7648..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-07.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-07.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-08.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-08.htm.ini deleted file mode 100644 index aa70cef5031..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-08.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-08.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-09.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-09.htm.ini deleted file mode 100644 index 5d6a047685a..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-09.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-09.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-10.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-10.htm.ini deleted file mode 100644 index 429a1de87c6..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-10.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-10.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-11.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-11.htm.ini deleted file mode 100644 index 00933acf99d..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-11.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-11.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-12.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-12.htm.ini deleted file mode 100644 index 5ff5f5f718a..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-12.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-12.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-13.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-13.htm.ini deleted file mode 100644 index af3ee6bdb6b..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-13.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-13.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-14.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-14.htm.ini deleted file mode 100644 index 73eefff02e5..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-14.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-14.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-15.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-15.htm.ini deleted file mode 100644 index ebe07de6210..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-15.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-15.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-16.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-16.htm.ini deleted file mode 100644 index 36a136b69cd..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-16.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-16.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-17.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-17.htm.ini deleted file mode 100644 index 75d3acfbe79..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-17.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-17.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-18.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-18.htm.ini deleted file mode 100644 index e4dca9950fa..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-18.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-18.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-19.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-19.htm.ini deleted file mode 100644 index 1a8e739f267..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-19.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-19.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-20.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-20.htm.ini deleted file mode 100644 index 5a758403d11..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-20.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-20.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-21.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-21.htm.ini deleted file mode 100644 index 7be5fdaa0d1..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-21.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-21.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-22.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-22.htm.ini deleted file mode 100644 index 4ac881de0d3..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-22.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-22.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-23.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-23.htm.ini deleted file mode 100644 index c50ae00f220..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-23.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-23.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-24.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-24.htm.ini deleted file mode 100644 index 6f8ca87f851..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-24.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-24.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-25.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-25.htm.ini deleted file mode 100644 index 7b463e52dea..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-25.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-25.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-26.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-26.htm.ini deleted file mode 100644 index 143d383962f..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-26.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-26.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-27.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-27.htm.ini deleted file mode 100644 index c466b6bb8cc..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-27.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-27.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-28.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-28.htm.ini deleted file mode 100644 index ffbe66958bb..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-28.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-28.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-29.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-29.htm.ini deleted file mode 100644 index b9f3eca69b6..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-29.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-29.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-30.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-30.htm.ini deleted file mode 100644 index 60ab9706d58..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-30.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-30.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-31.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-31.htm.ini deleted file mode 100644 index 4b5a47f9612..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-31.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-31.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-32.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-32.htm.ini deleted file mode 100644 index 4927839bf9e..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-32.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-32.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-33.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-33.htm.ini deleted file mode 100644 index 1ecaf6bfd3b..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-33.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-33.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-34.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-34.htm.ini deleted file mode 100644 index 7d0ddaa47cc..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-34.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-34.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-35.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-35.htm.ini deleted file mode 100644 index 859c6bd4580..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-35.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-35.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-36.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-36.htm.ini deleted file mode 100644 index 762fa0568e8..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-36.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-36.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-37.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-37.htm.ini deleted file mode 100644 index 27618269abb..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-37.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-37.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-38.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-38.htm.ini deleted file mode 100644 index 55a97c321c8..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-38.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-38.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-39.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-39.htm.ini deleted file mode 100644 index cdf10813ceb..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-39.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-39.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-40.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-40.htm.ini deleted file mode 100644 index 99b6289950f..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-40.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-40.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-41.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-41.htm.ini deleted file mode 100644 index d2d69f5537a..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-41.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-41.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-42.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-42.htm.ini deleted file mode 100644 index bba3b375886..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-42.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-42.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-43.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-43.htm.ini deleted file mode 100644 index 0c1e6915bc2..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-43.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-43.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-44.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-44.htm.ini deleted file mode 100644 index 081028c3c8a..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-44.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-44.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-45.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-45.htm.ini deleted file mode 100644 index 99883fa2a5d..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-45.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-45.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-46.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-46.htm.ini deleted file mode 100644 index 645552e49a3..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-46.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-46.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-47.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-47.htm.ini deleted file mode 100644 index 5124c4250d2..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-47.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-47.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-48.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-48.htm.ini deleted file mode 100644 index ea9414cbdbe..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-48.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-48.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-49.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-49.htm.ini deleted file mode 100644 index 4144bbc5409..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-49.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-49.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-50.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-50.htm.ini deleted file mode 100644 index b6439107a90..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-50.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-50.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-51.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-51.htm.ini deleted file mode 100644 index b410bb93b12..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-51.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-51.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-52.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-52.htm.ini deleted file mode 100644 index 2c9e7514109..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-52.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-52.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-53.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-53.htm.ini deleted file mode 100644 index 4fffd98e875..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-53.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-53.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-54.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-54.htm.ini deleted file mode 100644 index 37283ae8192..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-54.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-54.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-55.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-55.htm.ini deleted file mode 100644 index cb8890afcfa..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-55.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-55.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-56.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-56.htm.ini deleted file mode 100644 index a562d60c8eb..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-56.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-56.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-57.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-57.htm.ini deleted file mode 100644 index e5f03795a88..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-57.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-57.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-58.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-58.htm.ini deleted file mode 100644 index 7ee7e234555..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-58.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-58.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-59.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-59.htm.ini deleted file mode 100644 index 165dfe7ef8c..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-59.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-59.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-60.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-60.htm.ini deleted file mode 100644 index a265822da12..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-60.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-60.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-61.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-61.htm.ini deleted file mode 100644 index d1226d0e00d..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-61.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-61.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-62.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-62.htm.ini deleted file mode 100644 index f07a84c252d..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-62.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-62.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-63.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-63.htm.ini deleted file mode 100644 index 3a7f832b090..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-63.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-63.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-64.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-64.htm.ini deleted file mode 100644 index 7611a917f01..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-64.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-64.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-65.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-65.htm.ini deleted file mode 100644 index 75a24c09df1..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-65.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-65.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-66.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-66.htm.ini deleted file mode 100644 index fa2e8be2530..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-66.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-66.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-67.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-67.htm.ini deleted file mode 100644 index e5073eb3163..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-supports-67.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-supports-67.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/cssom-1_dev/html/css-style-declaration-modifications.htm.ini b/tests/wpt/metadata-css/cssom-1_dev/html/css-style-declaration-modifications.htm.ini index 1b70b013125..045c2071afe 100644 --- a/tests/wpt/metadata-css/cssom-1_dev/html/css-style-declaration-modifications.htm.ini +++ b/tests/wpt/metadata-css/cssom-1_dev/html/css-style-declaration-modifications.htm.ini @@ -1,5 +1,6 @@ [css-style-declaration-modifications.htm] type: testharness + expected: TIMEOUT [CSSStyleDeclaration_accessible] expected: FAIL diff --git a/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini b/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini index 820da0ee018..735d59c0874 100644 --- a/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini +++ b/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini @@ -204,3 +204,9 @@ [PseudoElement interface: attribute usedStyle] expected: FAIL + [CSSMediaRule interface: existence and properties of interface object] + expected: FAIL + + [CSSMediaRule interface: existence and properties of interface prototype object] + expected: FAIL + diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 46a4e70d852..2653ba15068 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -45847,6 +45847,12 @@ "deleted_reftests": {}, "items": { "testharness": { + "cssom/CSS.html": [ + { + "path": "cssom/CSS.html", + "url": "/cssom/CSS.html" + } + ], "cssom/CSSKeyframeRule.html": [ { "path": "cssom/CSSKeyframeRule.html", diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html index 6f774fec8da..a29f439a7c6 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html @@ -20,6 +20,7 @@ test_interfaces([ "CharacterData", "CloseEvent", "CSS", + "CSSConditionRule", "CSSFontFaceRule", "CSSGroupingRule", "CSSImportRule", @@ -32,6 +33,7 @@ test_interfaces([ "CSSStyleDeclaration", "CSSStyleRule", "CSSStyleSheet", + "CSSSupportsRule", "CSSViewportRule", "DOMMatrix", "DOMMatrixReadOnly", diff --git a/tests/wpt/web-platform-tests/cssom/CSS.html b/tests/wpt/web-platform-tests/cssom/CSS.html new file mode 100644 index 00000000000..1bbecbfa3ba --- /dev/null +++ b/tests/wpt/web-platform-tests/cssom/CSS.html @@ -0,0 +1,37 @@ + + +CSSOM - CSS interface + + +