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

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

Issue 1689573002: CSS Typed OM: asMatrix for TransformComponent with LengthValue types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@asMatrixMethod
Patch Set: Created 4 years, 10 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 LengthValue_h 5 #ifndef LengthValue_h
6 #define LengthValue_h 6 #define LengthValue_h
7 7
8 #include "core/css/cssom/StyleValue.h" 8 #include "core/css/cssom/StyleValue.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class CalcDictionary; 12 class CalcDictionary;
13 class ExceptionState; 13 class ExceptionState;
14 14
15 class CORE_EXPORT LengthValue : public StyleValue { 15 class CORE_EXPORT LengthValue : public StyleValue {
16 WTF_MAKE_NONCOPYABLE(LengthValue); 16 WTF_MAKE_NONCOPYABLE(LengthValue);
17 DEFINE_WRAPPERTYPEINFO(); 17 DEFINE_WRAPPERTYPEINFO();
18 public: 18 public:
19 static CSSPrimitiveValue::UnitType unitFromName(const String& name); 19 static CSSPrimitiveValue::UnitType unitFromName(const String& name);
20 20
21 LengthValue* add(const LengthValue* other, ExceptionState&); 21 LengthValue* add(const LengthValue* other, ExceptionState&);
22 LengthValue* subtract(const LengthValue* other, ExceptionState&); 22 LengthValue* subtract(const LengthValue* other, ExceptionState&);
23 LengthValue* multiply(double, ExceptionState&); 23 LengthValue* multiply(double, ExceptionState&);
24 LengthValue* divide(double, ExceptionState&); 24 LengthValue* divide(double, ExceptionState&);
25 25
26 double computeLengthPx(ExceptionState&) const;
27
26 virtual bool containsPercent() const = 0; 28 virtual bool containsPercent() const = 0;
29 virtual bool isRelative() const = 0;
27 30
28 static LengthValue* parse(const String& cssString, ExceptionState&); 31 static LengthValue* parse(const String& cssString, ExceptionState&);
29 static LengthValue* fromValue(double value, const String& typeStr, Exception State&); 32 static LengthValue* fromValue(double value, const String& typeStr, Exception State&);
30 static LengthValue* fromDictionary(const CalcDictionary&, ExceptionState&); 33 static LengthValue* fromDictionary(const CalcDictionary&, ExceptionState&);
31 34
32 protected: 35 protected:
33 LengthValue() {} 36 LengthValue() {}
34 37
35 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); 38 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&);
36 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&); 39 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&);
37 virtual LengthValue* multiplyInternal(double, ExceptionState&); 40 virtual LengthValue* multiplyInternal(double, ExceptionState&);
38 virtual LengthValue* divideInternal(double, ExceptionState&); 41 virtual LengthValue* divideInternal(double, ExceptionState&);
39 42
40 static bool isSupportedLengthUnit(CSSPrimitiveValue::UnitType unit) 43 static bool isSupportedLengthUnit(CSSPrimitiveValue::UnitType unit)
41 { 44 {
42 return (CSSPrimitiveValue::isLength(unit) || unit == CSSPrimitiveValue:: UnitType::Percentage) 45 return (CSSPrimitiveValue::isLength(unit) || unit == CSSPrimitiveValue:: UnitType::Percentage)
43 && unit != CSSPrimitiveValue::UnitType::QuirkyEms 46 && unit != CSSPrimitiveValue::UnitType::QuirkyEms
44 && unit != CSSPrimitiveValue::UnitType::UserUnits; 47 && unit != CSSPrimitiveValue::UnitType::UserUnits;
45 } 48 }
46 49
47 static const int kNumSupportedUnits = 15; 50 static const int kNumSupportedUnits = 15;
48 }; 51 };
49 52
50 } // namespace blink 53 } // namespace blink
51 54
52 #endif 55 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698