Bug 1341721 Part 2b: Add a bool property to PerDocumentStyleDataImpl. draft
authorBrad Werth <bwerth@mozilla.com>
Tue, 11 Apr 2017 15:48:38 +0800
changeset 561914 26dfbab75e6ab1172325893b69f499b82a6eb6da
parent 561913 4a447e5c18bc000b79add5f805c3f9c265814ee1
child 561915 0855445eb10397daf9549e316390a40119999f45
push id53894
push userbwerth@mozilla.com
push dateThu, 13 Apr 2017 08:30:03 +0000
bugs1341721
milestone55.0a1
Bug 1341721 Part 2b: Add a bool property to PerDocumentStyleDataImpl. MozReview-Commit-ID: FiXyEN4xVnU
servo/components/style/gecko/data.rs
servo/components/style/gecko_bindings/bindings.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -27,16 +27,19 @@ pub struct PerDocumentStyleDataImpl {
     pub stylist: Arc<Stylist>,
 
     /// List of stylesheets, mirrored from Gecko.
     pub stylesheets: Vec<Arc<Stylesheet>>,
 
     /// Whether the stylesheets list above has changed since the last restyle.
     pub stylesheets_changed: bool,
 
+    /// Has author style been disabled?
+    pub author_style_disabled: bool,
+
     // FIXME(bholley): Hook these up to something.
     /// Unused. Will go away when we actually implement transitions and
     /// animations properly.
     pub new_animations_sender: Sender<Animation>,
     /// Unused. Will go away when we actually implement transitions and
     /// animations properly.
     pub new_animations_receiver: Receiver<Animation>,
     /// Unused. Will go away when we actually implement transitions and
@@ -60,16 +63,17 @@ impl PerDocumentStyleData {
         let device = Device::new(pres_context);
 
         let (new_anims_sender, new_anims_receiver) = channel();
 
         PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
             stylist: Arc::new(Stylist::new(device)),
             stylesheets: vec![],
             stylesheets_changed: true,
+            author_style_disabled: false,
             new_animations_sender: new_anims_sender,
             new_animations_receiver: new_anims_receiver,
             running_animations: Arc::new(RwLock::new(HashMap::new())),
             expired_animations: Arc::new(RwLock::new(HashMap::new())),
             font_faces: vec![],
         }))
     }
 
--- a/servo/components/style/gecko_bindings/bindings.rs
+++ b/servo/components/style/gecko_bindings/bindings.rs
@@ -1520,17 +1520,18 @@ extern "C" {
                                                      RawServoStyleSheetBorrowed,
                                                  flush: bool);
 }
 extern "C" {
     pub fn Servo_StyleSet_FlushStyleSheets(set: RawServoStyleSetBorrowed);
 }
 extern "C" {
     pub fn Servo_StyleSet_NoteStyleSheetsChanged(set:
-                                                     RawServoStyleSetBorrowed);
+                                                     RawServoStyleSetBorrowed,
+                                                 author_style_disabled: bool);
 }
 extern "C" {
     pub fn Servo_StyleSet_FillKeyframesForName(set: RawServoStyleSetBorrowed,
                                                property: *const nsACString,
                                                timing_function:
                                                    nsTimingFunctionBorrowed,
                                                computed_values:
                                                    ServoComputedValuesBorrowed,
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -640,19 +640,21 @@ pub extern "C" fn Servo_StyleSet_RemoveS
 pub extern "C" fn Servo_StyleSet_FlushStyleSheets(raw_data: RawServoStyleSetBorrowed) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     data.flush_stylesheets(&guard);
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSet_NoteStyleSheetsChanged(raw_data: RawServoStyleSetBorrowed) {
+pub extern "C" fn Servo_StyleSet_NoteStyleSheetsChanged(raw_data: RawServoStyleSetBorrowed,
+                                                        author_style_disabled: bool) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     data.stylesheets_changed = true;
+    data.author_style_disabled = author_style_disabled;
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_HasRules(raw_sheet: RawServoStyleSheetBorrowed) -> bool {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     !Stylesheet::as_arc(&raw_sheet).rules.read_with(&guard).0.is_empty()
 }