| Index: Source/core/css/resolver/ViewportStyleResolver.cpp
|
| diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
|
| index 61894a2458a283c32027c6837af2366d13c7fd3a..f10f893d59855b3cef374193f98895c14d422e47 100644
|
| --- a/Source/core/css/resolver/ViewportStyleResolver.cpp
|
| +++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
|
| @@ -31,6 +31,7 @@
|
| #include "core/css/resolver/ViewportStyleResolver.h"
|
|
|
| #include "CSSValueKeywords.h"
|
| +#include "core/css/CSSPrimitiveValueMappings.h"
|
| #include "core/css/CSSToLengthConversionData.h"
|
| #include "core/css/StylePropertySet.h"
|
| #include "core/css/StyleRule.h"
|
| @@ -183,25 +184,21 @@ Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) const
|
|
|
| CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
|
|
|
| - if (primitiveValue->isLength())
|
| - return primitiveValue->computeLength<Length>(CSSToLengthConversionData(m_document->renderStyle(), m_document->renderStyle(), 1.0f));
|
| + if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom)
|
| + return Length(ExtendToZoom);
|
|
|
| - if (primitiveValue->isViewportPercentageLength())
|
| - return primitiveValue->viewportPercentageLength();
|
| + RenderStyle* documentStyle = m_document->renderStyle();
|
|
|
| - if (primitiveValue->isPercentage())
|
| - return Length(primitiveValue->getFloatValue(), Percent);
|
| + // If we have viewport units the conversion will mark the document style as having viewport units.
|
| + bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits();
|
| + documentStyle->setHasViewportUnits(false);
|
| + Length result = primitiveValue->convertToLength<AnyConversion>(CSSToLengthConversionData(documentStyle, documentStyle, m_document->renderView(), 1.0f));
|
| + if (documentStyle->hasViewportUnits())
|
| + m_document->setHasViewportUnits();
|
| + documentStyle->setHasViewportUnits(documentStyleHasViewportUnits);
|
|
|
| - switch (primitiveValue->getValueID()) {
|
| - case CSSValueInternalExtendToZoom:
|
| - return Length(ExtendToZoom);
|
| - case CSSValueAuto:
|
| - return Length();
|
| - default:
|
| - // Unrecognized keyword.
|
| - ASSERT_NOT_REACHED();
|
| - return Length(0, Fixed);
|
| - }
|
| + ASSERT(!result.isUndefined());
|
| + return result;
|
| }
|
|
|
| } // namespace WebCore
|
|
|