Bug 1519296 - Part 4: Remove ServoStyleSet::PrependStyleSheet r=emilio
authorCameron McCormack <cam@mcc.id.au>
Sat, 12 Jan 2019 06:45:45 +0000
changeset 453603 434b6906676e
parent 453602 89828ae0afea
child 453604 cb35977ae7a4
child 453624 87a1eddf108d
push id35360
push usernbeleuzu@mozilla.com
push dateSat, 12 Jan 2019 09:39:47 +0000
treeherdermozilla-central@cb35977ae7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1519296
milestone66.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
Bug 1519296 - Part 4: Remove ServoStyleSet::PrependStyleSheet r=emilio Depends on D16283 Differential Revision: https://phabricator.services.mozilla.com/D16284
layout/style/ServoBindings.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
servo/components/style/stylesheet_set.rs
servo/components/style/stylist.rs
servo/ports/geckolib/glue.rs
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -139,19 +139,16 @@ mozilla::MediumFeaturesChangedResult Ser
     bool may_affect_default_style);
 
 void Servo_StyleSet_Drop(RawServoStyleSetOwned set);
 void Servo_StyleSet_CompatModeChanged(RawServoStyleSetBorrowed raw_data);
 
 void Servo_StyleSet_AppendStyleSheet(RawServoStyleSetBorrowed set,
                                      const mozilla::StyleSheet* gecko_sheet);
 
-void Servo_StyleSet_PrependStyleSheet(RawServoStyleSetBorrowed set,
-                                      const mozilla::StyleSheet* gecko_sheet);
-
 void Servo_StyleSet_RemoveStyleSheet(RawServoStyleSetBorrowed set,
                                      const mozilla::StyleSheet* gecko_sheet);
 
 void Servo_StyleSet_InsertStyleSheetBefore(
     RawServoStyleSetBorrowed set, const mozilla::StyleSheet* gecko_sheet,
     const mozilla::StyleSheet* before);
 
 void Servo_StyleSet_FlushStyleSheets(
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -651,41 +651,16 @@ nsresult ServoStyleSet::AppendStyleSheet
 
   if (mStyleRuleMap) {
     mStyleRuleMap->SheetAdded(*aSheet);
   }
 
   return NS_OK;
 }
 
-nsresult ServoStyleSet::PrependStyleSheet(SheetType aType, StyleSheet* aSheet) {
-  MOZ_ASSERT(aSheet);
-  MOZ_ASSERT(aSheet->IsApplicable());
-  MOZ_ASSERT(IsCSSSheetType(aType));
-  MOZ_ASSERT(aSheet->RawContents(),
-             "Raw sheet should be in place before insertion.");
-
-  RemoveSheetOfType(aType, aSheet);
-  PrependSheetOfType(aType, aSheet);
-
-  if (mRawSet) {
-    // Maintain a mirrored list of sheets on the servo side.
-    // Servo will remove aSheet from its original position as part of the call
-    // to Servo_StyleSet_PrependStyleSheet.
-    Servo_StyleSet_PrependStyleSheet(mRawSet.get(), aSheet);
-    SetStylistStyleSheetsDirty();
-  }
-
-  if (mStyleRuleMap) {
-    mStyleRuleMap->SheetAdded(*aSheet);
-  }
-
-  return NS_OK;
-}
-
 nsresult ServoStyleSet::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet) {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(IsCSSSheetType(aType));
 
   RemoveSheetOfType(aType, aSheet);
   if (mRawSet) {
     // Maintain a mirrored list of sheets on the servo side.
     Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), aSheet);
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -203,17 +203,16 @@ class ServoStyleSet {
 #ifdef MOZ_XUL
   already_AddRefed<ComputedStyle> ResolveXULTreePseudoStyle(
       dom::Element* aParentElement, nsCSSAnonBoxPseudoStaticAtom* aPseudoTag,
       ComputedStyle* aParentContext, const AtomArray& aInputWord);
 #endif
 
   // manage the set of style sheets in the style set
   nsresult AppendStyleSheet(SheetType aType, StyleSheet* aSheet);
-  nsresult PrependStyleSheet(SheetType aType, StyleSheet* aSheet);
   nsresult RemoveStyleSheet(SheetType aType, StyleSheet* aSheet);
   nsresult ReplaceSheets(SheetType aType,
                          const nsTArray<RefPtr<StyleSheet>>& aNewSheets);
   nsresult InsertStyleSheetBefore(SheetType aType, StyleSheet* aNewSheet,
                                   StyleSheet* aReferenceSheet);
 
   int32_t SheetCount(SheetType aType) const;
   StyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const;
--- a/servo/components/style/stylesheet_set.rs
+++ b/servo/components/style/stylesheet_set.rs
@@ -340,24 +340,16 @@ where
         use std::cmp;
 
         debug_assert_ne!(validity, DataValidity::Valid);
 
         self.dirty = true;
         self.data_validity = cmp::max(validity, self.data_validity);
     }
 
