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

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

Issue 227043007: CSS Length calculation with MediaValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sizes_parser3
Patch Set: Rebase Created 6 years, 8 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
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index 62439ceb280f407e57f881e1ae3a198e2e408767..fcc60f0ae59b2ffbcdd252b2355a64b03f235d77 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -598,33 +598,31 @@ 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 = computingFontSize ? conversionData.fontSpecifiedSize() : conversionData.fontComputedSize();
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();
+ if (conversionData.hasXHeight())
+ factor = conversionData.xHeight();
else
- factor = (computingFontSize ? style.fontDescription().specifiedSize() : style.fontDescription().computedSize()) / 2.0;
+ factor = (computingFontSize ? conversionData.fontSpecifiedSize() : conversionData.fontComputedSize()) / 2.0;
break;
case CSS_REMS:
- if (rootStyle)
- factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize();
+ if (conversionData.hasRoot())
+ factor = computingFontSize ? conversionData.rootFontSpecifiedSize() : conversionData.rootFontComputedSize();
else
factor = 1.0;
break;
case CSS_CHS:
- factor = style.fontMetrics().zeroWidth();
+ factor = conversionData.zeroWidth();
break;
case CSS_PX:
factor = 1.0;
« no previous file with comments | « no previous file | Source/core/css/CSSToLengthConversionData.h » ('j') | Source/core/css/CSSToLengthConversionData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698