| 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 "core/animation/InterpolationType.h" | 8 #include "core/animation/InterpolationType.h" |
| 9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
| 10 #include "core/css/resolver/StyleResolverState.h" | 10 #include "core/css/resolver/StyleResolverState.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 for (size_t i = 0; i < lengthArray.values.size(); i++) { | 23 for (size_t i = 0; i < lengthArray.values.size(); i++) { |
| 24 if (i == CSSPrimitiveValue::UnitTypePercentage || | 24 if (i == CSSPrimitiveValue::UnitTypePercentage || |
| 25 !lengthArray.typeFlags.get(i)) | 25 !lengthArray.typeFlags.get(i)) |
| 26 continue; | 26 continue; |
| 27 lengthArray.values[i] = lengthUnit(i, state.cssToLengthConversionData()); | 27 lengthArray.values[i] = lengthUnit(i, state.cssToLengthConversionData()); |
| 28 create = true; | 28 create = true; |
| 29 lastIndex = i; | 29 lastIndex = i; |
| 30 } | 30 } |
| 31 if (!create) | 31 if (!create) |
| 32 return nullptr; | 32 return nullptr; |
| 33 return wrapUnique( | 33 return WTF::wrapUnique( |
| 34 new LengthUnitsChecker(std::move(lengthArray), lastIndex)); | 34 new LengthUnitsChecker(std::move(lengthArray), lastIndex)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool isValid(const InterpolationEnvironment& environment, | 37 bool isValid(const InterpolationEnvironment& environment, |
| 38 const InterpolationValue& underlying) const final { | 38 const InterpolationValue& underlying) const final { |
| 39 for (size_t i = 0; i <= m_lastIndex; i++) { | 39 for (size_t i = 0; i <= m_lastIndex; i++) { |
| 40 if (i == CSSPrimitiveValue::UnitTypePercentage || | 40 if (i == CSSPrimitiveValue::UnitTypePercentage || |
| 41 !m_lengthArray.typeFlags.get(i)) | 41 !m_lengthArray.typeFlags.get(i)) |
| 42 continue; | 42 continue; |
| 43 if (m_lengthArray.values[i] != | 43 if (m_lengthArray.values[i] != |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 size_t lastIndex) | 59 size_t lastIndex) |
| 60 : m_lengthArray(std::move(lengthArray)), m_lastIndex(lastIndex) {} | 60 : m_lengthArray(std::move(lengthArray)), m_lastIndex(lastIndex) {} |
| 61 | 61 |
| 62 const CSSLengthArray m_lengthArray; | 62 const CSSLengthArray m_lengthArray; |
| 63 const size_t m_lastIndex; | 63 const size_t m_lastIndex; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| 67 | 67 |
| 68 #endif // LengthUnitsChecker_h | 68 #endif // LengthUnitsChecker_h |
| OLD | NEW |