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

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

Issue 2622403006: Compute initial values for registered custom properties. (Closed)
Patch Set: initialise CSSToLengthConversionData nicer 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/Source/core/css/resolver/StyleBuilderConverter.h ('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 0311e4d2f9438907fe57c8f07dc7d9cd86680c6a..552385189874a4ccf7d6b9cb6d5a2133d853753d 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -1284,30 +1284,46 @@ PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(
return nullptr;
}
-const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue(
- const StyleResolverState& state,
+static const CSSValue& computeRegisteredPropertyValue(
+ const CSSToLengthConversionData& cssToLengthConversionData,
const CSSValue& value) {
// 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));
+ for (const CSSValue* innerValue : toCSSValueList(value)) {
+ newList->append(computeRegisteredPropertyValue(cssToLengthConversionData,
+ *innerValue));
+ }
return *newList;
}
if (value.isPrimitiveValue()) {
const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue.isCalculated() ||
+ if ((primitiveValue.isCalculated() &&
+ (primitiveValue.isCalculatedPercentageWithLength() ||
+ primitiveValue.isLength() || primitiveValue.isPercentage())) ||
CSSPrimitiveValue::isRelativeUnit(
primitiveValue.typeWithCalcResolved())) {
// Instead of the actual zoom, use 1 to avoid potential rounding errors
Length length = primitiveValue.convertToLength(
- state.cssToLengthConversionData().copyWithAdjustedZoom(1));
+ cssToLengthConversionData.copyWithAdjustedZoom(1));
return *CSSPrimitiveValue::create(length, 1);
}
}
return value;
}
+const CSSValue& StyleBuilderConverter::convertRegisteredPropertyInitialValue(
+ const CSSValue& value) {
+ return computeRegisteredPropertyValue(CSSToLengthConversionData(), value);
+}
+
+const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue(
+ const StyleResolverState& state,
+ const CSSValue& value) {
+ return computeRegisteredPropertyValue(state.cssToLengthConversionData(),
+ value);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698