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

Unified Diff: Source/core/css/CSSPrimitiveValue.cpp

Issue 705783002: Decouple font unit conversion in computeLengthDouble from RenderStyle. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Forgot to remove ASSERT(rootStyle). Created 6 years, 1 month 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/CSSMatrix.cpp ('k') | Source/core/css/CSSToLengthConversionData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index c211d07e816f9f698008c738fe3090f8a4288aa0..ec39fd2273088e77f43fcee323b12473dd8f1847 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -604,33 +604,20 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c
if (m_primitiveUnitType == CSS_CALC)
return m_value.calc->computeLengthPx(conversionData);
- const RenderStyle& style = conversionData.style();
- const RenderStyle* rootStyle = conversionData.rootStyle();
- bool computingFontSize = conversionData.computingFontSize();
-
double factor;
switch (primitiveType()) {
case CSS_EMS:
- factor = computingFontSize ? style.fontDescription().specifiedSize() : style.fontDescription().computedSize();
+ factor = conversionData.emFontSize();
break;
case CSS_EXS:
- // FIXME: We have a bug right now where the zoom will be applied twice to EX units.
- // We really need to compute EX using fontMetrics for the original specifiedSize and not use
- // our actual constructed rendering font.
- if (style.fontMetrics().hasXHeight())
- factor = style.fontMetrics().xHeight();
- else
- factor = (computingFontSize ? style.fontDescription().specifiedSize() : style.fontDescription().computedSize()) / 2.0;
+ factor = conversionData.exFontSize();
break;
case CSS_REMS:
- if (rootStyle)
- factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize();
- else
- factor = 1.0;
+ factor = conversionData.remFontSize();
break;
case CSS_CHS:
- factor = style.fontMetrics().zeroWidth();
+ factor = conversionData.chFontSize();
break;
case CSS_PX:
factor = 1.0;
@@ -675,7 +662,7 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c
// for font sizes is much more complicated, since we have to worry about enforcing the minimum font size preference
// as well as enforcing the implicit "smart minimum."
double result = getDoubleValue() * factor;
- if (computingFontSize || isFontRelativeLength())
+ if (isFontRelativeLength())
return result;
return result * conversionData.zoom();
« no previous file with comments | « Source/core/css/CSSMatrix.cpp ('k') | Source/core/css/CSSToLengthConversionData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698