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

Side by Side Diff: Source/core/animation/AnimatableLength.h

Issue 204743002: Oilpan: Move AnimatableValue's hierarchy to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/AnimatableImage.cpp ('k') | Source/core/animation/AnimatableLength.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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 UnitTypeFontXSize, 56 UnitTypeFontXSize,
57 UnitTypeRootFontSize, 57 UnitTypeRootFontSize,
58 UnitTypeViewportWidth, 58 UnitTypeViewportWidth,
59 UnitTypeViewportHeight, 59 UnitTypeViewportHeight,
60 UnitTypeViewportMin, 60 UnitTypeViewportMin,
61 UnitTypeViewportMax, 61 UnitTypeViewportMax,
62 }; 62 };
63 63
64 virtual ~AnimatableLength() { } 64 virtual ~AnimatableLength() { }
65 static bool canCreateFrom(const CSSValue*); 65 static bool canCreateFrom(const CSSValue*);
66 static PassRefPtr<AnimatableLength> create(CSSValue*); 66 static PassRefPtrWillBeRawPtr<AnimatableLength> create(CSSValue*);
67 static PassRefPtr<AnimatableLength> create(double number, NumberUnitType uni tType, CSSPrimitiveValue* cssPrimitiveValue = 0) 67 static PassRefPtrWillBeRawPtr<AnimatableLength> create(double number, Number UnitType unitType, CSSPrimitiveValue* cssPrimitiveValue = 0)
68 { 68 {
69 return adoptRef(new AnimatableLength(number, unitType, cssPrimitiveValue )); 69 return adoptRefWillBeNoop(new AnimatableLength(number, unitType, cssPrim itiveValue));
70 } 70 }
71 static PassRefPtr<AnimatableLength> create(PassRefPtrWillBeRawPtr<CSSCalcExp ressionNode> calcExpression, CSSPrimitiveValue* cssPrimitiveValue = 0) 71 static PassRefPtrWillBeRawPtr<AnimatableLength> create(PassRefPtrWillBeRawPt r<CSSCalcExpressionNode> calcExpression, CSSPrimitiveValue* cssPrimitiveValue = 0)
72 { 72 {
73 return adoptRef(new AnimatableLength(calcExpression, cssPrimitiveValue)) ; 73 return adoptRefWillBeNoop(new AnimatableLength(calcExpression, cssPrimit iveValue));
74 } 74 }
75 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue(NumberRange = AllValues) const; 75 PassRefPtrWillBeRawPtr<CSSValue> toCSSValue(NumberRange = AllValues) const;
76 Length toLength(const CSSToLengthConversionData&, NumberRange = AllValues) c onst; 76 Length toLength(const CSSToLengthConversionData&, NumberRange = AllValues) c onst;
77 77
78 virtual void trace(Visitor*) OVERRIDE;
79
78 protected: 80 protected:
79 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const OVERRIDE; 81 virtual PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const Animatab leValue*, double fraction) const OVERRIDE;
80 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV ERRIDE; 82 virtual PassRefPtrWillBeRawPtr<AnimatableValue> addWith(const AnimatableValu e*) const OVERRIDE;
81 virtual bool usesDefaultInterpolationWith(const AnimatableValue*) const OVER RIDE; 83 virtual bool usesDefaultInterpolationWith(const AnimatableValue*) const OVER RIDE;
82 84
83 private: 85 private:
84 AnimatableLength(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue) 86 AnimatableLength(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue)
85 : m_number(number) 87 : m_number(number)
86 , m_unitType(unitType) 88 , m_unitType(unitType)
87 , m_cachedCSSPrimitiveValue(cssPrimitiveValue) 89 , m_cachedCSSPrimitiveValue(cssPrimitiveValue)
88 { 90 {
89 ASSERT(m_unitType != UnitTypeCalc); 91 ASSERT(m_unitType != UnitTypeCalc);
90 } 92 }
(...skipping 10 matching lines...) Expand all
101 bool isCalc() const 103 bool isCalc() const
102 { 104 {
103 return m_unitType == UnitTypeCalc; 105 return m_unitType == UnitTypeCalc;
104 } 106 }
105 107
106 bool isViewportUnit() const 108 bool isViewportUnit() const
107 { 109 {
108 return m_unitType == UnitTypeViewportWidth || m_unitType == UnitTypeView portHeight || m_unitType == UnitTypeViewportMin || m_unitType == UnitTypeViewpor tMax; 110 return m_unitType == UnitTypeViewportWidth || m_unitType == UnitTypeView portHeight || m_unitType == UnitTypeViewportMin || m_unitType == UnitTypeViewpor tMax;
109 } 111 }
110 112
111 static PassRefPtr<AnimatableLength> create(const AnimatableLength* leftAdden d, const AnimatableLength* rightAddend) 113 static PassRefPtrWillBeRawPtr<AnimatableLength> create(const AnimatableLengt h* leftAddend, const AnimatableLength* rightAddend)
112 { 114 {
113 ASSERT(leftAddend && rightAddend); 115 ASSERT(leftAddend && rightAddend);
114 return create(CSSCalcValue::createExpressionNode(leftAddend->toCSSCalcEx pressionNode(), rightAddend->toCSSCalcExpressionNode(), CalcAdd)); 116 return create(CSSCalcValue::createExpressionNode(leftAddend->toCSSCalcEx pressionNode(), rightAddend->toCSSCalcExpressionNode(), CalcAdd));
115 } 117 }
116 118
117 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(NumberRange) c onst; 119 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(NumberRange) c onst;
118 PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> toCSSCalcExpressionNode() cons t; 120 PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> toCSSCalcExpressionNode() cons t;
119 121
120 PassRefPtr<AnimatableLength> scale(double) const; 122 PassRefPtrWillBeRawPtr<AnimatableLength> scale(double) const;
121 double clampedNumber(NumberRange range) const 123 double clampedNumber(NumberRange range) const
122 { 124 {
123 ASSERT(!isCalc()); 125 ASSERT(!isCalc());
124 return (range == NonNegativeValues && m_number <= 0) ? 0 : m_number; 126 return (range == NonNegativeValues && m_number <= 0) ? 0 : m_number;
125 } 127 }
126 128
127 // Returns true and populates numberType, if primitiveUnit is a primitive le ngth unit. Otherwise, returns false. 129 // Returns true and populates numberType, if primitiveUnit is a primitive le ngth unit. Otherwise, returns false.
128 static bool primitiveUnitToNumberType(unsigned short primitiveUnit, NumberUn itType& numberType); 130 static bool primitiveUnitToNumberType(unsigned short primitiveUnit, NumberUn itType& numberType);
129 131
130 static unsigned short numberTypeToPrimitiveUnit(NumberUnitType numberType); 132 static unsigned short numberTypeToPrimitiveUnit(NumberUnitType numberType);
(...skipping 15 matching lines...) Expand all
146 return length->m_unitType; 148 return length->m_unitType;
147 if (length->isUnitlessZero()) 149 if (length->isUnitlessZero())
148 return m_unitType; 150 return m_unitType;
149 151
150 return UnitTypeCalc; 152 return UnitTypeCalc;
151 } 153 }
152 154
153 double m_number; 155 double m_number;
154 const NumberUnitType m_unitType; 156 const NumberUnitType m_unitType;
155 157
156 RefPtrWillBePersistent<CSSCalcExpressionNode> m_calcExpression; 158 RefPtrWillBeMember<CSSCalcExpressionNode> m_calcExpression;
157 159
158 mutable RefPtrWillBePersistent<CSSPrimitiveValue> m_cachedCSSPrimitiveValue; 160 mutable RefPtrWillBeMember<CSSPrimitiveValue> m_cachedCSSPrimitiveValue;
159 161
160 friend class AnimationAnimatableLengthTest; 162 friend class AnimationAnimatableLengthTest;
161 }; 163 };
162 164
163 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableLength, isLength()); 165 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableLength, isLength());
164 166
165 } // namespace WebCore 167 } // namespace WebCore
166 168
167 #endif // AnimatableLength_h 169 #endif // AnimatableLength_h
OLDNEW
« no previous file with comments | « Source/core/animation/AnimatableImage.cpp ('k') | Source/core/animation/AnimatableLength.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698