| OLD | NEW |
| 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 #include "core/css/cssom/CSSCalcLength.h" | 5 #include "core/css/cssom/CSSCalcLength.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/css/CSSCalculationValue.h" | 8 #include "core/css/CSSCalculationValue.h" |
| 9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
| 10 #include "core/css/cssom/CSSCalcDictionary.h" | 10 #include "core/css/cssom/CSSCalcDictionary.h" |
| 11 #include "core/css/cssom/CSSSimpleLength.h" | 11 #include "core/css/cssom/CSSSimpleLength.h" |
| 12 #include "wtf/Vector.h" | 12 #include "platform/wtf/Vector.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 static CSSPrimitiveValue::UnitType UnitFromIndex(int index) { | 18 static CSSPrimitiveValue::UnitType UnitFromIndex(int index) { |
| 19 DCHECK(index < CSSLengthValue::kNumSupportedUnits); | 19 DCHECK(index < CSSLengthValue::kNumSupportedUnits); |
| 20 int lowest_value = static_cast<int>(CSSPrimitiveValue::UnitType::kPercentage); | 20 int lowest_value = static_cast<int>(CSSPrimitiveValue::UnitType::kPercentage); |
| 21 return static_cast<CSSPrimitiveValue::UnitType>(index + lowest_value); | 21 return static_cast<CSSPrimitiveValue::UnitType>(index + lowest_value); |
| 22 } | 22 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 void CSSCalcLength::UnitData::Divide(double x) { | 295 void CSSCalcLength::UnitData::Divide(double x) { |
| 296 DCHECK_NE(x, 0); | 296 DCHECK_NE(x, 0); |
| 297 for (int i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) { | 297 for (int i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) { |
| 298 if (HasAtIndex(i)) { | 298 if (HasAtIndex(i)) { |
| 299 SetAtIndex(i, GetAtIndex(i) / x); | 299 SetAtIndex(i, GetAtIndex(i) / x); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace blink | 304 } // namespace blink |
| OLD | NEW |