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

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

Issue 2903413002: Restructure type tracking in StyleValues to work better with new numeric types (Closed)
Patch Set: rebase Created 3 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/CSSUnitValue.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp
index 4d505803286a671f998cb7fdd900345747bbf109..e80bdbfa3c46198e909c2a43a8119f6ab85960f6 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp
@@ -76,23 +76,28 @@ String CSSUnitValue::unit() const {
}
String CSSUnitValue::type() const {
+ return StyleValueTypeToString(GetType());
+}
+
+CSSStyleValue::StyleValueType CSSUnitValue::GetType() const {
if (unit_ == CSSPrimitiveValue::UnitType::kNumber)
- return "number";
+ return StyleValueType::kNumberType;
if (unit_ == CSSPrimitiveValue::UnitType::kPercentage)
- return "percent";
+ return StyleValueType::kPercentType;
if (CSSPrimitiveValue::IsLength(unit_))
- return "length";
+ return StyleValueType::kLengthType;
if (CSSPrimitiveValue::IsAngle(unit_))
- return "angle";
+ return StyleValueType::kAngleType;
if (CSSPrimitiveValue::IsTime(unit_))
- return "time";
+ return StyleValueType::kTimeType;
if (CSSPrimitiveValue::IsFrequency(unit_))
- return "frequency";
+ return StyleValueType::kFrequencyType;
if (CSSPrimitiveValue::IsResolution(unit_))
- return "resolution";
+ return StyleValueType::kResolutionType;
if (CSSPrimitiveValue::IsFlex(unit_))
- return "flex";
- return "";
+ return StyleValueType::kFlexType;
+ NOTREACHED();
+ return StyleValueType::kUnknownType;
}
const CSSValue* CSSUnitValue::ToCSSValue() const {
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h ('k') | third_party/WebKit/Source/core/css/cssom/CSSUnitValue.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698