зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1270515 - Bonus fix: Factor out unnecessary Reset calls during nsStyleCoord initialization. r=dbaron
The previous patches prevent us from generating temporaries at the affected callsites, but this could still have benefits in other places.
This commit is contained in:
Родитель
23b53c3cad
Коммит
21a222e332
|
@ -243,6 +243,15 @@ public:
|
|||
static inline void SetValue(nsStyleUnit& aUnit, nsStyleUnion& aValue,
|
||||
const nsStyleCoord& aOther);
|
||||
|
||||
// Like the above, but do not reset before setting.
|
||||
static inline void InitWithValue(nsStyleUnit& aUnit,
|
||||
nsStyleUnion& aValue,
|
||||
nsStyleUnit aOtherUnit,
|
||||
const nsStyleUnion& aOtherValue);
|
||||
|
||||
static inline void InitWithValue(nsStyleUnit& aUnit, nsStyleUnion& aValue,
|
||||
const nsStyleCoord& aOther);
|
||||
|
||||
private:
|
||||
nsStyleUnit mUnit;
|
||||
nsStyleUnion mValue;
|
||||
|
@ -368,13 +377,13 @@ inline nsStyleCoord::nsStyleCoord(nscoord aValue, CoordConstructorType)
|
|||
inline nsStyleCoord::nsStyleCoord(const nsStyleCoord& aCopy)
|
||||
: mUnit(eStyleUnit_Null)
|
||||
{
|
||||
SetValue(mUnit, mValue, aCopy);
|
||||
InitWithValue(mUnit, mValue, aCopy);
|
||||
}
|
||||
|
||||
inline nsStyleCoord::nsStyleCoord(const nsStyleUnion& aValue, nsStyleUnit aUnit)
|
||||
: mUnit(eStyleUnit_Null)
|
||||
{
|
||||
SetValue(mUnit, mValue, aUnit, aValue);
|
||||
InitWithValue(mUnit, mValue, aUnit, aValue);
|
||||
}
|
||||
|
||||
inline bool nsStyleCoord::operator!=(const nsStyleCoord& aOther) const
|
||||
|
@ -483,7 +492,15 @@ nsStyleCoord::SetValue(nsStyleUnit& aUnit,
|
|||
const nsStyleUnion& aOtherValue)
|
||||
{
|
||||
Reset(aUnit, aValue);
|
||||
InitWithValue(aUnit, aValue, aOtherUnit, aOtherValue);
|
||||
}
|
||||
|
||||
/* static */ inline void
|
||||
nsStyleCoord::InitWithValue(nsStyleUnit& aUnit,
|
||||
nsStyleUnion& aValue,
|
||||
nsStyleUnit aOtherUnit,
|
||||
const nsStyleUnion& aOtherValue)
|
||||
{
|
||||
aUnit = aOtherUnit;
|
||||
aValue = aOtherValue;
|
||||
|
||||
|
@ -503,6 +520,13 @@ nsStyleCoord::SetValue(nsStyleUnit& aUnit, nsStyleUnion& aValue,
|
|||
SetValue(aUnit, aValue, aOther.mUnit, aOther.mValue);
|
||||
}
|
||||
|
||||
/* static */ inline void
|
||||
nsStyleCoord::InitWithValue(nsStyleUnit& aUnit, nsStyleUnion& aValue,
|
||||
const nsStyleCoord& aOther)
|
||||
{
|
||||
InitWithValue(aUnit, aValue, aOther.mUnit, aOther.mValue);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------
|
||||
// nsStyleSides inlines
|
||||
|
|
Загрузка…
Ссылка в новой задаче