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

Side by Side Diff: third_party/WebKit/Source/core/animation/LengthUnitsChecker.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 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"
11 #include "wtf/PtrUtil.h"
12 #include <memory>
11 13
12 namespace blink { 14 namespace blink {
13 15
14 class LengthUnitsChecker : public InterpolationType::ConversionChecker { 16 class LengthUnitsChecker : public InterpolationType::ConversionChecker {
15 public: 17 public:
16 static PassOwnPtr<LengthUnitsChecker> maybeCreate(CSSLengthArray&& lengthArr ay, const StyleResolverState& state) 18 static std::unique_ptr<LengthUnitsChecker> maybeCreate(CSSLengthArray&& leng thArray, const StyleResolverState& state)
17 { 19 {
18 bool create = false; 20 bool create = false;
19 size_t lastIndex = 0; 21 size_t lastIndex = 0;
20 for (size_t i = 0; i < lengthArray.values.size(); i++) { 22 for (size_t i = 0; i < lengthArray.values.size(); i++) {
21 if (i == CSSPrimitiveValue::UnitTypePercentage || !lengthArray.typeF lags.get(i)) 23 if (i == CSSPrimitiveValue::UnitTypePercentage || !lengthArray.typeF lags.get(i))
22 continue; 24 continue;
23 lengthArray.values[i] = lengthUnit(i, state.cssToLengthConversionDat a()); 25 lengthArray.values[i] = lengthUnit(i, state.cssToLengthConversionDat a());
24 create = true; 26 create = true;
25 lastIndex = i; 27 lastIndex = i;
26 } 28 }
27 if (!create) 29 if (!create)
28 return nullptr; 30 return nullptr;
29 return adoptPtr(new LengthUnitsChecker(std::move(lengthArray), lastIndex )); 31 return wrapUnique(new LengthUnitsChecker(std::move(lengthArray), lastInd ex));
30 } 32 }
31 33
32 bool isValid(const InterpolationEnvironment& environment, const Interpolatio nValue& underlying) const final 34 bool isValid(const InterpolationEnvironment& environment, const Interpolatio nValue& underlying) const final
33 { 35 {
34 for (size_t i = 0; i <= m_lastIndex; i++) { 36 for (size_t i = 0; i <= m_lastIndex; i++) {
35 if (i == CSSPrimitiveValue::UnitTypePercentage || !m_lengthArray.typ eFlags.get(i)) 37 if (i == CSSPrimitiveValue::UnitTypePercentage || !m_lengthArray.typ eFlags.get(i))
36 continue; 38 continue;
37 if (m_lengthArray.values[i] != lengthUnit(i, environment.state().css ToLengthConversionData())) 39 if (m_lengthArray.values[i] != lengthUnit(i, environment.state().css ToLengthConversionData()))
38 return false; 40 return false;
39 } 41 }
(...skipping 11 matching lines...) Expand all
51 , m_lastIndex(lastIndex) 53 , m_lastIndex(lastIndex)
52 { } 54 { }
53 55
54 const CSSLengthArray m_lengthArray; 56 const CSSLengthArray m_lengthArray;
55 const size_t m_lastIndex; 57 const size_t m_lastIndex;
56 }; 58 };
57 59
58 } // namespace blink 60 } // namespace blink
59 61
60 #endif // LengthUnitsChecker_h 62 #endif // LengthUnitsChecker_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698