Bug 1296173 part 1 - Change StyleSet manipulation functions to be prefixed by Servo_StyleSet_. r?bholley draft
authorXidorn Quan <xidorn+moz@upsuper.org>
Tue, 23 Aug 2016 13:10:49 +1000
changeset 404179 08c17824cbd06ff25771b9cb7e27b408f34686c8
parent 404178 53ce9619813b91b26a5bc51b7417c55e8b9cb505
child 404180 945d712daa8f8840827b2585a9e2d96d4f3694e3
push id27145
push userxquan@mozilla.com
push dateTue, 23 Aug 2016 03:36:42 +0000
reviewersbholley
bugs1296173
milestone51.0a1
Bug 1296173 part 1 - Change StyleSet manipulation functions to be prefixed by Servo_StyleSet_. r?bholley MozReview-Commit-ID: C1PPJltyodE
layout/style/ServoBindingList.h
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -28,30 +28,29 @@ SERVO_BINDING_FUNC(Servo_StylesheetFromU
                    const uint8_t* base_bytes, uint32_t base_length,
                    ThreadSafeURIHolder* base,
                    ThreadSafeURIHolder* referrer,
                    ThreadSafePrincipalHolder* principal)
 SERVO_BINDING_FUNC(Servo_AddRefStyleSheet, void,
                    RawServoStyleSheetBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_ReleaseStyleSheet, void,
                    RawServoStyleSheetBorrowed sheet)
-SERVO_BINDING_FUNC(Servo_AppendStyleSheet, void,
-                   RawServoStyleSheetBorrowed sheet, RawServoStyleSet* set)
-SERVO_BINDING_FUNC(Servo_PrependStyleSheet, void,
-                   RawServoStyleSheetBorrowed sheet, RawServoStyleSet* set)
-SERVO_BINDING_FUNC(Servo_RemoveStyleSheet, void,
-                   RawServoStyleSheetBorrowed sheet, RawServoStyleSet* set)
-SERVO_BINDING_FUNC(Servo_InsertStyleSheetBefore, void,
-                   RawServoStyleSheetBorrowed sheet,
-                   RawServoStyleSheetBorrowed reference,
-                   RawServoStyleSet* set)
 SERVO_BINDING_FUNC(Servo_StyleSheetHasRules, bool,
                    RawServoStyleSheetBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_InitStyleSet, RawServoStyleSet*)
 SERVO_BINDING_FUNC(Servo_DropStyleSet, void, RawServoStyleSet* set)
+SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
+                   RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet)
+SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
+                   RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet)
+SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
+                   RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet)
+SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
+                   RawServoStyleSet* set, RawServoStyleSheetBorrowed sheet,
+                   RawServoStyleSheetBorrowed reference)
 
 // Style attribute
 SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, ServoDeclarationBlockStrong,
                    const uint8_t* bytes, uint32_t length,
                    nsHTMLCSSStyleSheet* cache)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddRef, void,
                    ServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_Release, void,
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -249,72 +249,72 @@ ServoStyleSet::AppendStyleSheet(SheetTyp
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(nsStyleSet::IsCSSSheetType(aType));
 
   mSheets[aType].RemoveElement(aSheet);
   mSheets[aType].AppendElement(aSheet);
 
   // Maintain a mirrored list of sheets on the servo side.
-  Servo_AppendStyleSheet(aSheet->RawSheet(), mRawSet.get());
+  Servo_StyleSet_AppendStyleSheet(mRawSet.get(), aSheet->RawSheet());
 
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::PrependStyleSheet(SheetType aType,
                                  ServoStyleSheet* aSheet)
 {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(nsStyleSet::IsCSSSheetType(aType));
 
   mSheets[aType].RemoveElement(aSheet);
   mSheets[aType].InsertElementAt(0, aSheet);
 
   // Maintain a mirrored list of sheets on the servo side.
-  Servo_PrependStyleSheet(aSheet->RawSheet(), mRawSet.get());
+  Servo_StyleSet_PrependStyleSheet(mRawSet.get(), aSheet->RawSheet());
 
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::RemoveStyleSheet(SheetType aType,
                                 ServoStyleSheet* aSheet)
 {
   MOZ_ASSERT(aSheet);
   MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(nsStyleSet::IsCSSSheetType(aType));
 
   mSheets[aType].RemoveElement(aSheet);
 
   // Maintain a mirrored list of sheets on the servo side.
-  Servo_RemoveStyleSheet(aSheet->RawSheet(), mRawSet.get());
+  Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), aSheet->RawSheet());
 
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::ReplaceSheets(SheetType aType,
                              const nsTArray<RefPtr<ServoStyleSheet>>& aNewSheets)
 {
   // Gecko uses a two-dimensional array keyed by sheet type, whereas Servo
   // stores a flattened list. This makes ReplaceSheets a pretty clunky thing
   // to express. If the need ever arises, we can easily make this more efficent,
   // probably by aligning the representations better between engines.
 
   for (ServoStyleSheet* sheet : mSheets[aType]) {
-    Servo_RemoveStyleSheet(sheet->RawSheet(), mRawSet.get());
+    Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), sheet->RawSheet());
   }
 
   mSheets[aType].Clear();
   mSheets[aType].AppendElements(aNewSheets);
 
   for (ServoStyleSheet* sheet : mSheets[aType]) {
-    Servo_AppendStyleSheet(sheet->RawSheet(), mRawSet.get());
+    Servo_StyleSet_AppendStyleSheet(mRawSet.get(), sheet->RawSheet());
   }
 
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
                                       ServoStyleSheet* aNewSheet,
@@ -328,18 +328,18 @@ ServoStyleSet::InsertStyleSheetBefore(Sh
   size_t idx = mSheets[aType].IndexOf(aReferenceSheet);
   if (idx == mSheets[aType].NoIndex) {
     return NS_ERROR_INVALID_ARG;
   }
 
   mSheets[aType].InsertElementAt(idx, aNewSheet);
 
   // Maintain a mirrored list of sheets on the servo side.
-  Servo_InsertStyleSheetBefore(aNewSheet->RawSheet(),
-                               aReferenceSheet->RawSheet(), mRawSet.get());
+  Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(), aNewSheet->RawSheet(),
+                                        aReferenceSheet->RawSheet());
 
   return NS_OK;
 }
 
 int32_t
 ServoStyleSet::SheetCount(SheetType aType) const
 {
   MOZ_ASSERT(nsStyleSet::IsCSSSheetType(aType));
@@ -371,20 +371,20 @@ ServoStyleSet::AddDocStyleSheet(ServoSty
   size_t index =
     aDocument->FindDocStyleSheetInsertionPoint(mSheets[SheetType::Doc], aSheet);
   mSheets[SheetType::Doc].InsertElementAt(index, aSheet);
 
   // Maintain a mirrored list of sheets on the servo side.
   ServoStyleSheet* followingSheet =
     mSheets[SheetType::Doc].SafeElementAt(index + 1);
   if (followingSheet) {
-    Servo_InsertStyleSheetBefore(aSheet->RawSheet(), followingSheet->RawSheet(),
-                                 mRawSet.get());
+    Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(), aSheet->RawSheet(),
+                                          followingSheet->RawSheet());
   } else {
-    Servo_AppendStyleSheet(aSheet->RawSheet(), mRawSet.get());
+    Servo_StyleSet_AppendStyleSheet(mRawSet.get(), aSheet->RawSheet());
   }
 
   return NS_OK;
 }
 
 already_AddRefed<nsStyleContext>
 ServoStyleSet::ProbePseudoElementStyle(Element* aParentElement,
                                        CSSPseudoElementType aType,