Bug 1251496 - Forward stylesheet management to RawServoStyleSet. r=heycam

This commit is contained in:
Bobby Holley 2016-02-25 18:57:42 -08:00
Родитель 205b124ab5
Коммит 5c409b2ed2
5 изменённых файлов: 51 добавлений и 3 удалений

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

@ -170,6 +170,31 @@ Servo_ReleaseStylesheet(RawServoStyleSheet* sheet)
"non-MOZ_STYLO build");
}
void
Servo_AppendStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set)
{
MOZ_CRASH("stylo: shouldn't be calling Servo_AppendStyleSheet in a "
"non-MOZ_STYLO build");
}
void Servo_PrependStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set)
{
MOZ_CRASH("stylo: shouldn't be calling Servo_PrependStyleSheet in a "
"non-MOZ_STYLO build");
}
void Servo_RemoveStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set)
{
MOZ_CRASH("stylo: shouldn't be calling Servo_RemoveStyleSheet in a "
"non-MOZ_STYLO build");
}
int Servo_StyleSheetHasRules(RawServoStyleSheet* sheet)
{
MOZ_CRASH("stylo: shouldn't be calling Servo_StyleSheetHasRules in a "
"non-MOZ_STYLO build");
}
RawServoStyleSet*
Servo_InitStyleSet()
{

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

@ -82,6 +82,10 @@ void Servo_DropNodeData(ServoNodeData* data);
// generator is smart enough to handle them.
RawServoStyleSheet* Servo_StylesheetFromUTF8Bytes(const uint8_t* bytes, uint32_t length);
void Servo_ReleaseStylesheet(RawServoStyleSheet* sheet);
void Servo_AppendStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set);
void Servo_PrependStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set);
void Servo_RemoveStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set);
int Servo_StyleSheetHasRules(RawServoStyleSheet* sheet);
RawServoStyleSet* Servo_InitStyleSet();
void Servo_DropStyleSet(RawServoStyleSet* set);

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

@ -123,6 +123,9 @@ ServoStyleSet::AppendStyleSheet(SheetType 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());
return NS_OK;
}
@ -137,6 +140,9 @@ ServoStyleSet::PrependStyleSheet(SheetType 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());
return NS_OK;
}
@ -144,7 +150,16 @@ nsresult
ServoStyleSet::RemoveStyleSheet(SheetType aType,
ServoStyleSheet* aSheet)
{
MOZ_CRASH("stylo: not implemented");
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());
return NS_OK;
}
nsresult
@ -187,7 +202,9 @@ nsresult
ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
nsIDocument* aDocument)
{
MOZ_CRASH("stylo: not implemented");
// XXXbholley: Implement this.
NS_ERROR("stylo: no support for adding doc stylesheets to ServoStyleSet");
return NS_OK;
}
already_AddRefed<nsStyleContext>

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

@ -40,7 +40,7 @@ ServoStyleSheet::SetComplete()
bool
ServoStyleSheet::HasRules() const
{
MOZ_CRASH("stylo: not implemented");
return Servo_StyleSheetHasRules(RawSheet());
}
nsIDocument*

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

@ -53,6 +53,8 @@ public:
void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
#endif
RawServoStyleSheet* RawSheet() const { return mSheet; }
protected:
~ServoStyleSheet();