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 #ifndef LengthUnitsChecker_h | 5 #ifndef LengthUnitsChecker_h |
6 #define LengthUnitsChecker_h | 6 #define LengthUnitsChecker_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "core/animation/InterpolationType.h" | 9 #include "core/animation/InterpolationType.h" |
10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 if (m_lengthArray.values[i] != | 43 if (m_lengthArray.values[i] != |
44 lengthUnit(i, environment.state().cssToLengthConversionData())) | 44 lengthUnit(i, environment.state().cssToLengthConversionData())) |
45 return false; | 45 return false; |
46 } | 46 } |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 static double lengthUnit(size_t lengthUnitType, | 50 static double lengthUnit(size_t lengthUnitType, |
51 const CSSToLengthConversionData& conversionData) { | 51 const CSSToLengthConversionData& conversionData) { |
52 return conversionData.zoomedComputedPixels( | 52 return conversionData.zoomedComputedPixels( |
53 1, CSSPrimitiveValue::lengthUnitTypeToUnitType( | 53 1, |
54 static_cast<CSSPrimitiveValue::LengthUnitType>(lengthUnitType))); | 54 CSSPrimitiveValue::lengthUnitTypeToUnitType( |
| 55 static_cast<CSSPrimitiveValue::LengthUnitType>(lengthUnitType))); |
55 } | 56 } |
56 | 57 |
57 private: | 58 private: |
58 LengthUnitsChecker(CSSPrimitiveValue::CSSLengthArray&& lengthArray, | 59 LengthUnitsChecker(CSSPrimitiveValue::CSSLengthArray&& lengthArray, |
59 size_t lastIndex) | 60 size_t lastIndex) |
60 : m_lengthArray(std::move(lengthArray)), m_lastIndex(lastIndex) {} | 61 : m_lengthArray(std::move(lengthArray)), m_lastIndex(lastIndex) {} |
61 | 62 |
62 const CSSLengthArray m_lengthArray; | 63 const CSSLengthArray m_lengthArray; |
63 const size_t m_lastIndex; | 64 const size_t m_lastIndex; |
64 }; | 65 }; |
65 | 66 |
66 } // namespace blink | 67 } // namespace blink |
67 | 68 |
68 #endif // LengthUnitsChecker_h | 69 #endif // LengthUnitsChecker_h |
OLD | NEW |