Bug 1354947 - Add clear method for LonghandIdSet. r?SimonSapin draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 02 May 2017 18:52:36 +0900
changeset 571299 6e182278c25904881ef2e5649b7ec7d0b0f98cec
parent 571298 22ede62d9fb627417289205305a10b8123d0fd87
child 571300 5cbfd1c5654d8195bc87d81ae07caea7a1b1c2d3
push id56743
push userhikezoe@mozilla.com
push dateTue, 02 May 2017 10:26:16 +0000
reviewersSimonSapin
bugs1354947
milestone55.0a1
Bug 1354947 - Add clear method for LonghandIdSet. r?SimonSapin MozReview-Commit-ID: K5GaKcMjhI7
servo/components/style/properties/properties.mako.rs
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -246,16 +246,22 @@ impl LonghandIdSet {
 
     /// Remove the given property from the set
     #[inline]
     pub fn remove(&mut self, id: LonghandId) {
         let bit = id as usize;
         self.storage[bit / 32] &= !(1 << (bit % 32));
     }
 
+    /// Clear all bits
+    #[inline]
+    pub fn clear(&mut self) {
+        self.storage = [0; (${len(data.longhands)} - 1 + 32) / 32];
+    }
+
     /// Set the corresponding bit of TransitionProperty.
     /// This function will panic if TransitionProperty::All is given.
     pub fn set_transition_property_bit(&mut self, property: &TransitionProperty) {
         match *property {
             % for prop in data.longhands:
                 % if prop.animatable:
                     TransitionProperty::${prop.camel_case} => self.insert(LonghandId::${prop.camel_case}),
                 % endif