зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1270515 - Avoid synthesizing temporary nsStyleCoords in nsStyleSides::ConvertsToLength. r=dbaron
This commit is contained in:
Родитель
419e80ad06
Коммит
e7fab38387
|
@ -174,9 +174,14 @@ public:
|
||||||
(IsCalcUnit() && CalcHasPercent());
|
(IsCalcUnit() && CalcHasPercent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ConvertsToLength(const nsStyleUnit aUnit,
|
||||||
|
const nsStyleUnion aValue) {
|
||||||
|
return aUnit == eStyleUnit_Coord ||
|
||||||
|
(IsCalcUnit(aUnit) && !AsCalcValue(aValue)->mHasPercent);
|
||||||
|
}
|
||||||
|
|
||||||
bool ConvertsToLength() const {
|
bool ConvertsToLength() const {
|
||||||
return mUnit == eStyleUnit_Coord ||
|
return ConvertsToLength(mUnit, mValue);
|
||||||
(IsCalcUnit() && !CalcHasPercent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord ToLength() const {
|
nscoord ToLength() const {
|
||||||
|
@ -188,6 +193,11 @@ public:
|
||||||
return GetCalcValue()->ToLength();
|
return GetCalcValue()->ToLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callers must verify IsCalcUnit before calling this function.
|
||||||
|
static Calc* AsCalcValue(nsStyleUnion aValue) {
|
||||||
|
return static_cast<Calc*>(aValue.mPointer);
|
||||||
|
}
|
||||||
|
|
||||||
nscoord GetCoordValue() const;
|
nscoord GetCoordValue() const;
|
||||||
int32_t GetIntValue() const;
|
int32_t GetIntValue() const;
|
||||||
float GetPercentValue() const;
|
float GetPercentValue() const;
|
||||||
|
@ -292,7 +302,7 @@ public:
|
||||||
|
|
||||||
bool ConvertsToLength() const {
|
bool ConvertsToLength() const {
|
||||||
NS_FOR_CSS_SIDES(side) {
|
NS_FOR_CSS_SIDES(side) {
|
||||||
if (!Get(side).ConvertsToLength()) {
|
if (!nsStyleCoord::ConvertsToLength(mUnits[side], mValues[side])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,7 +445,7 @@ inline nsStyleCoord::Calc* nsStyleCoord::GetCalcValue() const
|
||||||
{
|
{
|
||||||
NS_ASSERTION(IsCalcUnit(), "not a pointer value");
|
NS_ASSERTION(IsCalcUnit(), "not a pointer value");
|
||||||
if (IsCalcUnit()) {
|
if (IsCalcUnit()) {
|
||||||
return static_cast<Calc*>(mValue.mPointer);
|
return AsCalcValue(mValue);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -824,10 +824,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin
|
||||||
|
|
||||||
nsStyleSides mMargin; // [reset] coord, percent, calc, auto
|
nsStyleSides mMargin; // [reset] coord, percent, calc, auto
|
||||||
|
|
||||||
bool IsWidthDependent() const {
|
|
||||||
return !mMargin.ConvertsToLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetMargin(nsMargin& aMargin) const
|
bool GetMargin(nsMargin& aMargin) const
|
||||||
{
|
{
|
||||||
if (mMargin.ConvertsToLength()) {
|
if (mMargin.ConvertsToLength()) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче