Bug 1296173 part 1 - Change StyleSet manipulation functions to be prefixed by Servo_StyleSet_. r?bholley
MozReview-Commit-ID: C1PPJltyodE
--- 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,