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

Unified Diff: third_party/WebKit/Source/core/css/cssom/CSSLengthValue.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
Index: third_party/WebKit/Source/core/css/cssom/CSSLengthValue.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSLengthValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSLengthValue.cpp
index 7f08b13aa7464a32d6e698418b3b209bd1cb2aee..cbd38040557d09043d693327e72a6975c761a324 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSLengthValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSLengthValue.cpp
@@ -13,6 +13,21 @@
namespace blink {
+CSSLengthValue* CSSLengthValue::fromCSSValue(const CSSValue& value)
+{
+ if (!value.isPrimitiveValue())
+ return nullptr;
+
+ const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (!primitiveValue.isLength())
+ return nullptr;
+
+ if (!primitiveValue.isCalculated())
+ return CSSSimpleLength::create(primitiveValue.getDoubleValue(), primitiveValue.typeWithCalcResolved());
+
+ return CSSCalcLength::fromCSSValue(value);
+}
+
CSSPrimitiveValue::UnitType CSSLengthValue::unitFromName(const String& name)
{
if (equalIgnoringASCIICase(name, "percent") || name == "%") {
@@ -57,14 +72,14 @@ CSSLengthValue* CSSLengthValue::subtract(const CSSLengthValue* other, ExceptionS
return result->subtract(other, exceptionState);
}
-CSSLengthValue* CSSLengthValue::multiply(double x, ExceptionState& exceptionState)
+CSSLengthValue* CSSLengthValue::multiply(double x, ExceptionState&)
{
- return multiplyInternal(x, exceptionState);
+ return multiplyInternal(x);
}
-CSSLengthValue* CSSLengthValue::divide(double x, ExceptionState& exceptionState)
+CSSLengthValue* CSSLengthValue::divide(double x, ExceptionState&)
{
- return divideInternal(x, exceptionState);
+ return divideInternal(x);
}
CSSLengthValue* CSSLengthValue::addInternal(const CSSLengthValue*, ExceptionState&)
@@ -79,13 +94,13 @@ CSSLengthValue* CSSLengthValue::subtractInternal(const CSSLengthValue*, Exceptio
return nullptr;
}
-CSSLengthValue* CSSLengthValue::multiplyInternal(double, ExceptionState&)
+CSSLengthValue* CSSLengthValue::multiplyInternal(double)
{
NOTREACHED();
return nullptr;
}
-CSSLengthValue* CSSLengthValue::divideInternal(double, ExceptionState&)
+CSSLengthValue* CSSLengthValue::divideInternal(double)
{
NOTREACHED();
return nullptr;
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSLengthValue.h ('k') | third_party/WebKit/Source/core/css/cssom/CSSSimpleLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698