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

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

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 years, 8 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/css/CSSCalculationValue.h ('k') | Source/core/css/CSSCanvasValue.h » ('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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "CSSCalculationValue.h" 32 #include "CSSCalculationValue.h"
33 33
34 #include "CSSValueList.h" 34 #include "CSSValueList.h"
35 #include "Length.h" 35 #include "Length.h"
36 #include "StyleResolver.h" 36 #include "StyleResolver.h"
37 #include "WebCoreMemoryInstrumentation.h"
38 37
39 #include <wtf/OwnPtr.h> 38 #include <wtf/OwnPtr.h>
40 #include <wtf/PassOwnPtr.h> 39 #include <wtf/PassOwnPtr.h>
41 #include <wtf/text/StringBuilder.h> 40 #include <wtf/text/StringBuilder.h>
42 41
43 static const int maxExpressionDepth = 100; 42 static const int maxExpressionDepth = 100;
44 43
45 enum ParseState { 44 enum ParseState {
46 OK, 45 OK,
47 TooDeep, 46 TooDeep,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 String CSSCalcValue::customSerializeResolvingVariables(const HashMap<AtomicStrin g, String>& variables) const 101 String CSSCalcValue::customSerializeResolvingVariables(const HashMap<AtomicStrin g, String>& variables) const
103 { 102 {
104 return buildCssText(m_expression->serializeResolvingVariables(variables)); 103 return buildCssText(m_expression->serializeResolvingVariables(variables));
105 } 104 }
106 105
107 bool CSSCalcValue::hasVariableReference() const 106 bool CSSCalcValue::hasVariableReference() const
108 { 107 {
109 return m_expression->hasVariableReference(); 108 return m_expression->hasVariableReference();
110 } 109 }
111 110
112 void CSSCalcValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInf o) const
113 {
114 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
115 }
116
117 double CSSCalcValue::clampToPermittedRange(double value) const 111 double CSSCalcValue::clampToPermittedRange(double value) const
118 { 112 {
119 return m_nonNegative && value < 0 ? 0 : value; 113 return m_nonNegative && value < 0 ? 0 : value;
120 } 114 }
121 115
122 double CSSCalcValue::doubleValue() const 116 double CSSCalcValue::doubleValue() const
123 { 117 {
124 return clampToPermittedRange(m_expression->doubleValue()); 118 return clampToPermittedRange(m_expression->doubleValue());
125 } 119 }
126 120
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 212 }
219 213
220 virtual bool equals(const CSSCalcExpressionNode& other) const 214 virtual bool equals(const CSSCalcExpressionNode& other) const
221 { 215 {
222 if (type() != other.type()) 216 if (type() != other.type())
223 return false; 217 return false;
224 218
225 return compareCSSValuePtr(m_value, static_cast<const CSSCalcPrimitiveVal ue&>(other).m_value); 219 return compareCSSValuePtr(m_value, static_cast<const CSSCalcPrimitiveVal ue&>(other).m_value);
226 } 220 }
227 221
228 virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVE RRIDE
229 {
230 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
231 info.addMember(m_value, "value");
232 }
233
234 virtual Type type() const { return CssCalcPrimitiveValue; } 222 virtual Type type() const { return CssCalcPrimitiveValue; }
235 223
236 private: 224 private:
237 explicit CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger) 225 explicit CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger)
238 : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value ->primitiveType()), isInteger) 226 : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value ->primitiveType()), isInteger)
239 , m_value(value) 227 , m_value(value)
240 { 228 {
241 } 229 }
242 230
243 RefPtr<CSSPrimitiveValue> m_value; 231 RefPtr<CSSPrimitiveValue> m_value;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue()); 304 return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue());
317 } 305 }
318 306
319 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootS tyle, double multiplier, bool computingFontSize) const 307 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootS tyle, double multiplier, bool computingFontSize) const
320 { 308 {
321 const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootS tyle, multiplier, computingFontSize); 309 const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootS tyle, multiplier, computingFontSize);
322 const double rightValue = m_rightSide->computeLengthPx(currentStyle, roo tStyle, multiplier, computingFontSize); 310 const double rightValue = m_rightSide->computeLengthPx(currentStyle, roo tStyle, multiplier, computingFontSize);
323 return evaluate(leftValue, rightValue); 311 return evaluate(leftValue, rightValue);
324 } 312 }
325 313
326 virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVE RRIDE
327 {
328 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
329 info.addMember(m_leftSide, "leftSide");
330 info.addMember(m_rightSide, "rightSide");
331 }
332
333 static String buildCssText(const String& leftExpression, const String& right Expression, CalcOperator op) 314 static String buildCssText(const String& leftExpression, const String& right Expression, CalcOperator op)
334 { 315 {
335 StringBuilder result; 316 StringBuilder result;
336 result.append('('); 317 result.append('(');
337 result.append(leftExpression); 318 result.append(leftExpression);
338 result.append(' '); 319 result.append(' ');
339 result.append(static_cast<char>(op)); 320 result.append(static_cast<char>(op));
340 result.append(' '); 321 result.append(' ');
341 result.append(rightExpression); 322 result.append(rightExpression);
342 result.append(')'); 323 result.append(')');
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 RefPtr<CSSCalcExpressionNode> expression; 525 RefPtr<CSSCalcExpressionNode> expression;
545 526
546 if (equalIgnoringCase(name, "calc(") || equalIgnoringCase(name, "-webkit-cal c(")) 527 if (equalIgnoringCase(name, "calc(") || equalIgnoringCase(name, "-webkit-cal c("))
547 expression = parser.parseCalc(parserValueList); 528 expression = parser.parseCalc(parserValueList);
548 // FIXME calc (http://webkit.org/b/16662) Add parsing for min and max here 529 // FIXME calc (http://webkit.org/b/16662) Add parsing for min and max here
549 530
550 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; 531 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0;
551 } 532 }
552 533
553 } // namespace WebCore 534 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValue.h ('k') | Source/core/css/CSSCanvasValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698