зеркало из https://github.com/mozilla/pjs.git
Make nsStyleCoord::operator== check deep equality of calc() expressions rather than just doing pointer comparison. (Bug 585715) r=bzbarsky a2.0=blocking+
This commit is contained in:
Родитель
37d18ea6ad
Коммит
8e4c118d9d
|
@ -102,14 +102,36 @@ nsStyleCoord& nsStyleCoord::operator=(const nsStyleCoord& aCopy)
|
|||
|
||||
PRBool nsStyleCoord::operator==(const nsStyleCoord& aOther) const
|
||||
{
|
||||
if (mUnit == aOther.mUnit) {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
|
||||
}
|
||||
else {
|
||||
return PRBool(mValue.mInt == aOther.mValue.mInt);
|
||||
if (mUnit != aOther.mUnit) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
switch (mUnit) {
|
||||
case eStyleUnit_Null:
|
||||
case eStyleUnit_Normal:
|
||||
case eStyleUnit_Auto:
|
||||
case eStyleUnit_None:
|
||||
return PR_TRUE;
|
||||
case eStyleUnit_Percent:
|
||||
case eStyleUnit_Factor:
|
||||
case eStyleUnit_Degree:
|
||||
case eStyleUnit_Grad:
|
||||
case eStyleUnit_Radian:
|
||||
return mValue.mFloat == aOther.mValue.mFloat;
|
||||
case eStyleUnit_Coord:
|
||||
case eStyleUnit_Integer:
|
||||
case eStyleUnit_Enumerated:
|
||||
return mValue.mInt == aOther.mValue.mInt;
|
||||
case eStyleUnit_Calc:
|
||||
case eStyleUnit_Calc_Plus:
|
||||
case eStyleUnit_Calc_Minus:
|
||||
case eStyleUnit_Calc_Times_L:
|
||||
case eStyleUnit_Calc_Times_R:
|
||||
case eStyleUnit_Calc_Divided:
|
||||
case eStyleUnit_Calc_Minimum:
|
||||
case eStyleUnit_Calc_Maximum:
|
||||
return *this->GetArrayValue() == *aOther.GetArrayValue();
|
||||
}
|
||||
NS_ABORT_IF_FALSE(PR_FALSE, "unexpected unit");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче