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

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

Issue 2616093003: Make CSSParserContext be garbage collected. (Closed)
Patch Set: fix fuzzer compile Created 3 years, 11 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return result; 133 return result;
134 } 134 }
135 135
136 SVGParsingError SVGLength::setValueAsString(const String& string) { 136 SVGParsingError SVGLength::setValueAsString(const String& string) {
137 if (string.isEmpty()) { 137 if (string.isEmpty()) {
138 m_value = 138 m_value =
139 CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::UserUnits); 139 CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::UserUnits);
140 return SVGParseStatus::NoError; 140 return SVGParseStatus::NoError;
141 } 141 }
142 142
143 CSSParserContext svgParserContext(SVGAttributeMode, nullptr); 143 CSSParserContext* svgParserContext = new CSSParserContext(SVGAttributeMode);
144 const CSSValue* parsed = 144 const CSSValue* parsed =
145 CSSParser::parseSingleValue(CSSPropertyX, string, svgParserContext); 145 CSSParser::parseSingleValue(CSSPropertyX, string, svgParserContext);
146 if (!parsed || !parsed->isPrimitiveValue()) 146 if (!parsed || !parsed->isPrimitiveValue())
147 return SVGParseStatus::ExpectedLength; 147 return SVGParseStatus::ExpectedLength;
148 148
149 const CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed); 149 const CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed);
150 if (!isSupportedCSSUnitType(newValue->typeWithCalcResolved())) 150 if (!isSupportedCSSUnitType(newValue->typeWithCalcResolved()))
151 return SVGParseStatus::ExpectedLength; 151 return SVGParseStatus::ExpectedLength;
152 152
153 m_value = newValue; 153 m_value = newValue;
(...skipping 113 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

Powered by Google App Engine
This is Rietveld 408576698