Bug 1026344 - Part 3: Rename CalcValue to PixelCalcValue. r=dbaron

This commit is contained in:
Cameron McCormack 2014-06-19 13:17:56 +10:00
Родитель 916d111a71
Коммит 06cbf2ee81
1 изменённых файлов: 22 добавлений и 22 удалений

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

@ -278,13 +278,13 @@ AppendCSSShadowValue(const nsCSSShadowItem *aShadow,
}
// Like nsStyleCoord::Calc, but with length in float pixels instead of nscoord.
struct CalcValue {
struct PixelCalcValue {
float mLength, mPercent;
bool mHasPercent;
};
// Requires a canonical calc() value that we generated.
static CalcValue
static PixelCalcValue
ExtractCalcValueInternal(const nsCSSValue& aValue)
{
NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Calc, "unexpected unit");
@ -292,7 +292,7 @@ ExtractCalcValueInternal(const nsCSSValue& aValue)
NS_ABORT_IF_FALSE(arr->Count() == 1, "unexpected length");
const nsCSSValue &topval = arr->Item(0);
CalcValue result;
PixelCalcValue result;
if (topval.GetUnit() == eCSSUnit_Pixel) {
result.mLength = topval.GetFloatValue();
result.mPercent = 0.0f;
@ -314,10 +314,10 @@ ExtractCalcValueInternal(const nsCSSValue& aValue)
}
// Requires a canonical calc() value that we generated.
static CalcValue
static PixelCalcValue
ExtractCalcValue(const nsStyleAnimation::Value& aValue)
{
CalcValue result;
PixelCalcValue result;
if (aValue.GetUnit() == nsStyleAnimation::eUnit_Coord) {
result.mLength =
nsPresContext::AppUnitsToFloatCSSPixels(aValue.GetCoordValue());
@ -337,10 +337,10 @@ ExtractCalcValue(const nsStyleAnimation::Value& aValue)
return ExtractCalcValueInternal(*val);
}
static CalcValue
static PixelCalcValue
ExtractCalcValue(const nsCSSValue& aValue)
{
CalcValue result;
PixelCalcValue result;
if (aValue.GetUnit() == eCSSUnit_Pixel) {
result.mLength = aValue.GetFloatValue();
result.mPercent = 0.0f;
@ -373,7 +373,7 @@ SetCalcValue(const nsStyleCoord::Calc* aCalc, nsCSSValue& aValue)
}
static void
SetCalcValue(const CalcValue& aCalc, nsCSSValue& aValue)
SetCalcValue(const PixelCalcValue& aCalc, nsCSSValue& aValue)
{
nsRefPtr<nsCSSValue::Array> arr = nsCSSValue::Array::Create(1);
if (!aCalc.mHasPercent) {
@ -506,8 +506,8 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
return true;
}
case eUnit_Calc: {
CalcValue v1 = ExtractCalcValue(aStartValue);
CalcValue v2 = ExtractCalcValue(aEndValue);
PixelCalcValue v1 = ExtractCalcValue(aStartValue);
PixelCalcValue v2 = ExtractCalcValue(aEndValue);
float difflen = v2.mLength - v1.mLength;
float diffpct = v2.mPercent - v1.mPercent;
aDistance = sqrt(difflen * difflen + diffpct * diffpct);
@ -547,8 +547,8 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
break;
}
case eCSSUnit_Calc: {
CalcValue v1 = ExtractCalcValue(pair1->*member);
CalcValue v2 = ExtractCalcValue(pair2->*member);
PixelCalcValue v1 = ExtractCalcValue(pair1->*member);
PixelCalcValue v2 = ExtractCalcValue(pair2->*member);
float difflen = v2.mLength - v1.mLength;
float diffpct = v2.mPercent - v1.mPercent;
diffsquared = difflen * difflen + diffpct * diffpct;
@ -600,8 +600,8 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
break;
}
case eCSSUnit_Calc: {
CalcValue v1 = ExtractCalcValue(triplet1->*member);
CalcValue v2 = ExtractCalcValue(triplet2->*member);
PixelCalcValue v1 = ExtractCalcValue(triplet1->*member);
PixelCalcValue v2 = ExtractCalcValue(triplet2->*member);
float difflen = v2.mLength - v1.mLength;
float diffpct = v2.mPercent - v1.mPercent;
diffsquared = difflen * difflen + diffpct * diffpct;
@ -791,7 +791,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
position2->mValue.GetUnit() == eCSSUnit_Array,
"Expected two arrays");
CalcValue calcVal[4];
PixelCalcValue calcVal[4];
nsCSSValue::Array* bgArray = position1->mValue.GetArrayValue();
NS_ABORT_IF_FALSE(bgArray->Count() == 4, "Invalid background-position");
@ -862,8 +862,8 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
break;
}
case eCSSUnit_Calc: {
CalcValue val1 = ExtractCalcValue(v1);
CalcValue val2 = ExtractCalcValue(v2);
PixelCalcValue val1 = ExtractCalcValue(v1);
PixelCalcValue val2 = ExtractCalcValue(v2);
float difflen = val2.mLength - val1.mLength;
float diffpct = val2.mPercent - val1.mPercent;
diffsquared = difflen * difflen + diffpct * diffpct;
@ -1004,9 +1004,9 @@ AddCSSValueCanonicalCalc(double aCoeff1, const nsCSSValue &aValue1,
double aCoeff2, const nsCSSValue &aValue2,
nsCSSValue &aResult)
{
CalcValue v1 = ExtractCalcValue(aValue1);
CalcValue v2 = ExtractCalcValue(aValue2);
CalcValue result;
PixelCalcValue v1 = ExtractCalcValue(aValue1);
PixelCalcValue v2 = ExtractCalcValue(aValue2);
PixelCalcValue result;
result.mLength = aCoeff1 * v1.mLength + aCoeff2 * v2.mLength;
result.mPercent = aCoeff1 * v1.mPercent + aCoeff2 * v2.mPercent;
result.mHasPercent = v1.mHasPercent || v2.mHasPercent;
@ -1980,8 +1980,8 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
return true;
}
case eUnit_Calc: {
CalcValue v1 = ExtractCalcValue(aValue1);
CalcValue v2 = ExtractCalcValue(aValue2);
PixelCalcValue v1 = ExtractCalcValue(aValue1);
PixelCalcValue v2 = ExtractCalcValue(aValue2);
double len = aCoeff1 * v1.mLength + aCoeff2 * v2.mLength;
double pct = aCoeff1 * v1.mPercent + aCoeff2 * v2.mPercent;
bool hasPct = (aCoeff1 != 0.0 && v1.mHasPercent) ||