-    fn prepend(&mut self, sheet: S) {
-        debug_assert!(!self.contains(&sheet));
-        // Inserting stylesheets somewhere but at the end changes the validity
-        // of the cascade data, but not the invalidation data.
-        self.set_data_validity_at_least(DataValidity::CascadeInvalid);
-        self.entries.insert(0, StylesheetSetEntry::new(sheet));
-    }
-
     /// Returns an iterator over the current list of stylesheets.
     fn iter(&self) -> StylesheetCollectionIterator<S> {
         StylesheetCollectionIterator(self.entries.iter())
     }
 
     fn flush(&mut self) -> SheetCollectionFlusher<S> {
         let dirty = mem::replace(&mut self.dirty, false);
         let validity = mem::replace(&mut self.data_validity, DataValidity::Valid);
@@ -412,30 +404,16 @@ macro_rules! sheet_set_methods {
             guard: &SharedRwLockReadGuard,
         ) {
             debug!(concat!($set_name, "::append_stylesheet"));
             self.collect_invalidations_for(device, &sheet, guard);
             let collection = self.collection_for(&sheet, guard);
             collection.append(sheet);
         }
 
-        /// Prepend a new stylesheet to the current set.
-        pub fn prepend_stylesheet(
-            &mut self,
-            device: Option<&Device>,
-            sheet: S,
-            guard: &SharedRwLockReadGuard,
-        ) {
-            debug!(concat!($set_name, "::prepend_stylesheet"));
-            self.collect_invalidations_for(device, &sheet, guard);
-
-            let collection = self.collection_for(&sheet, guard);
-            collection.prepend(sheet);
-        }
-
         /// Insert a given stylesheet before another stylesheet in the document.
         pub fn insert_stylesheet_before(
             &mut self,
             device: Option<&Device>,
             sheet: S,
             before_sheet: S,
             guard: &SharedRwLockReadGuard,
         ) {
--- a/servo/components/style/stylist.rs
+++ b/servo/components/style/stylist.rs
@@ -577,22 +577,16 @@ impl Stylist {
     }
 
     /// Appends a new stylesheet to the current set.
     pub fn append_stylesheet(&mut self, sheet: StylistSheet, guard: &SharedRwLockReadGuard) {
         self.stylesheets
             .append_stylesheet(Some(&self.device), sheet, guard)
     }
 
-    /// Appends a new stylesheet to the current set.
-    pub fn prepend_stylesheet(&mut self, sheet: StylistSheet, guard: &SharedRwLockReadGuard) {
-        self.stylesheets
-            .prepend_stylesheet(Some(&self.device), sheet, guard)
-    }
-
     /// Remove a given stylesheet to the current set.
     pub fn remove_stylesheet(&mut self, sheet: StylistSheet, guard: &SharedRwLockReadGuard) {
         self.stylesheets
             .remove_stylesheet(Some(&self.device), sheet, guard)
     }
 
     /// Returns whether for any of the applicable style rule data a given
     /// condition is true.
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -1611,29 +1611,16 @@ pub unsafe extern "C" fn Servo_StyleSet_
     structs::MediumFeaturesChangedResult {
         mAffectsDocumentRules: affects_document_rules,
         mAffectsNonDocumentRules: affects_non_document_rules,
         mUsesViewportUnits: uses_viewport_units,
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSet_PrependStyleSheet(
-    raw_data: RawServoStyleSetBorrowed,
-    sheet: *const DomStyleSheet,
-) {
-    let global_style_data = &*GLOBAL_STYLE_DATA;
-    let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let data = &mut *data;
-    let guard = global_style_data.shared_lock.read();
-    let sheet = unsafe { GeckoStyleSheet::new(sheet) };
-    data.stylist.prepend_stylesheet(sheet, &guard);
-}
-
-#[no_mangle]
 pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
     raw_data: RawServoStyleSetBorrowed,
     sheet: *const DomStyleSheet,
     before_sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;