Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: Source/core/css/resolver/FontBuilder.cpp

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rename browser zoom to page zoom Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/FontBuilder.h ('k') | Source/core/css/resolver/MatchedPropertiesCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/FontBuilder.cpp
diff --git a/Source/core/css/resolver/FontBuilder.cpp b/Source/core/css/resolver/FontBuilder.cpp
index 57eba497510f7b2d2b708bc7b51fbb42f9886f3e..b165a53d3b656c14e286899b8f078cb97f543d1f 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);
+ 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)
« no previous file with comments | « Source/core/css/resolver/FontBuilder.h ('k') | Source/core/css/resolver/MatchedPropertiesCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698