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

Side by Side Diff: Source/core/animation/LengthBoxStyleInterpolation.cpp

Issue 796303003: Oilpan: fix build after r186996. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | Source/core/animation/LengthBoxStyleInterpolationTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/animation/LengthBoxStyleInterpolation.h" 6 #include "core/animation/LengthBoxStyleInterpolation.h"
7 7
8 #include "core/animation/LengthStyleInterpolation.h" 8 #include "core/animation/LengthStyleInterpolation.h"
9 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/Rect.h" 10 #include "core/css/Rect.h"
11 #include "core/css/resolver/StyleBuilder.h" 11 #include "core/css/resolver/StyleBuilder.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 bool LengthBoxStyleInterpolation::canCreateFrom(const CSSValue& value) 15 bool LengthBoxStyleInterpolation::canCreateFrom(const CSSValue& value)
16 { 16 {
17 return value.isPrimitiveValue() && toCSSPrimitiveValue(value).isRect(); 17 return value.isPrimitiveValue() && toCSSPrimitiveValue(value).isRect();
18 } 18 }
19 19
20 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBox toInterpolableValue(const CSSValue& lengthBox) 20 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBox toInterpolableValue(const CSSValue& lengthBox)
21 { 21 {
22 const int numberOfSides = 4; 22 const int numberOfSides = 4;
23 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(numbe rOfSides); 23 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(numbe rOfSides);
24 Rect* rect = toCSSPrimitiveValue(lengthBox).getRectValue(); 24 Rect* rect = toCSSPrimitiveValue(lengthBox).getRectValue();
25 CSSPrimitiveValue* side[numberOfSides] = { rect->left(), rect->right(), rect ->top(), rect->bottom() }; 25 CSSPrimitiveValue* side[numberOfSides] = { rect->left(), rect->right(), rect ->top(), rect->bottom() };
26 26
27 for (size_t i = 0; i < numberOfSides; i ++) { 27 for (size_t i = 0; i < numberOfSides; i++) {
28 result->set(i, LengthStyleInterpolation::lengthToInterpolableValue(*side [i])); 28 result->set(i, LengthStyleInterpolation::lengthToInterpolableValue(*side [i]));
29 } 29 }
30 return result.release(); 30 return result.release();
31 } 31 }
32 32
33 static inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toPrimitiveValue(PassRef PtrWillBeRawPtr<CSSValue> value) 33 static inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toPrimitiveValue(PassRef PtrWillBeRawPtr<CSSValue> value)
34 { 34 {
35 return adoptRef(toCSSPrimitiveValue(value.leakRef())); 35 return adoptRefWillBeNoop(toCSSPrimitiveValue(value.leakRef()));
36 } 36 }
37 37
38 PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueT oLengthBox(InterpolableValue* value) 38 PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueT oLengthBox(InterpolableValue* value)
39 { 39 {
40 InterpolableList* lengthBox = toInterpolableList(value); 40 InterpolableList* lengthBox = toInterpolableList(value);
41 RefPtr<Rect> result = Rect::create(); 41 RefPtrWillBeRawPtr<Rect> result = Rect::create();
42 42
43 result->setLeft(toPrimitiveValue(LengthStyleInterpolation::interpolableValue ToLength(lengthBox->get(0), ValueRangeNonNegative))); 43 result->setLeft(toPrimitiveValue(LengthStyleInterpolation::interpolableValue ToLength(lengthBox->get(0), ValueRangeNonNegative)));
44 result->setRight(toPrimitiveValue(LengthStyleInterpolation::interpolableValu eToLength(lengthBox->get(1), ValueRangeNonNegative))); 44 result->setRight(toPrimitiveValue(LengthStyleInterpolation::interpolableValu eToLength(lengthBox->get(1), ValueRangeNonNegative)));
45 result->setTop(toPrimitiveValue(LengthStyleInterpolation::interpolableValueT oLength(lengthBox->get(2), ValueRangeNonNegative))); 45 result->setTop(toPrimitiveValue(LengthStyleInterpolation::interpolableValueT oLength(lengthBox->get(2), ValueRangeNonNegative)));
46 result->setBottom(toPrimitiveValue(LengthStyleInterpolation::interpolableVal ueToLength(lengthBox->get(3), ValueRangeNonNegative))); 46 result->setBottom(toPrimitiveValue(LengthStyleInterpolation::interpolableVal ueToLength(lengthBox->get(3), ValueRangeNonNegative)));
47 47
48 return CSSPrimitiveValue::create(result.release()); 48 return CSSPrimitiveValue::create(result.release());
49 } 49 }
50 50
51 void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const 51 void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const
52 { 52 {
53 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_cach edValue.get()).get()); 53 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_cach edValue.get()).get());
54 } 54 }
55 55
56 void LengthBoxStyleInterpolation::trace(Visitor* visitor) 56 void LengthBoxStyleInterpolation::trace(Visitor* visitor)
57 { 57 {
58 StyleInterpolation::trace(visitor); 58 StyleInterpolation::trace(visitor);
59 } 59 }
60 60
61 } 61 }
62
63
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/LengthBoxStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698