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

Side by Side Diff: Source/core/css/CSSCalculationValue.h

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « Source/core/css/CSSBorderImageSliceValue.cpp ('k') | Source/core/css/CSSCalculationValue.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 : m_category(category) 94 : m_category(category)
95 , m_isInteger(isInteger) 95 , m_isInteger(isInteger)
96 { 96 {
97 ASSERT(category != CalcOther); 97 ASSERT(category != CalcOther);
98 } 98 }
99 99
100 CalculationCategory m_category; 100 CalculationCategory m_category;
101 bool m_isInteger; 101 bool m_isInteger;
102 }; 102 };
103 103
104 class CORE_EXPORT CSSCalcValue : public CSSValue { 104 class CORE_EXPORT CSSCalcValue : public CSSValueObject {
105 public: 105 public:
106 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(CSSParserValueList*, Valu eRange); 106 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(CSSParserValueList*, Valu eRange);
107 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(PassRefPtrWillBeRawPtr<CS SCalcExpressionNode>, ValueRange = ValueRangeAll); 107 static PassRefPtrWillBeRawPtr<CSSCalcValue> create(PassRefPtrWillBeRawPtr<CS SCalcExpressionNode>, ValueRange = ValueRangeAll);
108 108
109 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa ssRefPtrWillBeRawPtr<CSSPrimitiveValue>, bool isInteger = false); 109 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa ssRefPtrWillBeRawPtr<CSSPrimitiveValue>, bool isInteger = false);
110 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa ssRefPtrWillBeRawPtr<CSSCalcExpressionNode>, PassRefPtrWillBeRawPtr<CSSCalcExpre ssionNode>, CalcOperator); 110 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(Pa ssRefPtrWillBeRawPtr<CSSCalcExpressionNode>, PassRefPtrWillBeRawPtr<CSSCalcExpre ssionNode>, CalcOperator);
111 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(do uble pixels, double percent); 111 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createExpressionNode(do uble pixels, double percent);
112 112
113 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co nversionData) const 113 PassRefPtr<CalculationValue> toCalcValue(const CSSToLengthConversionData& co nversionData) const
114 { 114 {
(...skipping 10 matching lines...) Expand all
125 void accumulateLengthArray(CSSLengthArray& lengthArray, CSSLengthTypeArray& lengthTypeArray, double multiplier) const { m_expression->accumulateLengthArray( lengthArray, lengthTypeArray, multiplier); } 125 void accumulateLengthArray(CSSLengthArray& lengthArray, CSSLengthTypeArray& lengthTypeArray, double multiplier) const { m_expression->accumulateLengthArray( lengthArray, lengthTypeArray, multiplier); }
126 CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); } 126 CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); }
127 127
128 String customCSSText() const; 128 String customCSSText() const;
129 bool equals(const CSSCalcValue&) const; 129 bool equals(const CSSCalcValue&) const;
130 130
131 DECLARE_TRACE_AFTER_DISPATCH(); 131 DECLARE_TRACE_AFTER_DISPATCH();
132 132
133 private: 133 private:
134 CSSCalcValue(PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> expression, Value Range range) 134 CSSCalcValue(PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> expression, Value Range range)
135 : CSSValue(CalculationClass) 135 : CSSValueObject(CalculationClass)
136 , m_expression(expression) 136 , m_expression(expression)
137 , m_nonNegative(range == ValueRangeNonNegative) 137 , m_nonNegative(range == ValueRangeNonNegative)
138 { 138 {
139 } 139 }
140 140
141 double clampToPermittedRange(double) const; 141 double clampToPermittedRange(double) const;
142 142
143 const RefPtrWillBeMember<CSSCalcExpressionNode> m_expression; 143 const RefPtrWillBeMember<CSSCalcExpressionNode> m_expression;
144 const bool m_nonNegative; 144 const bool m_nonNegative;
145 }; 145 };
146 146
147 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue()); 147 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCalcValue, isCalcValue());
148 148
149 } // namespace blink 149 } // namespace blink
150 150
151 151
152 #endif // CSSCalculationValue_h 152 #endif // CSSCalculationValue_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSBorderImageSliceValue.cpp ('k') | Source/core/css/CSSCalculationValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698