Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 LengthValue* multiply(double, ExceptionState&); | 23 LengthValue* multiply(double, ExceptionState&); |
| 24 LengthValue* divide(double, ExceptionState&); | 24 LengthValue* divide(double, ExceptionState&); |
| 25 | 25 |
| 26 virtual bool containsPercent() const = 0; | 26 virtual bool containsPercent() const = 0; |
| 27 | 27 |
| 28 static LengthValue* parse(const String& cssString, ExceptionState&); | 28 static LengthValue* parse(const String& cssString, ExceptionState&); |
| 29 static LengthValue* fromValue(double value, const String& typeStr, Exception State&); | 29 static LengthValue* fromValue(double value, const String& typeStr, Exception State&); |
| 30 static LengthValue* fromDictionary(const CalcDictionary&, ExceptionState&); | 30 static LengthValue* fromDictionary(const CalcDictionary&, ExceptionState&); |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 static const int kNumSupportedUnits = 15; | |
|
Timothy Loh
2016/03/23 03:45:09
Unrelated, leave this out of the patch.
meade_UTC10
2016/03/29 06:27:37
I don't remember what I was doing here :o removed
| |
| 34 | |
| 33 LengthValue() {} | 35 LengthValue() {} |
| 34 | 36 |
| 35 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); | 37 virtual LengthValue* addInternal(const LengthValue* other, ExceptionState&); |
| 36 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&); | 38 virtual LengthValue* subtractInternal(const LengthValue* other, ExceptionSta te&); |
| 37 virtual LengthValue* multiplyInternal(double, ExceptionState&); | 39 virtual LengthValue* multiplyInternal(double, ExceptionState&); |
| 38 virtual LengthValue* divideInternal(double, ExceptionState&); | 40 virtual LengthValue* divideInternal(double, ExceptionState&); |
| 39 | 41 |
| 40 static bool isSupportedLengthUnit(CSSPrimitiveValue::UnitType unit) | 42 static bool isSupportedLengthUnit(CSSPrimitiveValue::UnitType unit) |
| 41 { | 43 { |
| 42 return (CSSPrimitiveValue::isLength(unit) || unit == CSSPrimitiveValue:: UnitType::Percentage) | 44 return (CSSPrimitiveValue::isLength(unit) || unit == CSSPrimitiveValue:: UnitType::Percentage) |
| 43 && unit != CSSPrimitiveValue::UnitType::QuirkyEms | 45 && unit != CSSPrimitiveValue::UnitType::QuirkyEms |
| 44 && unit != CSSPrimitiveValue::UnitType::UserUnits; | 46 && unit != CSSPrimitiveValue::UnitType::UserUnits; |
| 45 } | 47 } |
| 46 | |
| 47 static const int kNumSupportedUnits = 15; | |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 DEFINE_TYPE_CASTS(LengthValue, StyleValue, value, | 50 DEFINE_TYPE_CASTS(LengthValue, StyleValue, value, |
| 51 (value->type() == StyleValue::SimpleLengthType | 51 (value->type() == StyleValue::SimpleLengthType |
| 52 || value->type() == StyleValue::CalcLengthType), | 52 || value->type() == StyleValue::CalcLengthType), |
| 53 (value.type() == StyleValue::SimpleLengthType | 53 (value.type() == StyleValue::SimpleLengthType |
| 54 || value.type() == StyleValue::CalcLengthType)); | 54 || value.type() == StyleValue::CalcLengthType)); |
| 55 | 55 |
| 56 } // namespace blink | 56 } // namespace blink |
| 57 | 57 |
| 58 #endif | 58 #endif |
| OLD | NEW |