Skip to content

Commit

Permalink
Bug 1296173 part 1 - Change StyleSet manipulation functions to be pre…
Browse files Browse the repository at this point in the history
…fixed by Servo_StyleSet_. r=bholley

MozReview-Commit-ID: C1PPJltyodE
  • Loading branch information
Xidorn Quan committed Aug 23, 2016
1 parent 32e44f5 commit 0e27dbf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
19 changes: 9 additions & 10 deletions layout/style/ServoBindingList.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,19 @@ 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,
Expand Down
20 changes: 10 additions & 10 deletions layout/style/ServoStyleSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ServoStyleSet::AppendStyleSheet(SheetType aType,
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;
}
Expand All @@ -269,7 +269,7 @@ ServoStyleSet::PrependStyleSheet(SheetType aType,
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;
}
Expand All @@ -285,7 +285,7 @@ ServoStyleSet::RemoveStyleSheet(SheetType 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;
}
Expand All @@ -300,14 +300,14 @@ ServoStyleSet::ReplaceSheets(SheetType aType,
// 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;
Expand All @@ -331,8 +331,8 @@ ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
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;
}
Expand Down Expand Up @@ -374,10 +374,10 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
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;
Expand Down

0 comments on commit 0e27dbf

Please sign in to comment.