Chromium Code Reviews| Index: Source/core/css/resolver/ViewportStyleResolver.cpp |
| diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp |
| index 4480d7f47ed72473c1df70a02e517c538613d8a5..c09cda0b60278c3057add2c933abbd5f2e34c492 100644 |
| --- a/Source/core/css/resolver/ViewportStyleResolver.cpp |
| +++ b/Source/core/css/resolver/ViewportStyleResolver.cpp |
| @@ -84,10 +84,10 @@ void ViewportStyleResolver::resolve() |
| arguments.zoom = getViewportArgumentValue(CSSPropertyZoom); |
| arguments.minZoom = getViewportArgumentValue(CSSPropertyMinZoom); |
| arguments.maxZoom = getViewportArgumentValue(CSSPropertyMaxZoom); |
| - arguments.minWidth = getViewportArgumentValue(CSSPropertyMinWidth); |
| - arguments.maxWidth = getViewportArgumentValue(CSSPropertyMaxWidth); |
| - arguments.minHeight = getViewportArgumentValue(CSSPropertyMinHeight); |
| - arguments.maxHeight = getViewportArgumentValue(CSSPropertyMaxHeight); |
| + arguments.minWidth = getViewportLengthValue(CSSPropertyMinWidth); |
| + arguments.maxWidth = getViewportLengthValue(CSSPropertyMaxWidth); |
| + arguments.minHeight = getViewportLengthValue(CSSPropertyMinHeight); |
| + arguments.maxHeight = getViewportLengthValue(CSSPropertyMaxHeight); |
| arguments.orientation = getViewportArgumentValue(CSSPropertyOrientation); |
| m_document->setViewportArguments(arguments); |
| @@ -121,12 +121,6 @@ float ViewportStyleResolver::getViewportArgumentValue(CSSPropertyID id) const |
| if (primitiveValue->isPercentage()) { |
| float percentValue = primitiveValue->getFloatValue() / 100.0f; |
| switch (id) { |
| - case CSSPropertyMaxHeight: |
| - case CSSPropertyMinHeight: |
| - return percentValue * m_document->initialViewportSize().height(); |
| - case CSSPropertyMaxWidth: |
| - case CSSPropertyMinWidth: |
| - return percentValue * m_document->initialViewportSize().width(); |
| case CSSPropertyMaxZoom: |
| case CSSPropertyMinZoom: |
| case CSSPropertyZoom: |
| @@ -155,4 +149,38 @@ float ViewportStyleResolver::getViewportArgumentValue(CSSPropertyID id) const |
| } |
| } |
| +Length ViewportStyleResolver::getViewportLengthValue(CSSPropertyID id) const |
| +{ |
| + ASSERT(id == CSSPropertyMaxHeight |
| + || id == CSSPropertyMinHeight |
| + || id == CSSPropertyMaxWidth |
| + || id == CSSPropertyMinWidth); |
| + |
| + RefPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); |
| + if (!value) |
| + return Length(); // auto |
| + |
| + ASSERT(value->isPrimitiveValue()); |
| + |
| + CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); |
| + |
| + if (primitiveValue->isLength()) |
| + return primitiveValue->computeLength<Length>(m_document->renderStyle(), m_document->renderStyle()); |
| + |
| + if (primitiveValue->isViewportPercentageLength()) |
| + return primitiveValue->viewportPercentageLength(); |
| + |
| + if (primitiveValue->isPercentage()) |
| + return Length(primitiveValue->getFloatValue(), Percent); |
| + |
| + switch (primitiveValue->getValueID()) { |
| + case CSSValueInternalExtendToZoom: |
| + return Length(ExtendToZoom); |
| + default: |
|
apavlov
2013/08/07 09:25:54
Is there any particular idea behind putting "defau
rune
2013/08/07 10:06:15
Just to avoid an extra "return Length();" statemen
apavlov
2013/08/07 10:12:10
Well, this doesn't look like code where two cases
rune
2013/08/07 11:30:04
Chose 0px in patch set 3.
|
| + ASSERT_NOT_REACHED(); |
| + case CSSValueAuto: |
| + return Length(); |
| + } |
| +} |
| + |
| } // namespace WebCore |