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

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

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.h
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
index 7bf785bbd689f718e58784961770994bdfee7007..bcfd1c5afbf3ba8b13a7fa83a930128f810291c3 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
@@ -29,7 +29,6 @@
#include "wtf/BitVector.h"
#include "wtf/Forward.h"
#include "wtf/MathExtras.h"
-#include "wtf/TypeTraits.h"
#include "wtf/text/StringHash.h"
#include "wtf/text/StringView.h"
@@ -59,9 +58,8 @@ template<> inline float roundForImpreciseConversion(double value)
return static_cast<float>(value);
}
-// CSSPrimitiveValues are immutable. This class has manual ref-counting
-// of unioned types and does not have the code necessary
-// to handle any kind of mutations.
+// CSSPrimitiveValue stores numeric data types (e.g. 1, 10px, 4%) and calc()
+// values (e.g. calc(3px + 2em)).
class CORE_EXPORT CSSPrimitiveValue : public CSSValue {
public:
// These units are iterated through, so be careful when adding or changing the order.
@@ -107,7 +105,6 @@ public:
CalcPercentageWithLength,
CalcLengthWithNumber,
CalcPercentageWithLengthAndNumber,
- ValueID,
// This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
// The basic idea is that a stylesheet can use the value __qem (for quirky em) instead of em.
@@ -202,18 +199,16 @@ public:
bool isCalculatedPercentageWithLength() const { return typeWithCalcResolved() == UnitType::CalcPercentageWithLength; }
static bool isResolution(UnitType type) { return type >= UnitType::DotsPerPixel && type <= UnitType::DotsPerCentimeter; }
bool isFlex() const { return typeWithCalcResolved() == UnitType::Fraction; }
- bool isValueID() const { return type() == UnitType::ValueID; }
- bool colorIsDerivedFromElement() const;
- static CSSPrimitiveValue* createIdentifier(CSSValueID);
static CSSPrimitiveValue* create(double value, UnitType);
static CSSPrimitiveValue* create(const Length& value, float zoom)
{
return new CSSPrimitiveValue(value, zoom);
}
+
+ // TODO(sashab): Remove this.
template<typename T> static CSSPrimitiveValue* create(T value)
{
- static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead");
return new CSSPrimitiveValue(value);
}
@@ -237,8 +232,6 @@ public:
CSSCalcValue* cssCalcValue() const { ASSERT(isCalculated()); return m_value.calc; }
- CSSValueID getValueID() const { return type() == UnitType::ValueID ? m_value.valueID : CSSValueInvalid; }
-
template<typename T> inline T convertTo() const; // Defined in CSSPrimitiveValueMappings.h
static const char* unitTypeToString(UnitType);
@@ -263,7 +256,6 @@ public:
static UnitType lengthUnitTypeToUnitType(LengthUnitType);
private:
- CSSPrimitiveValue(CSSValueID);
CSSPrimitiveValue(const Length&, float zoom);
CSSPrimitiveValue(double, UnitType);
@@ -292,7 +284,6 @@ private:
inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitType); }
union {
- CSSValueID valueID;
double num;
// FIXME: oilpan: Should be a member, but no support for members in unions. Just trace the raw ptr for now.
CSSCalcValue* calc;
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSMatrix.cpp ('k') | third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698