Bug 1361843 part 3. Clear the stylist when styleshets change, but don't do anything else until there's an explicit sheet flush. r=emilio

MozReview-Commit-ID: IhK1ECeuYbM

--HG--
extra : rebase_source : be155be7d8b3b88446cc2c338039e85db4e133ae
This commit is contained in:
Boris Zbarsky 2017-05-10 13:13:45 -04:00
Родитель 170c7570c7
Коммит 6f37f1a119
2 изменённых файлов: 14 добавлений и 39 удалений

Просмотреть файл

@ -52,23 +52,19 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
RawServoStyleSetBorrowed set,
RawServoStyleSheetBorrowed sheet,
uint32_t unique_id,
bool flush)
uint32_t unique_id)
SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
RawServoStyleSetBorrowed set,
RawServoStyleSheetBorrowed sheet,
uint32_t unique_id,
bool flush)
uint32_t unique_id)
SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
RawServoStyleSetBorrowed set,
uint32_t unique_id,
bool flush)
uint32_t unique_id)
SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
RawServoStyleSetBorrowed set,
RawServoStyleSheetBorrowed sheet,
uint32_t unique_id,
uint32_t before_unique_id,
bool flush)
uint32_t before_unique_id)
SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void, RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
RawServoStyleSetBorrowed set, bool author_style_disabled)

Просмотреть файл

@ -68,8 +68,7 @@ ServoStyleSet::Init(nsPresContext* aPresContext)
MOZ_ASSERT(entry.sheet->RawSheet(), "We should only append non-null raw sheets.");
Servo_StyleSet_AppendStyleSheet(mRawSet.get(),
entry.sheet->RawSheet(),
entry.uniqueID,
false);
entry.uniqueID);
}
}
@ -173,12 +172,7 @@ nsresult
ServoStyleSet::EndUpdate()
{
MOZ_ASSERT(mBatching > 0);
if (--mBatching > 0) {
return NS_OK;
}
Servo_StyleSet_FlushStyleSheets(mRawSet.get());
mStylistMayNeedRebuild = false;
--mBatching;
return NS_OK;
}
@ -592,8 +586,7 @@ ServoStyleSet::AppendStyleSheet(SheetType aType,
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_AppendStyleSheet(mRawSet.get(),
aSheet->RawSheet(),
newUniqueID,
!mBatching);
newUniqueID);
mStylistMayNeedRebuild = true;
}
@ -619,8 +612,7 @@ ServoStyleSet::PrependStyleSheet(SheetType aType,
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_PrependStyleSheet(mRawSet.get(),
aSheet->RawSheet(),
newUniqueID,
!mBatching);
newUniqueID);
mStylistMayNeedRebuild = true;
}
@ -637,7 +629,7 @@ ServoStyleSet::RemoveStyleSheet(SheetType aType,
uint32_t uniqueID = RemoveSheetOfType(aType, aSheet);
if (mRawSet && uniqueID) {
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), uniqueID, !mBatching);
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), uniqueID);
mStylistMayNeedRebuild = true;
}
@ -658,7 +650,7 @@ ServoStyleSet::ReplaceSheets(SheetType aType,
// Remove all the existing sheets first.
if (mRawSet) {
for (const Entry& entry : mEntries[aType]) {
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), entry.uniqueID, false);
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), entry.uniqueID);
}
}
mEntries[aType].Clear();
@ -670,16 +662,10 @@ ServoStyleSet::ReplaceSheets(SheetType aType,
MOZ_ASSERT(sheet->RawSheet(), "Raw sheet should be in place before replacement.");
Servo_StyleSet_AppendStyleSheet(mRawSet.get(),
sheet->RawSheet(),
uniqueID,
false);
uniqueID);
}
}
if (!mBatching) {
Servo_StyleSet_FlushStyleSheets(mRawSet.get());
mStylistMayNeedRebuild = false;
}
return NS_OK;
}
@ -714,8 +700,7 @@ ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(),
aNewSheet->RawSheet(),
newUniqueID,
beforeUniqueID,
!mBatching);
beforeUniqueID);
mStylistMayNeedRebuild = true;
}
@ -770,8 +755,7 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
Servo_StyleSet_InsertStyleSheetBefore(mRawSet.get(),
aSheet->RawSheet(),
newUniqueID,
beforeUniqueID,
!mBatching);
beforeUniqueID);
mStylistMayNeedRebuild = true;
}
} else {
@ -784,8 +768,7 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
// Maintain a mirrored list of sheets on the servo side.
Servo_StyleSet_AppendStyleSheet(mRawSet.get(),
aSheet->RawSheet(),
newUniqueID,
!mBatching);
newUniqueID);
mStylistMayNeedRebuild = true;
}
}
@ -925,10 +908,6 @@ ServoStyleSet::NoteStyleSheetsChanged()
{
mStylistMayNeedRebuild = true;
Servo_StyleSet_NoteStyleSheetsChanged(mRawSet.get(), mAuthorStyleDisabled);
if (!mBatching) {
Servo_StyleSet_FlushStyleSheets(mRawSet.get());
mStylistMayNeedRebuild = false;
}
}
#ifdef DEBUG