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

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

Issue 2312293003: [CSSTypedOM] Computed StylePropertyMap use ComputedStyle for Lengths (Closed)
Patch Set: rebase Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CSSCalcLength_h 5 #ifndef CSSCalcLength_h
6 #define CSSCalcLength_h 6 #define CSSCalcLength_h
7 7
8 #include "core/css/cssom/CSSLengthValue.h" 8 #include "core/css/cssom/CSSLengthValue.h"
9 #include "wtf/BitVector.h" 9 #include "wtf/BitVector.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class CSSCalcDictionary; 13 class CSSCalcDictionary;
14 class CSSSimpleLength; 14 class CSSSimpleLength;
15 15
16 class CORE_EXPORT CSSCalcLength final : public CSSLengthValue { 16 class CORE_EXPORT CSSCalcLength final : public CSSLengthValue {
17 DEFINE_WRAPPERTYPEINFO(); 17 DEFINE_WRAPPERTYPEINFO();
18 18
19 public: 19 public:
20 static CSSCalcLength* create(const CSSLengthValue*); 20 static CSSCalcLength* create(const CSSLengthValue*);
21 static CSSCalcLength* create(const CSSCalcDictionary&, ExceptionState&); 21 static CSSCalcLength* create(const CSSCalcDictionary&, ExceptionState&);
22 static CSSCalcLength* create(const CSSLengthValue* length, ExceptionState&) { 22 static CSSCalcLength* create(const CSSLengthValue* length, ExceptionState&) {
23 return create(length); 23 return create(length);
24 } 24 }
25 static CSSCalcLength* fromCSSValue(const CSSPrimitiveValue&); 25 static CSSCalcLength* fromCSSValue(const CSSPrimitiveValue&);
26 26
27 static CSSCalcLength* fromLength(const Length&);
28
27 #define GETTER_MACRO(name, type) \ 29 #define GETTER_MACRO(name, type) \
28 double name(bool& isNull) { \ 30 double name(bool& isNull) { \
29 isNull = !hasAtIndex(indexForUnit(type)); \ 31 isNull = !hasAtIndex(indexForUnit(type)); \
30 return get(type); \ 32 return get(type); \
31 } 33 }
32 34
33 GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels) 35 GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels)
34 GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage) 36 GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage)
35 GETTER_MACRO(em, CSSPrimitiveValue::UnitType::Ems) 37 GETTER_MACRO(em, CSSPrimitiveValue::UnitType::Ems)
36 GETTER_MACRO(ex, CSSPrimitiveValue::UnitType::Exs) 38 GETTER_MACRO(ex, CSSPrimitiveValue::UnitType::Exs)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 DEFINE_TYPE_CASTS( \ 105 DEFINE_TYPE_CASTS( \
104 CSSCalcLength, argumentType, value, \ 106 CSSCalcLength, argumentType, value, \
105 value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \ 107 value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \
106 value.type() == CSSLengthValue::StyleValueType::CalcLengthType) 108 value.type() == CSSLengthValue::StyleValueType::CalcLengthType)
107 109
108 DEFINE_CALC_LENGTH_TYPE_CASTS(CSSStyleValue); 110 DEFINE_CALC_LENGTH_TYPE_CASTS(CSSStyleValue);
109 111
110 } // namespace blink 112 } // namespace blink
111 113
112 #endif 114 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698