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

Side by Side Diff: third_party/WebKit/Source/core/animation/PathSVGInterpolation.cpp

Issue 1416273002: Remove SVGPathElement.pathSegList and related interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/animation/PathSVGInterpolation.h" 6 #include "core/animation/PathSVGInterpolation.h"
7 7
8 #include "core/svg/SVGPathByteStreamBuilder.h" 8 #include "core/svg/SVGPathByteStreamBuilder.h"
9 #include "core/svg/SVGPathByteStreamSource.h" 9 #include "core/svg/SVGPathByteStreamSource.h"
10 #include "core/svg/SVGPathElement.h" 10 #include "core/svg/SVGPathElement.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 PathSegmentData pathSegArcFromInterpolableValue(const InterpolableValue& value, SVGPathSegType segType, SubPathCoordinates& coordinates) 178 PathSegmentData pathSegArcFromInterpolableValue(const InterpolableValue& value, SVGPathSegType segType, SubPathCoordinates& coordinates)
179 { 179 {
180 const InterpolableList& list = toInterpolableList(value); 180 const InterpolableList& list = toInterpolableList(value);
181 bool isAbsolute = isAbsolutePathSegType(segType); 181 bool isAbsolute = isAbsolutePathSegType(segType);
182 PathSegmentData segment; 182 PathSegmentData segment;
183 segment.command = segType; 183 segment.command = segType;
184 segment.targetPoint.setX(specifiedFromInterpolableValue(list.get(0), isAbsol ute, coordinates.currentX)); 184 segment.targetPoint.setX(specifiedFromInterpolableValue(list.get(0), isAbsol ute, coordinates.currentX));
185 segment.targetPoint.setY(specifiedFromInterpolableValue(list.get(1), isAbsol ute, coordinates.currentY)); 185 segment.targetPoint.setY(specifiedFromInterpolableValue(list.get(1), isAbsol ute, coordinates.currentY));
186 segment.point1.setX(toInterpolableNumber(list.get(2))->value()); 186 segment.arcRadii().setX(toInterpolableNumber(list.get(2))->value());
187 segment.point1.setY(toInterpolableNumber(list.get(3))->value()); 187 segment.arcRadii().setY(toInterpolableNumber(list.get(3))->value());
188 segment.point2.setX(toInterpolableNumber(list.get(4))->value()); 188 segment.setArcAngle(toInterpolableNumber(list.get(4))->value());
189 segment.arcLarge = toInterpolableBool(list.get(5))->value(); 189 segment.arcLarge = toInterpolableBool(list.get(5))->value();
190 segment.arcSweep = toInterpolableBool(list.get(6))->value(); 190 segment.arcSweep = toInterpolableBool(list.get(6))->value();
191 return segment; 191 return segment;
192 } 192 }
193 193
194 PassOwnPtr<InterpolableValue> pathSegLinetoHorizontalToInterpolableValue(const P athSegmentData& segment, SubPathCoordinates& coordinates) 194 PassOwnPtr<InterpolableValue> pathSegLinetoHorizontalToInterpolableValue(const P athSegmentData& segment, SubPathCoordinates& coordinates)
195 { 195 {
196 bool isAbsolute = isAbsolutePathSegType(segment.command); 196 bool isAbsolute = isAbsolutePathSegType(segment.command);
197 return specifiedToInterpolableValue(segment.x(), isAbsolute, coordinates.cur rentX); 197 return specifiedToInterpolableValue(segment.x(), isAbsolute, coordinates.cur rentX);
198 } 198 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 pathSource.parseSegment(); 385 pathSource.parseSegment();
386 ++count; 386 ++count;
387 } 387 }
388 return count; 388 return count;
389 } 389 }
390 390
391 } // namespace 391 } // namespace
392 392
393 PassRefPtr<PathSVGInterpolation> PathSVGInterpolation::maybeCreate(SVGPropertyBa se* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) 393 PassRefPtr<PathSVGInterpolation> PathSVGInterpolation::maybeCreate(SVGPropertyBa se* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute)
394 { 394 {
395 ASSERT(start->type() == SVGPathSegList::classType()); 395 ASSERT(start->type() == SVGPath::classType());
396 ASSERT(end->type() == SVGPathSegList::classType()); 396 ASSERT(end->type() == SVGPath::classType());
397 397
398 const SVGPathByteStream& startPath = static_cast<SVGPathSegList*>(start)->by teStream(); 398 const SVGPathByteStream& startPath = static_cast<SVGPath*>(start)->byteStrea m();
399 const SVGPathByteStream& endPath = static_cast<SVGPathSegList*>(end)->byteSt ream(); 399 const SVGPathByteStream& endPath = static_cast<SVGPath*>(end)->byteStream();
400 400
401 if (startPath.size() != endPath.size()) 401 if (startPath.size() != endPath.size())
402 return nullptr; 402 return nullptr;
403 403
404 size_t length = countPathCommands(startPath); 404 size_t length = countPathCommands(startPath);
405 405
406 SVGPathByteStreamSource startPathSource(startPath); 406 SVGPathByteStreamSource startPathSource(startPath);
407 SVGPathByteStreamSource endPathSource(endPath); 407 SVGPathByteStreamSource endPathSource(endPath);
408 408
409 Vector<SVGPathSegType> pathSegTypes(length); 409 Vector<SVGPathSegType> pathSegTypes(length);
(...skipping 14 matching lines...) Expand all
424 endValue->set(i, pathSegToInterpolableValue(endSeg, endCoordinates, &pat hSegTypes.at(i))); 424 endValue->set(i, pathSegToInterpolableValue(endSeg, endCoordinates, &pat hSegTypes.at(i)));
425 425
426 ++i; 426 ++i;
427 } 427 }
428 ASSERT(!endPathSource.hasMoreData()); 428 ASSERT(!endPathSource.hasMoreData());
429 ASSERT(i == length); 429 ASSERT(i == length);
430 430
431 return adoptRef(new PathSVGInterpolation(startValue.release(), endValue.rele ase(), attribute, pathSegTypes)); 431 return adoptRef(new PathSVGInterpolation(startValue.release(), endValue.rele ase(), attribute, pathSegTypes));
432 } 432 }
433 433
434 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::fromInterpolableVa lue(const InterpolableValue& value, const Vector<SVGPathSegType>& pathSegTypes, SVGPathElement* element) 434 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::fromInterpolableVa lue(const InterpolableValue& value, const Vector<SVGPathSegType>& pathSegTypes)
435 { 435 {
436 RefPtrWillBeRawPtr<SVGPathSegList> result = SVGPathSegList::create(element); 436 RefPtrWillBeRawPtr<SVGPath> result = SVGPath::create();
437 result->invalidateList();
438 InterpolatedPathSource source(toInterpolableList(value), pathSegTypes); 437 InterpolatedPathSource source(toInterpolableList(value), pathSegTypes);
439 SVGPathByteStreamBuilder builder(result->mutableByteStream()); 438 SVGPathByteStreamBuilder builder(result->mutableByteStream());
440 SVGPathParser parser(&source, &builder); 439 SVGPathParser parser(&source, &builder);
441 parser.parsePathDataFromSource(UnalteredParsing, false); 440 parser.parsePathDataFromSource(UnalteredParsing, false);
442 return result.release(); 441 return result.release();
443 } 442 }
444 443
445 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::interpolatedValue( SVGElement& element) const 444 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::interpolatedValue( SVGElement&) const
446 { 445 {
447 return fromInterpolableValue(*m_cachedValue, m_pathSegTypes, toSVGPathElemen t(&element)); 446 return fromInterpolableValue(*m_cachedValue, m_pathSegTypes);
448 } 447 }
449 448
450 } 449 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/PathSVGInterpolation.h ('k') | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698