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

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

Issue 1602843003: Update StyleValue.cssString() to use existing methods instead of rolling our own. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert TransformValue.html Created 4 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
Index: third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp b/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
index c08dc9485c1a0803ba69e9ac9c2f3f0a2a254ef7..7b9bc8f165b86bb500cdb2037db8811fd09b0539 100644
--- a/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
@@ -161,6 +161,45 @@ const String& LengthValue::lengthTypeToString(LengthValue::LengthUnit unit)
}
}
+CSSPrimitiveValue::UnitType LengthValue::lengthTypeToPrimitiveType(LengthValue::LengthUnit unit)
+{
+ switch (unit) {
+ case Px:
+ return CSSPrimitiveValue::UnitType::Pixels;
+ case Percent:
+ return CSSPrimitiveValue::UnitType::Percentage;
+ case Em:
+ return CSSPrimitiveValue::UnitType::Ems;
+ case Ex:
+ return CSSPrimitiveValue::UnitType::Exs;
+ case Ch:
+ return CSSPrimitiveValue::UnitType::Chs;
+ case Rem:
+ return CSSPrimitiveValue::UnitType::Rems;
+ case Vw:
+ return CSSPrimitiveValue::UnitType::ViewportWidth;
+ case Vh:
+ return CSSPrimitiveValue::UnitType::ViewportHeight;
+ case Vmin:
+ return CSSPrimitiveValue::UnitType::ViewportMin;
+ case Vmax:
+ return CSSPrimitiveValue::UnitType::ViewportMax;
+ case Cm:
+ return CSSPrimitiveValue::UnitType::Centimeters;
+ case Mm:
+ return CSSPrimitiveValue::UnitType::Millimeters;
+ case In:
+ return CSSPrimitiveValue::UnitType::Inches;
+ case Pc:
+ return CSSPrimitiveValue::UnitType::Picas;
+ case Pt:
+ return CSSPrimitiveValue::UnitType::Points;
+ default:
+ ASSERT_NOT_REACHED();
+ return CSSPrimitiveValue::UnitType::Pixels;
+ }
+}
+
LengthValue* LengthValue::addInternal(const LengthValue*, ExceptionState&)
{
ASSERT_NOT_REACHED();
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/LengthValue.h ('k') | third_party/WebKit/Source/core/css/cssom/NumberValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698