| Index: Source/core/css/CSSPrimitiveValue.cpp
|
| diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
|
| index 62439ceb280f407e57f881e1ae3a198e2e408767..27a3df67a35c53f871bc81f4687517054b714703 100644
|
| --- a/Source/core/css/CSSPrimitiveValue.cpp
|
| +++ b/Source/core/css/CSSPrimitiveValue.cpp
|
| @@ -558,73 +558,72 @@ double CSSPrimitiveValue::computeDegrees()
|
| }
|
| }
|
|
|
| -template<> int CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> int CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return roundForImpreciseConversion<int>(computeLengthDouble(conversionData));
|
| + return roundForImpreciseConversion<int>(computeLengthDouble(&lengthData));
|
| }
|
|
|
| -template<> unsigned CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> unsigned CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return roundForImpreciseConversion<unsigned>(computeLengthDouble(conversionData));
|
| + return roundForImpreciseConversion<unsigned>(computeLengthDouble(&lengthData));
|
| }
|
|
|
| -template<> Length CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> Length CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return Length(clampTo<float>(computeLengthDouble(conversionData), minValueForCssLength, maxValueForCssLength), Fixed);
|
| + return Length(clampTo<float>(computeLengthDouble(&lengthData), minValueForCssLength, maxValueForCssLength), Fixed);
|
| }
|
|
|
| -template<> short CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> short CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return roundForImpreciseConversion<short>(computeLengthDouble(conversionData));
|
| + return roundForImpreciseConversion<short>(computeLengthDouble(&lengthData));
|
| }
|
|
|
| -template<> unsigned short CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> unsigned short CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return roundForImpreciseConversion<unsigned short>(computeLengthDouble(conversionData));
|
| + return roundForImpreciseConversion<unsigned short>(computeLengthDouble(&lengthData));
|
| }
|
|
|
| -template<> float CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> float CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return static_cast<float>(computeLengthDouble(conversionData));
|
| + return static_cast<float>(computeLengthDouble(&lengthData));
|
| }
|
|
|
| -template<> double CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData)
|
| +template<> double CSSPrimitiveValue::computeLength(const CSSLengthData& lengthData)
|
| {
|
| - return computeLengthDouble(conversionData);
|
| + return computeLengthDouble(&lengthData);
|
| }
|
|
|
| -double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& conversionData)
|
| +double CSSPrimitiveValue::computeLengthDouble(const CSSLengthData* lengthData)
|
| {
|
| + ASSERT(lengthData);
|
| if (m_primitiveUnitType == CSS_CALC)
|
| - return m_value.calc->computeLengthPx(conversionData);
|
| + return m_value.calc->computeLengthPx(lengthData);
|
|
|
| - const RenderStyle& style = conversionData.style();
|
| - const RenderStyle* rootStyle = conversionData.rootStyle();
|
| - bool computingFontSize = conversionData.computingFontSize();
|
| + bool computingFontSize = lengthData->computingFontSize();
|
|
|
| double factor;
|
|
|
| switch (primitiveType()) {
|
| case CSS_EMS:
|
| - factor = computingFontSize ? style.fontDescription().specifiedSize() : style.fontDescription().computedSize();
|
| + factor = computingFontSize ? lengthData->fontSpecifiedSize() : lengthData->fontComputedSize();
|
| break;
|
| case CSS_EXS:
|
| // FIXME: We have a bug right now where the zoom will be applied twice to EX units.
|
| // We really need to compute EX using fontMetrics for the original specifiedSize and not use
|
| // our actual constructed rendering font.
|
| - if (style.fontMetrics().hasXHeight())
|
| - factor = style.fontMetrics().xHeight();
|
| + if (lengthData->hasXHeight())
|
| + factor = lengthData->xHeight();
|
| else
|
| - factor = (computingFontSize ? style.fontDescription().specifiedSize() : style.fontDescription().computedSize()) / 2.0;
|
| + factor = (computingFontSize ? lengthData->fontSpecifiedSize() : lengthData->fontComputedSize()) / 2.0;
|
| break;
|
| case CSS_REMS:
|
| - if (rootStyle)
|
| - factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize();
|
| + if (lengthData->hasRoot())
|
| + factor = computingFontSize ? lengthData->rootFontSpecifiedSize() : lengthData->rootFontComputedSize();
|
| else
|
| factor = 1.0;
|
| break;
|
| case CSS_CHS:
|
| - factor = style.fontMetrics().zeroWidth();
|
| + factor = lengthData->zeroWidth();
|
| break;
|
| case CSS_PX:
|
| factor = 1.0;
|
| @@ -645,16 +644,16 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c
|
| factor = cssPixelsPerPica;
|
| break;
|
| case CSS_VW:
|
| - factor = conversionData.viewportWidthPercent();
|
| + factor = lengthData->viewportWidthPercent();
|
| break;
|
| case CSS_VH:
|
| - factor = conversionData.viewportHeightPercent();
|
| + factor = lengthData->viewportHeightPercent();
|
| break;
|
| case CSS_VMIN:
|
| - factor = conversionData.viewportMinPercent();
|
| + factor = lengthData->viewportMinPercent();
|
| break;
|
| case CSS_VMAX:
|
| - factor = conversionData.viewportMaxPercent();
|
| + factor = lengthData->viewportMaxPercent();
|
| break;
|
| case CSS_CALC_PERCENTAGE_WITH_LENGTH:
|
| case CSS_CALC_PERCENTAGE_WITH_NUMBER:
|
| @@ -672,7 +671,7 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c
|
| if (computingFontSize || isFontRelativeLength())
|
| return result;
|
|
|
| - return result * conversionData.zoom();
|
| + return result * lengthData->zoom();
|
| }
|
|
|
| void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionState& exceptionState)
|
|
|