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

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

Issue 2047923002: [WIP] Add support for CSSValue-> CSSLengthValue and CSSTranslation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@supported-types
Patch Set: Created 4 years, 6 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/cssom/StyleValueFactory.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/cssom/StyleValueFactory.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp b/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp
index 8208bbbc55c2c625c2c10bca169d44b36396a2da..3dec97c41801ff859ae5439129a43d7d66c4df24 100644
--- a/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp
@@ -5,7 +5,7 @@
#include "core/css/cssom/StyleValueFactory.h"
#include "core/css/CSSValue.h"
-#include "core/css/cssom/CSSSimpleLength.h"
+#include "core/css/cssom/CSSLengthValue.h"
#include "core/css/cssom/CSSStyleValue.h"
#include "core/css/cssom/TransformValue.h"
@@ -17,8 +17,8 @@ CSSStyleValueVector StyleValueFactory::cssValueToStyleValueVector(CSSPropertyID
if (value.isPrimitiveValue()) {
const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue.isLength() && !primitiveValue.isCalculated()) {
- styleValueVector.append(CSSSimpleLength::create(primitiveValue.getDoubleValue(), primitiveValue.typeWithCalcResolved()));
+ if (primitiveValue.isLength()) {
+ styleValueVector.append(CSSLengthValue::fromCSSValue(value));
return styleValueVector;
}
}
@@ -34,4 +34,13 @@ CSSStyleValueVector StyleValueFactory::cssValueToStyleValueVector(CSSPropertyID
return styleValueVector;
}
+CSSStyleValue* StyleValueFactory::cssValueToSingleStyleValue(CSSPropertyID propertyID, const CSSValue& value)
+{
+ CSSStyleValueVector styleValueVector = StyleValueFactory::cssValueToStyleValueVector(propertyID, value);
+ if (styleValueVector.size() != 1)
+ return nullptr;
+
+ return styleValueVector[0];
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/StyleValueFactory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698