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

Unified Diff: third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 years, 3 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/CSSPrimitiveValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
index eb5a04daf6ae195bc5252f350737f95a68b2d6d7..b4b8771746780ad236f6f6eeff9b3a8948aac843 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
@@ -87,28 +87,6 @@ CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitTypeToUnitCategory(UnitTy
}
}
-bool CSSPrimitiveValue::colorIsDerivedFromElement() const
-{
- int valueID = getValueID();
- switch (valueID) {
- case CSSValueInternalQuirkInherit:
- case CSSValueWebkitLink:
- case CSSValueWebkitActivelink:
- case CSSValueCurrentcolor:
- return true;
- default:
- return false;
- }
-}
-
-CSSPrimitiveValue* CSSPrimitiveValue::createIdentifier(CSSValueID valueID)
-{
- CSSPrimitiveValue* cssValue = cssValuePool().identifierCacheValue(valueID);
- if (!cssValue)
- cssValue = cssValuePool().setIdentifierCacheValue(valueID, new CSSPrimitiveValue(valueID));
- return cssValue;
-}
-
CSSPrimitiveValue* CSSPrimitiveValue::create(double value, UnitType type)
{
// TODO(timloh): This looks wrong.
@@ -186,29 +164,6 @@ CSSPrimitiveValue::UnitType CSSPrimitiveValue::typeWithCalcResolved() const
return UnitType::Unknown;
}
-static const AtomicString& valueName(CSSValueID valueID)
-{
- DCHECK_GE(valueID, 0);
- DCHECK_LT(valueID, numCSSValueKeywords);
-
- if (valueID < 0)
- return nullAtom;
-
- static AtomicString* keywordStrings = new AtomicString[numCSSValueKeywords]; // Leaked intentionally.
- AtomicString& keywordString = keywordStrings[valueID];
- if (keywordString.isNull())
- keywordString = getValueName(valueID);
- return keywordString;
-}
-
-CSSPrimitiveValue::CSSPrimitiveValue(CSSValueID valueID)
- : CSSValue(PrimitiveClass)
-{
- init(UnitType::ValueID);
- // TODO(sashab): Add a DCHECK_NE(valueID, CSSValueInvalid).
- m_value.valueID = valueID;
-}
-
CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type)
: CSSValue(PrimitiveClass)
{
@@ -221,30 +176,6 @@ CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom)
: CSSValue(PrimitiveClass)
{
switch (length.type()) {
- case Auto:
- init(UnitType::ValueID);
- m_value.valueID = CSSValueAuto;
- break;
- case MinContent:
- init(UnitType::ValueID);
- m_value.valueID = CSSValueMinContent;
- break;
- case MaxContent:
- init(UnitType::ValueID);
- m_value.valueID = CSSValueMaxContent;
- break;
- case FillAvailable:
- init(UnitType::ValueID);
- m_value.valueID = CSSValueWebkitFillAvailable;
- break;
- case FitContent:
- init(UnitType::ValueID);
- m_value.valueID = CSSValueFitContent;
- break;
- case ExtendToZoom:
- init(UnitType::ValueID);
- m_value.valueID = CSSValueInternalExtendToZoom;
- break;
case Percent:
init(UnitType::Percentage);
ASSERT(std::isfinite(length.percent()));
@@ -273,6 +204,12 @@ CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom)
m_value.num = 0;
break;
}
+ case Auto:
+ case MinContent:
+ case MaxContent:
+ case FillAvailable:
+ case FitContent:
+ case ExtendToZoom:
case DeviceWidth:
case DeviceHeight:
case MaxSizeNone:
@@ -629,7 +566,6 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type)
case UnitType::ViewportMax:
return "vmax";
case UnitType::Unknown:
- case UnitType::ValueID:
case UnitType::Calc:
case UnitType::CalcPercentageWithNumber:
case UnitType::CalcPercentageWithLength:
@@ -688,9 +624,6 @@ String CSSPrimitiveValue::customCSSText() const
case UnitType::ViewportMax:
text = formatNumber(m_value.num, unitTypeToString(type()));
break;
- case UnitType::ValueID:
- text = valueName(m_value.valueID);
- break;
case UnitType::Calc:
text = m_value.calc->customCSSText();
break;
@@ -746,8 +679,6 @@ bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
case UnitType::ViewportMax:
case UnitType::Fraction:
return m_value.num == other.m_value.num;
- case UnitType::ValueID:
- return m_value.valueID == other.m_value.valueID;
case UnitType::Calc:
return m_value.calc && other.m_value.calc && m_value.calc->equals(*other.m_value.calc);
case UnitType::Chs:
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValue.h ('k') | third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698