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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGLength.cpp

Issue 2549563002: Only communicate CSSPrimitiveValue references from SVGLength (Closed)
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 return length; 61 return length;
62 } 62 }
63 63
64 bool SVGLength::operator==(const SVGLength& other) const { 64 bool SVGLength::operator==(const SVGLength& other) const {
65 return m_unitMode == other.m_unitMode && m_value == other.m_value; 65 return m_unitMode == other.m_unitMode && m_value == other.m_value;
66 } 66 }
67 67
68 float SVGLength::value(const SVGLengthContext& context) const { 68 float SVGLength::value(const SVGLengthContext& context) const {
69 if (isCalculated()) 69 if (isCalculated())
70 return context.resolveValue(*asCSSPrimitiveValue(), unitMode()); 70 return context.resolveValue(asCSSPrimitiveValue(), unitMode());
71 71
72 return context.convertValueToUserUnits(m_value->getFloatValue(), unitMode(), 72 return context.convertValueToUserUnits(m_value->getFloatValue(), unitMode(),
73 m_value->typeWithCalcResolved()); 73 m_value->typeWithCalcResolved());
74 } 74 }
75 75
76 void SVGLength::setValueAsNumber(float value) { 76 void SVGLength::setValueAsNumber(float value) {
77 m_value = 77 m_value =
78 CSSPrimitiveValue::create(value, CSSPrimitiveValue::UnitType::UserUnits); 78 CSSPrimitiveValue::create(value, CSSPrimitiveValue::UnitType::UserUnits);
79 } 79 }
80 80
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 float SVGLength::calculateDistance(SVGPropertyBase* toValue, 268 float SVGLength::calculateDistance(SVGPropertyBase* toValue,
269 SVGElement* contextElement) { 269 SVGElement* contextElement) {
270 SVGLengthContext lengthContext(contextElement); 270 SVGLengthContext lengthContext(contextElement);
271 SVGLength* toLength = toSVGLength(toValue); 271 SVGLength* toLength = toSVGLength(toValue);
272 272
273 return fabsf(toLength->value(lengthContext) - value(lengthContext)); 273 return fabsf(toLength->value(lengthContext) - value(lengthContext));
274 } 274 }
275 275
276 } // namespace blink 276 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLength.h ('k') | third_party/WebKit/Source/core/svg/SVGMaskElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698