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

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: actually fix test :) 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
« no previous file with comments | « third_party/WebKit/Source/core/css/PropertyRegistration.cpp ('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/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 1bc0a649f87fa512c378d544cfd6871b4eb3d722..720720ab0454a10f73fd2c94d17d0825a7b532f6 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -1103,7 +1103,22 @@ 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())) {
+ // Instead of the actual zoom, use 1 to avoid potential rounding errors
+ Length length = primitiveValue.convertToLength(state.cssToLengthConversionData().copyWithAdjustedZoom(1));
+ return *CSSPrimitiveValue::create(length, 1);
+ }
+ }
return value;
}
« no previous file with comments | « third_party/WebKit/Source/core/css/PropertyRegistration.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698