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

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

Issue 2038363002: Make CSSPropertyParser::parseSingleValue return a const CSSValue* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_remove_const_cast_in_interpolation_type
Patch Set: Rebase Created 4 years, 5 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 SVGParsingError SVGLength::setValueAsString(const String& string) 129 SVGParsingError SVGLength::setValueAsString(const String& string)
130 { 130 {
131 if (string.isEmpty()) { 131 if (string.isEmpty()) {
132 m_value = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::User Units); 132 m_value = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::User Units);
133 return SVGParseStatus::NoError; 133 return SVGParseStatus::NoError;
134 } 134 }
135 135
136 CSSParserContext svgParserContext(SVGAttributeMode, nullptr); 136 CSSParserContext svgParserContext(SVGAttributeMode, nullptr);
137 CSSValue* parsed = CSSParser::parseSingleValue(CSSPropertyX, string, svgPars erContext); 137 const CSSValue* parsed = CSSParser::parseSingleValue(CSSPropertyX, string, s vgParserContext);
138 if (!parsed || !parsed->isPrimitiveValue()) 138 if (!parsed || !parsed->isPrimitiveValue())
139 return SVGParseStatus::ExpectedLength; 139 return SVGParseStatus::ExpectedLength;
140 140
141 CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed); 141 const CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed);
142 // TODO(fs): Enable calc for SVG lengths 142 // TODO(fs): Enable calc for SVG lengths
143 if (newValue->isCalculated() || !isSupportedCSSUnitType(newValue->typeWithCa lcResolved())) 143 if (newValue->isCalculated() || !isSupportedCSSUnitType(newValue->typeWithCa lcResolved()))
144 return SVGParseStatus::ExpectedLength; 144 return SVGParseStatus::ExpectedLength;
145 145
146 m_value = newValue; 146 m_value = newValue;
147 return SVGParseStatus::NoError; 147 return SVGParseStatus::NoError;
148 } 148 }
149 149
150 String SVGLength::valueAsString() const 150 String SVGLength::valueAsString() const
151 { 151 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context Element) 254 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context Element)
255 { 255 {
256 SVGLengthContext lengthContext(contextElement); 256 SVGLengthContext lengthContext(contextElement);
257 SVGLength* toLength = toSVGLength(toValue); 257 SVGLength* toLength = toSVGLength(toValue);
258 258
259 return fabsf(toLength->value(lengthContext) - value(lengthContext)); 259 return fabsf(toLength->value(lengthContext) - value(lengthContext));
260 } 260 }
261 261
262 } // namespace blink 262 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698