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

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

Issue 1602843003: Update StyleValue.cssString() to use existing methods instead of rolling our own. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert TransformValue.html Created 4 years, 11 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/LengthValue.h"
10 10
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 double value() const { return m_value; } 34 double value() const { return m_value; }
35 String unit() const { return LengthValue::lengthTypeToString(m_unit); } 35 String unit() const { return LengthValue::lengthTypeToString(m_unit); }
36 LengthUnit lengthUnit() const { return m_unit; } 36 LengthUnit lengthUnit() const { return m_unit; }
37 37
38 void setValue(double value) { m_value = value; } 38 void setValue(double value) { m_value = value; }
39 39
40 StyleValueType type() const override { return StyleValueType::SimpleLengthTy pe; } 40 StyleValueType type() const override { return StyleValueType::SimpleLengthTy pe; }
41 41
42 String cssString() const override;
43 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override; 42 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const override;
44 43
45 protected: 44 protected:
46 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); 45 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&);
47 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&); 46 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&);
48 virtual LengthValue* multiplyInternal(double, ExceptionState&); 47 virtual LengthValue* multiplyInternal(double, ExceptionState&);
49 virtual LengthValue* divideInternal(double, ExceptionState&); 48 virtual LengthValue* divideInternal(double, ExceptionState&);
50 49
51 private: 50 private:
52 SimpleLength(double value, LengthUnit unit) : LengthValue(), m_unit(unit), m _value(value) {} 51 SimpleLength(double value, LengthUnit unit) : LengthValue(), m_unit(unit), m _value(value) {}
53 52
54 LengthUnit m_unit; 53 LengthUnit m_unit;
55 double m_value; 54 double m_value;
56 }; 55 };
57 56
58 #define DEFINE_SIMPLE_LENGTH_TYPE_CASTS(argumentType) \ 57 #define DEFINE_SIMPLE_LENGTH_TYPE_CASTS(argumentType) \
59 DEFINE_TYPE_CASTS(SimpleLength, argumentType, value, \ 58 DEFINE_TYPE_CASTS(SimpleLength, argumentType, value, \
60 value->type() == LengthValue::StyleValueType::SimpleLengthType, \ 59 value->type() == LengthValue::StyleValueType::SimpleLengthType, \
61 value.type() == LengthValue::StyleValueType::SimpleLengthType) 60 value.type() == LengthValue::StyleValueType::SimpleLengthType)
62 61
63 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(LengthValue); 62 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(LengthValue);
64 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(StyleValue); 63 DEFINE_SIMPLE_LENGTH_TYPE_CASTS(StyleValue);
65 64
66 } // namespace blink 65 } // namespace blink
67 66
68 #endif 67 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/NumberValue.h ('k') | third_party/WebKit/Source/core/css/cssom/SimpleLength.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698