Diff
Modified: trunk/LayoutTests/ChangeLog (134735 => 134736)
--- trunk/LayoutTests/ChangeLog 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/LayoutTests/ChangeLog 2012-11-15 05:33:41 UTC (rev 134736)
@@ -1,3 +1,21 @@
+2012-11-14 Dirk Schulze <k...@webkit.org>
+
+ Support animation of basic shape 'polygon'
+ https://bugs.webkit.org/show_bug.cgi?id=102080
+
+ Reviewed by Daniel Bates.
+
+ Added animation test for basic shape 'polygon' to existing test
+ css3/masking/clip-path-animation.html and
+ fast/exclusions/shape-inside/shape-inside-animation.html.
+
+ * animations/resources/animation-test-helpers.js:
+ (parseBasicShape):
+ * css3/masking/clip-path-animation-expected.txt:
+ * css3/masking/clip-path-animation.html:
+ * fast/exclusions/shape-inside/shape-inside-animation-expected.txt:
+ * fast/exclusions/shape-inside/shape-inside-animation.html:
+
2012-11-14 Shinya Kawanaka <shin...@chromium.org>
Changing pseudoClass (:checked) should cause distribution.
Modified: trunk/LayoutTests/animations/resources/animation-test-helpers.js (134735 => 134736)
--- trunk/LayoutTests/animations/resources/animation-test-helpers.js 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/LayoutTests/animations/resources/animation-test-helpers.js 2012-11-15 05:33:41 UTC (rev 134736)
@@ -76,6 +76,9 @@
case "ellipse":
matches = s.match("ellipse\\((.*)\\s*,\\s*(.*)\\s*,\\s*(.*)\\,\\s*(.*)\\)");
break;
+ case "polygon":
+ matches = s.match("polygon\\(nonzero, (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");
+ break;
default:
return null;
}
Modified: trunk/LayoutTests/css3/masking/clip-path-animation-expected.txt (134735 => 134736)
--- trunk/LayoutTests/css3/masking/clip-path-animation-expected.txt 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/LayoutTests/css3/masking/clip-path-animation-expected.txt 2012-11-15 05:33:41 UTC (rev 134736)
@@ -1,5 +1,6 @@
-
+
PASS - "webkitClipPath" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%)
PASS - "webkitClipPath" property for "circle-box" element at 1s saw something close to: circle(35%, 35%, 35%)
PASS - "webkitClipPath" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%)
+PASS - "webkitClipPath" property for "polygon-box" element at 1s saw something close to: polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)
Modified: trunk/LayoutTests/css3/masking/clip-path-animation.html (134735 => 134736)
--- trunk/LayoutTests/css3/masking/clip-path-animation.html 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/LayoutTests/css3/masking/clip-path-animation.html 2012-11-15 05:33:41 UTC (rev 134736)
@@ -23,7 +23,11 @@
-webkit-animation: ellipse-anim 2s linear
}
+ #polygon-box {
+ -webkit-animation: polygon-anim 2s linear
+ }
+
@-webkit-keyframes rectangle-anim {
from { -webkit-clip-path: rectangle(0%, 0%, 100%, 100%); }
to { -webkit-clip-path: rectangle(20%, 20%, 60%, 60%); }
@@ -39,14 +43,20 @@
to { -webkit-clip-path: ellipse(20%, 20%, 20%, 20%); }
}
+ @-webkit-keyframes polygon-anim {
+ from { -webkit-clip-path: polygon(nonzero, 0% 0%, 100% 0%, 100% 100%, 0% 100%); }
+ to { -webkit-clip-path: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%); }
+ }
+
</style>
<script src=""
<script type="text/_javascript_">
const expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
- ["rectangle-anim", 1, "rectangle-box", "webkitClipPath", 'rectangle(10%, 10%, 80%, 80%)', 0.05],
- ["circle-anim", 1, "circle-box", "webkitClipPath", 'circle(35%, 35%, 35%)', 0.05],
- ["ellipse-anim", 1, "ellipse-box", "webkitClipPath", 'ellipse(35%, 35%, 35%, 30%)', 0.05],
+ ["rectangle-anim", 1, "rectangle-box", "webkitClipPath", "rectangle(10%, 10%, 80%, 80%)", 0.05],
+ ["circle-anim", 1, "circle-box", "webkitClipPath", "circle(35%, 35%, 35%)", 0.05],
+ ["ellipse-anim", 1, "ellipse-box", "webkitClipPath", "ellipse(35%, 35%, 35%, 30%)", 0.05],
+ ["polygon-anim", 1, "polygon-box", "webkitClipPath", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05],
];
runAnimationTest(expectedValues);
@@ -57,6 +67,7 @@
<div class="box" id="rectangle-box"></div>
<div class="box" id="circle-box"></div>
<div class="box" id="ellipse-box"></div>
+<div class="box" id="polygon-box"></div>
<div id="result">
</div>
Modified: trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt (134735 => 134736)
--- trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt 2012-11-15 05:33:41 UTC (rev 134736)
@@ -1,5 +1,6 @@
-Moving Text Moving Text Moving Text
+Moving Text Moving Text Moving Text Moving Text
PASS - "webkitShapeInside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%)
PASS - "webkitShapeInside" property for "circle-box" element at 1s saw something close to: circle(35%, 35%, 35%)
PASS - "webkitShapeInside" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%)
+PASS - "webkitShapeInside" property for "polygon-box" element at 1s saw something close to: polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)
Modified: trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html (134735 => 134736)
--- trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html 2012-11-15 05:33:41 UTC (rev 134736)
@@ -26,7 +26,11 @@
-webkit-animation: ellipse-anim 2s linear
}
+ #polygon-box {
+ -webkit-animation: polygon-anim 2s linear
+ }
+
@-webkit-keyframes rectangle-anim {
from { -webkit-shape-inside: rectangle(0%, 0%, 100%, 100%); }
to { -webkit-shape-inside: rectangle(20%, 20%, 60%, 60%); }
@@ -42,14 +46,20 @@
to { -webkit-shape-inside: ellipse(20%, 20%, 20%, 20%); }
}
+ @-webkit-keyframes polygon-anim {
+ from { -webkit-shape-inside: polygon(nonzero, 0% 0%, 100% 0%, 100% 100%, 0% 100%); }
+ to { -webkit-shape-inside: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%); }
+ }
+
</style>
<script src=""
<script type="text/_javascript_">
const expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
- ["rectangle-anim", 1, "rectangle-box", "webkitShapeInside", 'rectangle(10%, 10%, 80%, 80%)', 0.05],
- ["circle-anim", 1, "circle-box", "webkitShapeInside", 'circle(35%, 35%, 35%)', 0.05],
- ["ellipse-anim", 1, "ellipse-box", "webkitShapeInside", 'ellipse(35%, 35%, 35%, 30%)', 0.05],
+ ["rectangle-anim", 1, "rectangle-box", "webkitShapeInside", "rectangle(10%, 10%, 80%, 80%)", 0.05],
+ ["circle-anim", 1, "circle-box", "webkitShapeInside", "circle(35%, 35%, 35%)", 0.05],
+ ["ellipse-anim", 1, "ellipse-box", "webkitShapeInside", "ellipse(35%, 35%, 35%, 30%)", 0.05],
+ ["polygon-anim", 1, "polygon-box", "webkitShapeInside", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05],
];
runAnimationTest(expectedValues);
@@ -60,6 +70,7 @@
<div class="box" id="rectangle-box">Moving Text</div>
<div class="box" id="circle-box">Moving Text</div>
<div class="box" id="ellipse-box">Moving Text</div>
+<div class="box" id="polygon-box">Moving Text</div>
<div id="result">
</div>
Modified: trunk/Source/WebCore/ChangeLog (134735 => 134736)
--- trunk/Source/WebCore/ChangeLog 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/Source/WebCore/ChangeLog 2012-11-15 05:33:41 UTC (rev 134736)
@@ -1,3 +1,24 @@
+2012-11-14 Dirk Schulze <k...@webkit.org>
+
+ Support animation of basic shape 'polygon'
+ https://bugs.webkit.org/show_bug.cgi?id=102080
+
+ Reviewed by Daniel Bates.
+
+ The basic shapes 'circle', 'rectangle' and 'ellipse' are animatable with the committed
+ patch http://trac.webkit.org/changeset/134352.
+ This is a follow-up patch to make 'polygon' animatable as well, as long as the number
+ of vertices between start and end polygon is the same.
+
+ Added polygon animation test to existing test:
+ fast/exclusions/shape-inside/shape-inside-animation.html
+ css3/masking/clip-path-animation.html
+
+ * page/animation/CSSPropertyAnimation.cpp: Forgot to add copyright with last commits.
+ * rendering/style/BasicShapes.cpp:
+ (WebCore::BasicShape::canBlend): Polygons are allowed now.
+ (WebCore::BasicShapePolygon::blend): Interpolate polygon shapes.
+
2012-11-14 Kentaro Hara <hara...@chromium.org>
Unreviewed. Fix code generator warnings.
Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (134735 => 134736)
--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp 2012-11-15 05:33:41 UTC (rev 134736)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Modified: trunk/Source/WebCore/rendering/style/BasicShapes.cpp (134735 => 134736)
--- trunk/Source/WebCore/rendering/style/BasicShapes.cpp 2012-11-15 05:27:08 UTC (rev 134735)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.cpp 2012-11-15 05:33:41 UTC (rev 134736)
@@ -32,7 +32,6 @@
#include "BasicShapes.h"
#include "FloatRect.h"
#include "LengthFunctions.h"
-#include "NotImplemented.h"
#include "Path.h"
namespace WebCore {
@@ -43,8 +42,9 @@
if (type() != other->type())
return false;
- // FIXME: Support animations between polygons in the future.
- if (type() == BasicShape::BASIC_SHAPE_POLYGON)
+ // Just polygons with same number of vertices can be animated.
+ if (type() == BasicShape::BASIC_SHAPE_POLYGON
+ && static_cast<const BasicShapePolygon*>(this)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size())
return false;
return true;
@@ -147,9 +147,26 @@
path.closeSubpath();
}
-PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape*, double) const
+PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double progress) const
{
- notImplemented();
- return BasicShapePolygon::create();
+ ASSERT(type() == other->type());
+
+ const BasicShapePolygon* o = static_cast<const BasicShapePolygon*>(other);
+ ASSERT(m_values.size() == o->values().size());
+ ASSERT(!(m_values.size() % 2));
+
+ size_t length = m_values.size();
+ RefPtr<BasicShapePolygon> result = BasicShapePolygon::create();
+ if (!length)
+ return result.release();
+
+ result->setWindRule(o->windRule());
+
+ for (size_t i = 0; i < length; i = i + 2) {
+ result->appendPoint(m_values.at(i).blend(o->values().at(i), progress),
+ m_values.at(i + 1).blend(o->values().at(i + 1), progress));
+ }
+
+ return result.release();
}
}