diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 7c443f99401..045a95e53e2 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -359,6 +359,21 @@ impl PropertyDeclarationBlock { longhands: longhands, } } + + /// Returns true if the declaration block has a CSSWideKeyword for the given + /// property. + #[cfg(feature = "gecko")] + pub fn has_css_wide_keyword(&self, property: &PropertyId) -> bool { + if let PropertyId::Longhand(id) = *property { + if !self.longhands.contains(id) { + return false + } + } + self.declarations.iter().any(|&&(ref decl, _)| + decl.id().is_or_is_longhand_of(property) && + decl.get_css_wide_keyword().is_some() + ) + } } impl ToCss for PropertyDeclarationBlock { diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 94d26386cd7..d9d1a0c2299 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1235,6 +1235,15 @@ pub extern "C" fn Servo_MediaList_Matches(list: RawServoMediaListBorrowed, }) } +#[no_mangle] +pub extern "C" fn Servo_DeclarationBlock_HasCSSWideKeyword(declarations: RawServoDeclarationBlockBorrowed, + property: nsCSSPropertyID) -> bool { + let property_id = get_property_id_from_nscsspropertyid!(property, false); + read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { + decls.has_css_wide_keyword(&property_id) + }) +} + #[no_mangle] pub extern "C" fn Servo_MediaList_GetText(list: RawServoMediaListBorrowed, result: *mut nsAString) { read_locked_arc(list, |list: &MediaList| {