From d486def53b64670ef5fe72f2da7934f896591778 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 12 Sep 2017 08:45:30 +1000 Subject: [PATCH] Use the LonghandIdSet to check whether a property is set --- components/style/properties/declaration_block.rs | 5 +++++ ports/geckolib/glue.rs | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 9d9a3a7b2fe..c91b3a73f30 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -239,6 +239,11 @@ impl PropertyDeclarationBlock { !self.declarations_importance.all_true() } + /// Returns whether this block contains a declaration of a given longhand. + pub fn contains(&self, id: LonghandId) -> bool { + self.longhands.contains(id) + } + /// Get a declaration for a given property. /// /// NOTE: This is linear time. diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index b2f4971a968..a5489f1b65b 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -2566,10 +2566,8 @@ pub extern "C" fn Servo_DeclarationBlock_PropertyIsSet(declarations: RawServoDeclarationBlockBorrowed, property: nsCSSPropertyID) -> bool { - use style::properties::PropertyDeclarationId; - let long = get_longhand_from_id!(property); read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { - decls.get(PropertyDeclarationId::Longhand(long)).is_some() + decls.contains(get_longhand_from_id!(property)) }) }