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

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

Issue 1655153002: Rename local limit variable in SVG transform argument parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DeMorganize Created 4 years, 10 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 | « no previous file | no next file » | 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) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 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 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2012. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2012. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 using TransformArguments = Vector<float, kMaxTransformArguments>; 115 using TransformArguments = Vector<float, kMaxTransformArguments>;
116 116
117 template<typename CharType> 117 template<typename CharType>
118 SVGParseStatus parseTransformArgumentsForType( 118 SVGParseStatus parseTransformArgumentsForType(
119 SVGTransformType type, 119 SVGTransformType type,
120 const CharType*& ptr, const CharType* end, 120 const CharType*& ptr, const CharType* end,
121 TransformArguments& arguments) 121 TransformArguments& arguments)
122 { 122 {
123 const size_t required = requiredValuesForType[type]; 123 const size_t required = requiredValuesForType[type];
124 const size_t optional = optionalValuesForType[type]; 124 const size_t optional = optionalValuesForType[type];
125 const size_t maxPossibleParams = required + optional; 125 const size_t requiredWithOptional = required + optional;
126 ASSERT(maxPossibleParams <= kMaxTransformArguments); 126 ASSERT(requiredWithOptional <= kMaxTransformArguments);
127 ASSERT(arguments.isEmpty()); 127 ASSERT(arguments.isEmpty());
128 128
129 bool trailingDelimiter = false; 129 bool trailingDelimiter = false;
130 130
131 while (arguments.size() < maxPossibleParams) { 131 while (arguments.size() < requiredWithOptional) {
132 float argumentValue = 0; 132 float argumentValue = 0;
133 if (!parseNumber(ptr, end, argumentValue, AllowLeadingWhitespace)) 133 if (!parseNumber(ptr, end, argumentValue, AllowLeadingWhitespace))
134 break; 134 break;
135 135
136 arguments.append(argumentValue); 136 arguments.append(argumentValue);
137 trailingDelimiter = false; 137 trailingDelimiter = false;
138 138
139 if (arguments.size() == maxPossibleParams) 139 if (arguments.size() == requiredWithOptional)
140 break; 140 break;
141 141
142 if (skipOptionalSVGSpaces(ptr, end) && *ptr == ',') { 142 if (skipOptionalSVGSpaces(ptr, end) && *ptr == ',') {
143 ++ptr; 143 ++ptr;
144 trailingDelimiter = true; 144 trailingDelimiter = true;
145 } 145 }
146 } 146 }
147 147
148 if (!(arguments.size() == required || arguments.size() == maxPossibleParams) ) 148 if (arguments.size() != required && arguments.size() != requiredWithOptional )
149 return SVGParseStatus::ExpectedNumber; 149 return SVGParseStatus::ExpectedNumber;
150 if (trailingDelimiter) 150 if (trailingDelimiter)
151 return SVGParseStatus::TrailingGarbage; 151 return SVGParseStatus::TrailingGarbage;
152 152
153 return SVGParseStatus::NoError; 153 return SVGParseStatus::NoError;
154 } 154 }
155 155
156 PassRefPtrWillBeRawPtr<SVGTransform> createTransformFromValues(SVGTransformType type, const TransformArguments& arguments) 156 PassRefPtrWillBeRawPtr<SVGTransform> createTransformFromValues(SVGTransformType type, const TransformArguments& arguments)
157 { 157 {
158 RefPtrWillBeRawPtr<SVGTransform> transform = SVGTransform::create(); 158 RefPtrWillBeRawPtr<SVGTransform> transform = SVGTransform::create();
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (at(0)->transformType() == toList->at(0)->transformType()) 398 if (at(0)->transformType() == toList->at(0)->transformType())
399 return -1; 399 return -1;
400 400
401 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances 401 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances
402 // Paced animations assume a notion of distance between the various animatio n values defined by the 'to', 'from', 'by' and 'values' attributes. 402 // Paced animations assume a notion of distance between the various animatio n values defined by the 'to', 'from', 'by' and 'values' attributes.
403 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'. 403 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'.
404 return SVGTransformDistance(at(0), toList->at(0)).distance(); 404 return SVGTransformDistance(at(0), toList->at(0)).distance();
405 } 405 }
406 406
407 } // namespace blink 407 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698