servo: Merge #18450 - Use the LonghandIdSet to check whether a property is set (from upsuper:property-is-set); r=Manishearth
authorXidorn Quan <me@upsuper.org>
Mon, 11 Sep 2017 18:50:19 -0500
changeset 429662 8aac9fa52e8aedfe1ad5b5a5c2e1927b4474c838
parent 429661 13c9393a6c450cdba6f71f5fc01928ab94d9a41b
child 429663 565bb6d72f11cb9529c37ae054dcc16265f8dfba
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth
bugs1398479
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #18450 - Use the LonghandIdSet to check whether a property is set (from upsuper:property-is-set); r=Manishearth Servo side change of [bug 1398479](https://bugzilla.mozilla.org/show_bug.cgi?id=1398479). Source-Repo: https://github.com/servo/servo Source-Revision: 24b2d8d9cf265a149535ebc22941e427dd5e21b3
servo/components/style/properties/declaration_block.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/properties/declaration_block.rs
+++ b/servo/components/style/properties/declaration_block.rs
@@ -234,16 +234,21 @@ impl PropertyDeclarationBlock {
     /// Returns whether this block contains any declaration without `!important`.
     ///
     /// This is based on the `declarations_importance` bit-vector,
     /// which should be maintained whenever `declarations` is changed.
     pub fn any_normal(&self) -> bool {
         !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.
     pub fn get(&self, property: PropertyDeclarationId) -> Option<(&PropertyDeclaration, Importance)> {
         self.declarations.iter().enumerate().find(|&(_, decl)| decl.id() == property).map(|(i, decl)| {
             let importance = if self.declarations_importance.get(i as u32) {
                 Importance::Important
             } else {
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -2561,20 +2561,18 @@ macro_rules! match_wrap_declared {
     )
 }
 
 #[no_mangle]
 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))
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetIdentStringValue(declarations:
                                                              RawServoDeclarationBlockBorrowed,
                                                              property:
                                                              nsCSSPropertyID,