| OLD | NEW |
| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() == SVGPath::classType()); | 395 const SVGPathByteStream& startPath = toSVGPath(start)->pathValue()->byteStre
am(); |
| 396 ASSERT(end->type() == SVGPath::classType()); | 396 const SVGPathByteStream& endPath = toSVGPath(end)->pathValue()->byteStream()
; |
| 397 | |
| 398 const SVGPathByteStream& startPath = static_cast<SVGPath*>(start)->byteStrea
m(); | |
| 399 const SVGPathByteStream& endPath = static_cast<SVGPath*>(end)->byteStream(); | |
| 400 | 397 |
| 401 if (startPath.size() != endPath.size()) | 398 if (startPath.size() != endPath.size()) |
| 402 return nullptr; | 399 return nullptr; |
| 403 | 400 |
| 404 size_t length = countPathCommands(startPath); | 401 size_t length = countPathCommands(startPath); |
| 405 | 402 |
| 406 SVGPathByteStreamSource startPathSource(startPath); | 403 SVGPathByteStreamSource startPathSource(startPath); |
| 407 SVGPathByteStreamSource endPathSource(endPath); | 404 SVGPathByteStreamSource endPathSource(endPath); |
| 408 | 405 |
| 409 Vector<SVGPathSegType> pathSegTypes(length); | 406 Vector<SVGPathSegType> pathSegTypes(length); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 431 return adoptRef(new PathSVGInterpolation(startValue.release(), endValue.rele
ase(), attribute, pathSegTypes)); | 428 return adoptRef(new PathSVGInterpolation(startValue.release(), endValue.rele
ase(), attribute, pathSegTypes)); |
| 432 } | 429 } |
| 433 | 430 |
| 434 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::fromInterpolableVa
lue(const InterpolableValue& value, const Vector<SVGPathSegType>& pathSegTypes) | 431 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::fromInterpolableVa
lue(const InterpolableValue& value, const Vector<SVGPathSegType>& pathSegTypes) |
| 435 { | 432 { |
| 436 OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); | 433 OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); |
| 437 InterpolatedPathSource source(toInterpolableList(value), pathSegTypes); | 434 InterpolatedPathSource source(toInterpolableList(value), pathSegTypes); |
| 438 SVGPathByteStreamBuilder builder(*pathByteStream); | 435 SVGPathByteStreamBuilder builder(*pathByteStream); |
| 439 SVGPathParser parser(&source, &builder); | 436 SVGPathParser parser(&source, &builder); |
| 440 parser.parsePathDataFromSource(UnalteredParsing, false); | 437 parser.parsePathDataFromSource(UnalteredParsing, false); |
| 441 return SVGPath::create(pathByteStream.release()); | 438 return SVGPath::create(CSSPathValue::create(pathByteStream.release())); |
| 442 } | 439 } |
| 443 | 440 |
| 444 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::interpolatedValue(
SVGElement&) const | 441 PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::interpolatedValue(
SVGElement&) const |
| 445 { | 442 { |
| 446 return fromInterpolableValue(*m_cachedValue, m_pathSegTypes); | 443 return fromInterpolableValue(*m_cachedValue, m_pathSegTypes); |
| 447 } | 444 } |
| 448 | 445 |
| 449 } | 446 } |
| OLD | NEW |