Bug 1291891 - Implement ServoStyleSet::ReplaceSheets. r=emilio

This commit is contained in:
Bobby Holley 2016-08-02 21:08:01 -07:00
Родитель 3c38d97aa1
Коммит e20ac68912
1 изменённых файлов: 17 добавлений и 1 удалений

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

@ -263,7 +263,23 @@ nsresult
ServoStyleSet::ReplaceSheets(SheetType aType,
const nsTArray<RefPtr<ServoStyleSheet>>& aNewSheets)
{
MOZ_CRASH("stylo: not implemented");
// 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());
}
mSheets[aType].Clear();
mSheets[aType].AppendElements(aNewSheets);
for (ServoStyleSheet* sheet : mSheets[aType]) {
Servo_AppendStyleSheet(sheet->RawSheet(), mRawSet.get());
}
return NS_OK;
}
nsresult