mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1394551 - stylo: Dont unnecessarily construct gfxFontFeatureValueSet r=xidorn
If there is no font feature values inside document we should avoid creating unnecessary objects. MozReview-Commit-ID: HJKMzQvQAPR --HG-- extra : rebase_source : 06dc792d2c4848c4c8ca49b9eb98630d5d475006
This commit is contained in:
parent
bd1b4a22ec
commit
39c02b31f3
@ -113,9 +113,10 @@ SERVO_BINDING_FUNC(Servo_StyleSet_GetFontFaceRules, void,
|
||||
RawGeckoFontFaceRuleListBorrowedMut list)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_GetCounterStyleRule, nsCSSCounterStyleRule*,
|
||||
RawServoStyleSetBorrowed set, nsIAtom* name)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_BuildFontFeatureValueSet, bool,
|
||||
RawServoStyleSetBorrowed set,
|
||||
gfxFontFeatureValueSet* list)
|
||||
// This function may return nullptr or gfxFontFeatureValueSet with zero reference.
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_BuildFontFeatureValueSet,
|
||||
gfxFontFeatureValueSet*,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_ResolveForDeclarations,
|
||||
ServoStyleContextStrong,
|
||||
RawServoStyleSetBorrowed set,
|
||||
|
@ -1334,6 +1334,12 @@ Gecko_nsFont_Destroy(nsFont* aDest)
|
||||
aDest->~nsFont();
|
||||
}
|
||||
|
||||
gfxFontFeatureValueSet*
|
||||
Gecko_ConstructFontFeatureValueSet()
|
||||
{
|
||||
return new gfxFontFeatureValueSet();
|
||||
}
|
||||
|
||||
nsTArray<unsigned int>*
|
||||
Gecko_AppendFeatureValueHashEntry(gfxFontFeatureValueSet* aFontFeatureValues,
|
||||
nsIAtom* aFamily, uint32_t aAlternate, nsIAtom* aName)
|
||||
|
@ -301,6 +301,8 @@ void Gecko_nsFont_InitSystem(nsFont* dst, int32_t font_id,
|
||||
const nsStyleFont* font, RawGeckoPresContextBorrowed pres_context);
|
||||
void Gecko_nsFont_Destroy(nsFont* dst);
|
||||
|
||||
// The gfxFontFeatureValueSet returned from this function has zero reference.
|
||||
gfxFontFeatureValueSet* Gecko_ConstructFontFeatureValueSet();
|
||||
nsTArray<unsigned int>* Gecko_AppendFeatureValueHashEntry(
|
||||
gfxFontFeatureValueSet* value_set, nsIAtom* family, uint32_t alternate, nsIAtom* name);
|
||||
void Gecko_nsFont_SetFontFeatureValuesLookup(nsFont* font,
|
||||
|
@ -1420,11 +1420,8 @@ already_AddRefed<gfxFontFeatureValueSet>
|
||||
ServoStyleSet::BuildFontFeatureValueSet()
|
||||
{
|
||||
UpdateStylistIfNeeded();
|
||||
RefPtr<gfxFontFeatureValueSet> set = new gfxFontFeatureValueSet();
|
||||
bool setHasAnyRules = Servo_StyleSet_BuildFontFeatureValueSet(mRawSet.get(), set.get());
|
||||
if (!setHasAnyRules) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<gfxFontFeatureValueSet> set =
|
||||
Servo_StyleSet_BuildFontFeatureValueSet(mRawSet.get());
|
||||
return set.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user