Bug 1363572 Part 1: Servo-side change stylesheet_set entry unique_id to u64. draft
authorBrad Werth <bwerth@mozilla.com>
Wed, 10 May 2017 11:13:05 -0700
changeset 576393 07319427c4435ff0e21a9df09c0bd53e00645eb1
parent 576334 3b96f277325747fe668ca8cd896d2f581238e4ee
child 576394 cf39fe5a17331f43f46c1b6f7dad00df816dd260
push id58354
push userbwerth@mozilla.com
push dateThu, 11 May 2017 18:16:31 +0000
bugs1363572
milestone55.0a1
Bug 1363572 Part 1: Servo-side change stylesheet_set entry unique_id to u64. MozReview-Commit-ID: 2QZGCbN9xc8
servo/components/style/stylesheet_set.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/stylesheet_set.rs
+++ b/servo/components/style/stylesheet_set.rs
@@ -5,17 +5,17 @@
 //! A centralized set of stylesheets for a document.
 
 use stylearc::Arc;
 use stylesheets::Stylesheet;
 
 /// Entry for a StylesheetSet. We don't bother creating a constructor, because
 /// there's no sensible defaults for the member variables.
 pub struct StylesheetSetEntry {
-    unique_id: u32,
+    unique_id: u64,
     sheet: Arc<Stylesheet>,
 }
 
 /// The set of stylesheets effective for a given document.
 pub struct StylesheetSet {
     /// The actual list of all the stylesheets that apply to the given document,
     /// each stylesheet associated with a unique ID.
     ///
@@ -41,60 +41,60 @@ impl StylesheetSet {
     }
 
     /// Returns whether author styles have been disabled for the current
     /// stylesheet set.
     pub fn author_style_disabled(&self) -> bool {
         self.author_style_disabled
     }
 
-    fn remove_stylesheet_if_present(&mut self, unique_id: u32) {
+    fn remove_stylesheet_if_present(&mut self, unique_id: u64) {
         self.entries.retain(|x| x.unique_id != unique_id);
     }
 
     /// Appends a new stylesheet to the current set.
     pub fn append_stylesheet(&mut self, sheet: &Arc<Stylesheet>,
-                             unique_id: u32) {
+                             unique_id: u64) {
         self.remove_stylesheet_if_present(unique_id);
         self.entries.push(StylesheetSetEntry {
             unique_id: unique_id,
             sheet: sheet.clone(),
         });
         self.dirty = true;
     }
 
     /// Prepend a new stylesheet to the current set.
     pub fn prepend_stylesheet(&mut self, sheet: &Arc<Stylesheet>,
-                              unique_id: u32) {
+                              unique_id: u64) {
         self.remove_stylesheet_if_present(unique_id);
         self.entries.insert(0, StylesheetSetEntry {
             unique_id: unique_id,
             sheet: sheet.clone(),
         });
         self.dirty = true;
     }
 
     /// Insert a given stylesheet before another stylesheet in the document.
     pub fn insert_stylesheet_before(&mut self,
                                     sheet: &Arc<Stylesheet>,
-                                    unique_id: u32,
-                                    before_unique_id: u32) {
+                                    unique_id: u64,
+                                    before_unique_id: u64) {
         self.remove_stylesheet_if_present(unique_id);
         let index = self.entries.iter().position(|x| {
             x.unique_id == before_unique_id
         }).expect("`before_unique_id` stylesheet not found");
         self.entries.insert(index, StylesheetSetEntry {
             unique_id: unique_id,
             sheet: sheet.clone(),
         });
         self.dirty = true;
     }
 
     /// Remove a given stylesheet from the set.
-    pub fn remove_stylesheet(&mut self, unique_id: u32) {
+    pub fn remove_stylesheet(&mut self, unique_id: u64) {
         self.remove_stylesheet_if_present(unique_id);
         self.dirty = true;
     }
 
     /// Notes that the author style has been disabled for this document.
     pub fn set_author_style_disabled(&mut self, disabled: bool) {
         if self.author_style_disabled == disabled {
             return;
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -614,47 +614,47 @@ pub extern "C" fn Servo_StyleSheet_Clear
     let sheet = Stylesheet::as_arc(&stylesheet);
     Stylesheet::update_from_str(&sheet, input, url_data,
                                 loader, &RustLogReporter);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_AppendStyleSheet(raw_data: RawServoStyleSetBorrowed,
                                                   raw_sheet: RawServoStyleSheetBorrowed,
-                                                  unique_id: u32) {
+                                                  unique_id: u64) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let sheet = HasArcFFI::as_arc(&raw_sheet);
     data.stylesheets.append_stylesheet(sheet, unique_id);
     data.clear_stylist();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_PrependStyleSheet(raw_data: RawServoStyleSetBorrowed,
                                                    raw_sheet: RawServoStyleSheetBorrowed,
-                                                   unique_id: u32) {
+                                                   unique_id: u64) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let sheet = HasArcFFI::as_arc(&raw_sheet);
     data.stylesheets.prepend_stylesheet(sheet, unique_id);
     data.clear_stylist();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(raw_data: RawServoStyleSetBorrowed,
                                                         raw_sheet: RawServoStyleSheetBorrowed,
-                                                        unique_id: u32,
-                                                        before_unique_id: u32) {
+                                                        unique_id: u64,
+                                                        before_unique_id: u64) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let sheet = HasArcFFI::as_arc(&raw_sheet);
     data.stylesheets.insert_stylesheet_before(sheet, unique_id, before_unique_id);
     data.clear_stylist();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(raw_data: RawServoStyleSetBorrowed,
-                                                  unique_id: u32) {
+                                                  unique_id: u64) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     data.stylesheets.remove_stylesheet(unique_id);
     data.clear_stylist();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_FlushStyleSheets(raw_data: RawServoStyleSetBorrowed) {
     let global_style_data = &*GLOBAL_STYLE_DATA;