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

Unified Diff: third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp

Issue 2656253002: [Typed CSSOM] Support line height in ComputedStylePropertyMap (Closed)
Patch Set: rebase Created 3 years, 11 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 | « third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp
index e0019be282fbd2610412e3f6804ce3289607c0b8..db63c3b95c843f00752ee56a476221c59e294980 100644
--- a/third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp
@@ -8,6 +8,7 @@
#include "core/css/ComputedStyleCSSValueMapping.h"
#include "core/css/cssom/CSSCalcLength.h"
#include "core/css/cssom/CSSKeywordValue.h"
+#include "core/css/cssom/CSSNumberValue.h"
#include "core/css/cssom/CSSSimpleLength.h"
#include "core/css/cssom/CSSUnsupportedStyleValue.h"
#include "core/css/cssom/StyleValueFactory.h"
@@ -105,6 +106,28 @@ CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(
case CSSPropertyWidth:
styleValue = styleValueForLength(style->width());
break;
+ case CSSPropertyLineHeight: {
+ // LineHeight is represented as a Length in ComputedStyle, even though it
+ // can be a number or the "normal" keyword. "normal" is encoded as a
+ // negative percent, and numbers (which must be positive) are encoded as
+ // percents.
meade_UTC10 2017/02/09 06:50:48 WTF... (no action required)
+ Length lineHeight = style->lineHeight();
+ if (lineHeight.isNegative()) {
+ styleValue = CSSKeywordValue::create("normal");
+ break;
+ }
+ if (lineHeight.isPercent()) {
+ styleValue = CSSNumberValue::create(lineHeight.percent());
+ break;
+ }
+ if (lineHeight.isFixed()) {
+ styleValue = CSSSimpleLength::create(
+ lineHeight.pixels(), CSSPrimitiveValue::UnitType::Pixels);
+ break;
+ }
+ NOTREACHED();
+ break;
+ }
default:
// TODO(rjwright): Add a flag argument to
// ComputedStyleCSSValyeMapping::get that makes it return
« no previous file with comments | « third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698