Chromium Code Reviews| Index: Source/core/css/resolver/FontBuilder.cpp |
| diff --git a/Source/core/css/resolver/FontBuilder.cpp b/Source/core/css/resolver/FontBuilder.cpp |
| index 115419690518dec1c0df56a131d0f964fc643a2f..f7ea2a79a3cdd6be322ae2c9f7ff7668302e95a7 100644 |
| --- a/Source/core/css/resolver/FontBuilder.cpp |
| +++ b/Source/core/css/resolver/FontBuilder.cpp |
| @@ -62,6 +62,7 @@ private: |
| FontBuilder::FontBuilder() |
| : m_document(0) |
| , m_useSVGZoomRules(false) |
| + , m_fontSizehasViewportUnits(false) |
| , m_fontDirty(false) |
| { |
| } |
| @@ -324,16 +325,22 @@ void FontBuilder::setFontSizeValue(CSSValue* value, RenderStyle* parentStyle, co |
| scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize && (valueID == CSSValueLarger || valueID == CSSValueSmaller)); |
| } else { |
| scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength())); |
| - if (primitiveValue->isLength()) |
| - size = primitiveValue->computeLength<float>(CSSToLengthConversionData(parentStyle, rootElementStyle, 1.0, true)); |
| - else if (primitiveValue->isPercentage()) |
| + if (primitiveValue->isPercentage()) { |
| size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; |
| - else if (primitiveValue->isCalculatedPercentageWithLength()) |
| - size = primitiveValue->cssCalcValue()->toCalcValue(CSSToLengthConversionData(parentStyle, rootElementStyle, 1.0f))->evaluate(parentSize); |
| - else if (primitiveValue->isViewportPercentageLength()) |
| - size = valueForLength(primitiveValue->viewportPercentageLength(), 0, m_document->renderView()); |
| - else |
| - return; |
| + } else { |
| + // If we have viewport units the conversion will mark the parent style as having viewport units. |
| + bool parentHasViewportUnits = parentStyle->hasViewportUnits(); |
| + parentStyle->setHasViewportUnits(false); |
|
esprehn
2013/12/04 06:02:28
Why do you need to disable the viewport units flag
Timothy Loh
2013/12/04 07:17:39
This is one of the few places where we resolve vie
|
| + CSSToLengthConversionData conversionData(parentStyle, rootElementStyle, m_document->renderView(), 1.0f, true); |
| + if (primitiveValue->isLength()) |
| + size = primitiveValue->computeLength<float>(conversionData); |
| + else if (primitiveValue->isCalculatedPercentageWithLength()) |
| + size = primitiveValue->cssCalcValue()->toCalcValue(conversionData)->evaluate(parentSize); |
| + else |
| + ASSERT_NOT_REACHED(); |
| + m_fontSizehasViewportUnits = parentStyle->hasViewportUnits(); |
| + parentStyle->setHasViewportUnits(parentHasViewportUnits); |
| + } |
| } |
| if (size < 0) |