Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h |
| diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h |
| index 8ec12fd0aed84cd488807d87f25c40e63f7f8a7b..aa084da575e30dbf248451cad97ee0f15f36ae89 100644 |
| --- a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h |
| +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h |
| @@ -10,30 +10,40 @@ |
| namespace blink { |
| +// Represents numeric values that can be expressed as a single number plus a |
| +// unit (or a naked number or percentage). |
| +// See CSSUnitValue.idl for more information about this class. |
| class CORE_EXPORT CSSUnitValue final : public CSSNumericValue { |
| WTF_MAKE_NONCOPYABLE(CSSUnitValue); |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - static CSSPrimitiveValue::UnitType UnitFromName(const String& name); |
| + // The constructor defined in the IDL. |
| static CSSUnitValue* Create(double value, |
| const String& unit, |
| ExceptionState&); |
| + // Blink-internal ways of creating CSSUnitValues. |
| static CSSUnitValue* Create(double value, CSSPrimitiveValue::UnitType); |
| static CSSUnitValue* FromCSSValue(const CSSPrimitiveValue&); |
| + // Setters and getters for attributes defined in the IDL. |
| void setValue(double new_value) { value_ = new_value; } |
| double value() const { return value_; } |
| void setUnit(const String& new_unit, ExceptionState&); |
| String unit() const; |
| - |
| - String cssType() const; |
| - |
| - StyleValueType GetType() const override { return StyleValueType::kUnitType; } |
| - |
| + String type() const; |
|
nainar
2017/05/30 08:19:17
This change sounds like it belongs in a separate C
meade_UTC10
2017/06/02 04:43:38
Uploaded https://codereview.chromium.org/292166300
|
| + |
| + // Gets the Typed OM category, e.g. length, angle, etc. |
| + StyleValueType GetType() const override; |
| + bool ContainsPercent() const override { |
| + return unit_ == CSSPrimitiveValue::UnitType::kPercentage; |
| + } |
| + // Gets the representation that can be applied to an inline style. |
| const CSSValue* ToCSSValue() const override; |
| private: |
| + static CSSPrimitiveValue::UnitType UnitFromName(const String& name); |
| + |
| CSSUnitValue(double value, CSSPrimitiveValue::UnitType unit) |
| : CSSNumericValue(), value_(value), unit_(unit) {} |