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

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, 7 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 256f86a70f540eb03ead8a4548d95d21dc8bffca..e80bdbfa3c46198e909c2a43a8119f6ab85960f6 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp
@@ -75,24 +75,29 @@ String CSSUnitValue::unit() const {
return CSSPrimitiveValue::UnitTypeToString(unit_);
}
-String CSSUnitValue::cssType() 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 {

Powered by Google App Engine
This is Rietveld 408576698