diff --git a/dom/webidl/CSSImportRule.webidl b/dom/webidl/CSSImportRule.webidl index d8573411fd41..965da60d1c0c 100644 --- a/dom/webidl/CSSImportRule.webidl +++ b/dom/webidl/CSSImportRule.webidl @@ -15,9 +15,7 @@ interface CSSImportRule : CSSRule { // be since stylesheet can be null, and in Stylo, media is derived from // the stylesheet. See . [SameObject, PutForwards=mediaText] readonly attribute MediaList? media; - // This disagrees with CSSOM temporarily, but css-conditional assumes it is - // nullable. - // see: https://github.com/w3c/csswg-drafts/issues/8608. [SameObject, BinaryName="styleSheetForBindings"] readonly attribute CSSStyleSheet? styleSheet; readonly attribute UTF8String? layerName; + readonly attribute UTF8String? supportsText; }; diff --git a/layout/style/CSSImportRule.cpp b/layout/style/CSSImportRule.cpp index f06c60acbd1f..27d1e309e957 100644 --- a/layout/style/CSSImportRule.cpp +++ b/layout/style/CSSImportRule.cpp @@ -125,6 +125,10 @@ void CSSImportRule::GetLayerName(nsACString& aName) const { Servo_ImportRule_GetLayerName(mRawRule, &aName); } +void CSSImportRule::GetSupportsText(nsACString& aSupportsText) const { + Servo_ImportRule_GetSupportsText(mRawRule, &aSupportsText); +} + /* virtual */ void CSSImportRule::GetCssText(nsACString& aCssText) const { Servo_ImportRule_GetCssText(mRawRule, &aCssText); diff --git a/layout/style/CSSImportRule.h b/layout/style/CSSImportRule.h index 23dca3985bd2..9bcbcc9a6646 100644 --- a/layout/style/CSSImportRule.h +++ b/layout/style/CSSImportRule.h @@ -39,6 +39,7 @@ class CSSImportRule final : public css::Rule { StyleSheet* GetStyleSheet() const { return mChildSheet; } StyleSheet* GetStyleSheetForBindings(); void GetLayerName(nsACString&) const; + void GetSupportsText(nsACString&) const; // Clear the mSheet pointer on this rule and descendants. void DropSheetReference() final; diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 9ab048107a50..a889129b481a 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -2716,6 +2716,17 @@ pub extern "C" fn Servo_ImportRule_GetLayerName( }) } +#[no_mangle] +pub extern "C" fn Servo_ImportRule_GetSupportsText( + rule: &RawServoImportRule, + result: &mut nsACString, +) { + read_locked_arc(rule, |rule: &ImportRule| match rule.supports { + Some(ref supports) => supports.condition.to_css(&mut CssWriter::new(result)).unwrap(), + None => result.set_is_void(true), + }) +} + #[no_mangle] pub extern "C" fn Servo_ImportRule_GetSheet(rule: &RawServoImportRule) -> *const DomStyleSheet { read_locked_arc(rule, |rule: &ImportRule| { diff --git a/testing/web-platform/tests/css/cssom/cssimportrule.html b/testing/web-platform/tests/css/cssom/cssimportrule.html index 89269f1c24ce..2703b9a69b57 100644 --- a/testing/web-platform/tests/css/cssom/cssimportrule.html +++ b/testing/web-platform/tests/css/cssom/cssimportrule.html @@ -15,6 +15,7 @@ @import url("support/a-green.css"); @import url("support/a-green.css") screen; @import url("support/a-green.css") all; + @import url("support/a-green") supports((display: flex) or (display: block)); @page { background-color: red; } @@ -22,13 +23,14 @@