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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2354463002: CSS Properties and Values API: Implement computation / computational independence (Closed)
Patch Set: (no change) Created 4 years, 3 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: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
index 6554f5908b571b2cadb0c52663a6502f429ae6a0..a6d75282047171e98676bf81232c4a4fed737f7b 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -1103,7 +1103,21 @@ PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat
const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue(const StyleResolverState& state, const CSSValue& value)
{
- // TODO(timloh): Resolve ems, etc.
+ // TODO(timloh): Images and transform-function values can also contain lengths.
+ if (value.isValueList()) {
+ CSSValueList* newList = CSSValueList::createSpaceSeparated();
+ for (const CSSValue* innerValue : toCSSValueList(value))
+ newList->append(convertRegisteredPropertyValue(state, *innerValue));
+ return *newList;
+ }
+
+ if (value.isPrimitiveValue()) {
+ const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (primitiveValue.isCalculated() || CSSPrimitiveValue::isRelativeUnit(primitiveValue.typeWithCalcResolved())) {
+ Length length = primitiveValue.convertToLength(state.cssToLengthConversionData().copyWithAdjustedZoom(1));
sashab 2016/09/19 23:25:03 Why not use state.style.zoom()?
alancutter (OOO until 2018) 2016/09/20 00:15:55 Or avoid the copy and just use style.effectiveZoom
Timothy Loh 2016/09/21 01:12:04 I figured it'd be nicer to not have any chance of
+ return *CSSPrimitiveValue::create(length, 1);
+ }
+ }
alancutter (OOO until 2018) 2016/09/20 00:39:44 Do we have tests for this code?
Timothy Loh 2016/09/21 01:12:05 Uhh... I'll go add some :)
return value;
}

Powered by Google App Engine
This is Rietveld 408576698