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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/SimpleLength.h

Issue 1997503003: Typed CSSOM: Rename LengthValue to CSSLengthValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SimpleLength_h 5 #ifndef SimpleLength_h
6 #define SimpleLength_h 6 #define SimpleLength_h
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/css/cssom/LengthValue.h" 9 #include "core/css/cssom/CSSLengthValue.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class CSSPrimitiveValue; 13 class CSSPrimitiveValue;
14 14
15 class CORE_EXPORT SimpleLength final : public LengthValue { 15 class CORE_EXPORT SimpleLength final : public CSSLengthValue {
16 WTF_MAKE_NONCOPYABLE(SimpleLength); 16 WTF_MAKE_NONCOPYABLE(SimpleLength);
17 DEFINE_WRAPPERTYPEINFO(); 17 DEFINE_WRAPPERTYPEINFO();
18 public: 18 public:
19 static SimpleLength* create(double value, const String& type, ExceptionState & exceptionState) 19 static SimpleLength* create(double value, const String& type, ExceptionState & exceptionState)
20 { 20 {
21 CSSPrimitiveValue::UnitType unit = unitFromName(type); 21 CSSPrimitiveValue::UnitType unit = unitFromName(type);
22 if (!isSupportedLengthUnit(unit)) { 22 if (!isSupportedLengthUnit(unit)) {
23 exceptionState.throwTypeError("Invalid unit for SimpleLength: " + ty pe); 23 exceptionState.throwTypeError("Invalid unit for SimpleLength: " + ty pe);
24 return nullptr; 24 return nullptr;
25 } 25 }
(...skipping 11 matching lines...) Expand all
37 String unit() const { return String(CSSPrimitiveValue::unitTypeToString(m_un it)); } 37 String unit() const { return String(CSSPrimitiveValue::unitTypeToString(m_un it)); }
38 CSSPrimitiveValue::UnitType lengthUnit() const { return m_unit; } 38 CSSPrimitiveValue::UnitType lengthUnit() const { return m_unit; }
39 39
40 void setValue(double value) { m_value = value; } 40 void setValue(double value) { m_value = value; }
41 41
42 StyleValueType type() const override { return StyleValueType::SimpleLengthTy pe; } 42 StyleValueType type() const override { return StyleValueType::SimpleLengthTy pe; }
43 43
44 CSSValue* toCSSValue() const override; 44 CSSValue* toCSSValue() const override;
45 45
46 protected: 46 protected:
47 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); 47 virtual CSSLengthValue* addInternal(const CSSLengthValue* other, ExceptionSt ate&);
48 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&); 48 virtual CSSLengthValue* subtractInternal(const CSSLengthValue* other, Except ionState&);
49 virtual LengthValue* multiplyInternal(double, ExceptionState&); 49 virtual CSSLengthValue* multiplyInternal(double, ExceptionState&);
50 virtual LengthValue* divideInternal(double, ExceptionState&); 50 virtual CSSLengthValue* divideInternal(double, ExceptionState&);
51 51
52 private: 52 private:
53 SimpleLength(double value, CSSPrimitiveValue::UnitType unit) : LengthValue() , m_unit(unit), m_value(value) {} 53 SimpleLength(double value, CSSPrimitiveValue::UnitType unit) : CSSLengthValu e(), m_unit(unit), m_value(value) {}
54 54
55 CSSPrimitiveValue::UnitType m_unit; 55 CSSPrimitiveValue::UnitType m_unit;
56 double m_value; 56 double m_value;
57 }; 57 };
58 58
59 #define DEFINE_SIMPLE_LENGTH_TYPE_CASTS(argumentType) \ 59 #define DEFINE_SIMPLE_LENGTH_TYPE_CASTS(argumentType) \
60 DEFINE_TYPE_CASTS(SimpleLength, argumentType, value, \ 60 DEFINE_TYPE_CASTS(SimpleLength, argumentType, value, \
61 value->type() == LengthValue::StyleValueType::SimpleLengthType, \ 61 value->type() == CSSLengthValue::StyleValueType::SimpleLengthType, \
62 value.type() == LengthValue::StyleValueType::SimpleLengthType) 62 value.type() == CSSLengthValue::StyleValueType::SimpleLengthType)
63 63
64 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(LengthValue); 64 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(CSSLengthValue);
65 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(StyleValue); 65 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(StyleValue);
66 66
67 } // namespace blink 67 } // namespace blink
68 68
69 #endif 69 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698