Bug 1325728 - Use Gecko's existing mechanism to coordinate flushing the Stylist. r=heycam

This commit is contained in:
Bobby Holley 2016-12-21 15:33:24 -08:00
parent 1527e17416
commit 3e1898e903
2 changed files with 18 additions and 13 deletions

View File

@ -39,14 +39,15 @@ SERVO_BINDING_FUNC(Servo_StyleSheet_GetRules, ServoCssRulesStrong,
SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSetOwned)
SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet,
RawServoStyleSheetBorrowed reference)
RawServoStyleSheetBorrowed reference, bool flush)
SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void, RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
RawServoStyleSetBorrowed set)

View File

@ -85,7 +85,7 @@ ServoStyleSet::EndUpdate()
return NS_OK;
}
// ... do something ...
Servo_StyleSet_FlushStyleSheets(mRawSet.get());
return NS_OK;
}
@ -249,7 +249,7 @@ ServoStyleSet::AppendStyleSheet(SheetType aType,
mSheets[aType].AppendElement(aSheet);
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_AppendStyleSheet(mRawSet.get(), aSheet->RawSheet());
Servo_StyleSet_AppendStyleSheet(mRawSet.get(), aSheet->RawSheet(), !mBatching);
return NS_OK;
}
@ -266,7 +266,7 @@ ServoStyleSet::PrependStyleSheet(SheetType aType,
mSheets[aType].InsertElementAt(0, aSheet);
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_PrependStyleSheet(mRawSet.get(), aSheet->RawSheet());
Servo_StyleSet_PrependStyleSheet(mRawSet.get(), aSheet->RawSheet(), !mBatching);
return NS_OK;
}
@ -282,7 +282,7 @@ ServoStyleSet::RemoveStyleSheet(SheetType aType,
mSheets[aType].RemoveElement(aSheet);
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), aSheet->RawSheet());
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), aSheet->RawSheet(), !mBatching);
return NS_OK;
}
@ -297,14 +297,18 @@ ServoStyleSet::ReplaceSheets(SheetType aType,
// probably by aligning the representations better between engines.
for (ServoStyleSheet* sheet : mSheets[aType]) {
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), sheet->RawSheet());
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), sheet->RawSheet(), false);
}
mSheets[aType].Clear();
mSheets[aType].AppendElements(aNewSheets);
for (ServoStyleSheet* sheet : mSheets[aType]) {
Servo_StyleSet_AppendStyleSheet(mRawSet.get(), sheet->RawSheet());
Servo_StyleSet_AppendStyleSheet(mRawSet.get(), sheet->RawSheet(), false);
}
if (!mBatching) {
Servo_StyleSet_FlushStyleSheets(mRawSet.get());
}
return NS_OK;
@ -329,7 +333,7 @@ ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(), aNewSheet->RawSheet(),
aReferenceSheet->RawSheet());
aReferenceSheet->RawSheet(), !mBatching);
return NS_OK;
}
@ -372,9 +376,9 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
mSheets[SheetType::Doc].SafeElementAt(index + 1);
if (followingSheet) {
Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(), aSheet->RawSheet(),
followingSheet->RawSheet());
followingSheet->RawSheet(), !mBatching);
} else {
Servo_StyleSet_AppendStyleSheet(mRawSet.get(), aSheet->RawSheet());
Servo_StyleSet_AppendStyleSheet(mRawSet.get(), aSheet->RawSheet(), !mBatching);
}
return NS_OK;