| 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..f10190a948d4c7fa5b62498a144fd5cc86d0989b 100644
|
| --- a/Source/core/css/resolver/ViewportStyleResolver.cpp
|
| +++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
|
| @@ -31,12 +31,14 @@
|
| #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"
|
| #include "core/dom/Document.h"
|
| #include "core/dom/NodeRenderStyle.h"
|
| #include "core/dom/ViewportDescription.h"
|
| +#include "core/frame/FrameView.h"
|
|
|
| namespace WebCore {
|
|
|
| @@ -183,25 +185,25 @@ 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);
|
|
|
| - switch (primitiveValue->getValueID()) {
|
| - case CSSValueInternalExtendToZoom:
|
| - return Length(ExtendToZoom);
|
| - case CSSValueAuto:
|
| - return Length();
|
| - default:
|
| - // Unrecognized keyword.
|
| - ASSERT_NOT_REACHED();
|
| - return Length(0, Fixed);
|
| - }
|
| + FrameView* view = m_document->view();
|
| + float width = view ? view->width() : 0;
|
| + float height = view ? view->height() : 0;
|
| +
|
| + Length result = primitiveValue->convertToLength<AnyConversion>(CSSToLengthConversionData(documentStyle, documentStyle, width, height, 1.0f));
|
| + if (documentStyle->hasViewportUnits())
|
| + m_document->setHasViewportUnits();
|
| + documentStyle->setHasViewportUnits(documentStyleHasViewportUnits);
|
| +
|
| + return result;
|
| }
|
|
|
| } // namespace WebCore
|
|
|