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

Unified Diff: Source/core/animation/animatable/AnimatableStrokeDasharrayList.cpp

Issue 975733002: Use Length for the stroke-dasharray property in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test for style-change responsive-ness. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/animatable/AnimatableStrokeDasharrayList.cpp
diff --git a/Source/core/animation/animatable/AnimatableStrokeDasharrayList.cpp b/Source/core/animation/animatable/AnimatableStrokeDasharrayList.cpp
index 360a25ebfd35cb3381f94f6b991bb179e55006cd..1c84a7c38bafae42a066341a28c7841402f67287 100644
--- a/Source/core/animation/animatable/AnimatableStrokeDasharrayList.cpp
+++ b/Source/core/animation/animatable/AnimatableStrokeDasharrayList.cpp
@@ -31,28 +31,22 @@
#include "config.h"
#include "core/animation/animatable/AnimatableStrokeDasharrayList.h"
-#include "core/animation/animatable/AnimatableSVGLength.h"
+#include "core/animation/animatable/AnimatableLength.h"
namespace blink {
-AnimatableStrokeDasharrayList::AnimatableStrokeDasharrayList(PassRefPtrWillBeRawPtr<SVGLengthList> passLengths)
+AnimatableStrokeDasharrayList::AnimatableStrokeDasharrayList(PassRefPtr<SVGDashArray> passLengths, float zoom)
{
- RefPtrWillBeRawPtr<SVGLengthList> lengths = passLengths;
- SVGLengthList::ConstIterator it = lengths->begin();
- SVGLengthList::ConstIterator itEnd = lengths->end();
- for (; it != itEnd; ++it)
- m_values.append(AnimatableSVGLength::create(*it));
+ RefPtr<SVGDashArray> lengths = passLengths;
+ for (const Length& dashLength : lengths->vector())
+ m_values.append(AnimatableLength::create(dashLength, zoom));
}
-PassRefPtrWillBeRawPtr<SVGLengthList> AnimatableStrokeDasharrayList::toSVGLengthList() const
+PassRefPtr<SVGDashArray> AnimatableStrokeDasharrayList::toSVGDashArray(float zoom) const
{
- RefPtrWillBeRawPtr<SVGLengthList> lengths = SVGLengthList::create();
- for (size_t i = 0; i < m_values.size(); ++i) {
- RefPtrWillBeRawPtr<SVGLength> length = toAnimatableSVGLength(m_values[i].get())->toSVGLength()->clone();
- if (length->valueInSpecifiedUnits() < 0)
- length->setValueInSpecifiedUnits(0);
- lengths->append(length);
- }
+ RefPtr<SVGDashArray> lengths = SVGDashArray::create();
+ for (const auto& dashLength : m_values)
+ lengths->append(toAnimatableLength(dashLength.get())->length(zoom, ValueRangeNonNegative));
return lengths.release();
}
@@ -79,7 +73,7 @@ PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableStrokeDasharrayList::interpola
if (from.isEmpty() && to.isEmpty())
return takeConstRef(this);
if (from.isEmpty() || to.isEmpty()) {
- DEFINE_STATIC_REF_WILL_BE_PERSISTENT(AnimatableSVGLength, zeroPixels, (AnimatableSVGLength::create(SVGLength::create())));
+ DEFINE_STATIC_REF_WILL_BE_PERSISTENT(AnimatableLength, zeroPixels, (AnimatableLength::create(Length(Fixed), 1)));
if (from.isEmpty()) {
from.append(zeroPixels);
from.append(zeroPixels);

Powered by Google App Engine
This is Rietveld 408576698