[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
simon.fraser at apple.com
simon.fraser at apple.com
Wed Dec 22 18:11:35 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit cc078e89aa73cbb0caaa3201307ecf888965c56d
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 8 17:37:32 2010 +0000
2010-12-08 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein.
Fix pauseAnimation API to work with shorthand properties
https://bugs.webkit.org/show_bug.cgi?id=50639
The pause API is always called with a long-hand property, but that
property may be animating via a shorthand. Detect this, and pause
such shorthand animations.
* page/animation/AnimationBase.cpp:
(WebCore::ShorthandPropertyWrapper::propertyWrappers): Expose the vector
of wrappers used by a shorthand wrapper.
(WebCore::gatherEnclosingShorthandProperties): Utility function that walks
through the shorthand wrappers, keeping track of which can affect the given
property.
(WebCore::AnimationBase::animatableShorthandsAffectingProperty): Return a set
of shorthand properties that can affect the given property.
* page/animation/AnimationBase.h: New method.
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::pauseTransitionAtTime): If we don't find the
property itself, check whether it's being animated via shorthands.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f4486f1..bad5bcc 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-08 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Fix pauseAnimation API to work with shorthand properties
+ https://bugs.webkit.org/show_bug.cgi?id=50639
+
+ * transitions/border-radius-transition.html:
+ * transitions/shorthand-border-transitions.html:
+ * transitions/shorthand-transitions.html:
+ We can now use the pause API for these tests.
+
+ * transitions/transition-test-helpers.js:
+ Fix issue where "-webkit-transform-origin" would match where
+ we are really looking for "-webkit-transform.".
+
2010-12-08 Philippe Normand <pnormand at igalia.com>
Reviewed by Gustavo Noronha Silva.
diff --git a/LayoutTests/transitions/border-radius-transition.html b/LayoutTests/transitions/border-radius-transition.html
index b4434fc..98734de 100644
--- a/LayoutTests/transitions/border-radius-transition.html
+++ b/LayoutTests/transitions/border-radius-transition.html
@@ -44,7 +44,7 @@
document.getElementById('box2').className = 'box final';
}
- runTransitionTest(expectedValues, setupTest, dontUsePauseAPI); // the pause API does not work with shorthands.
+ runTransitionTest(expectedValues, setupTest, usePauseAPI);
</script>
</head>
<body>
diff --git a/LayoutTests/transitions/shorthand-border-transitions.html b/LayoutTests/transitions/shorthand-border-transitions.html
index 362eab1..4880598 100644
--- a/LayoutTests/transitions/shorthand-border-transitions.html
+++ b/LayoutTests/transitions/shorthand-border-transitions.html
@@ -50,7 +50,7 @@
<script type="text/javascript" charset="utf-8">
const expectedValues = [
- // [time, element-id, property, expected-value, tolerance]
+ // [time, element-id, property, expected-value, tolerance, callback, should-be-transitioning]
// color and width of each side should be animating
[0.5, 'box', 'border-top-color', [128, 0, 128], 30],
[0.5, 'box', 'border-right-color', [128, 0, 128], 30],
@@ -63,7 +63,7 @@
// only border-width should be animating
[0.5, 'box1', 'border-top-width', 10, 2],
- [0.5, 'box1', 'border-top-color', [255, 0, 255], 0], // initial value
+ [0.5, 'box1', 'border-top-color', [255, 0, 255], 0, null, shouldNotBeTransitioning],
// border-width should be animating
[0.5, 'box2', 'border-top-width', 10, 2],
@@ -82,7 +82,7 @@
box2.className = 'final';
}
- runTransitionTest(expectedValues, setupTest, false);
+ runTransitionTest(expectedValues, setupTest, usePauseAPI);
</script>
</head>
<body>
diff --git a/LayoutTests/transitions/shorthand-transitions.html b/LayoutTests/transitions/shorthand-transitions.html
index 1359128..8b97227 100644
--- a/LayoutTests/transitions/shorthand-transitions.html
+++ b/LayoutTests/transitions/shorthand-transitions.html
@@ -49,9 +49,7 @@
box.className = 'final';
}
- // We can't use the pause API because it only works for individual properties, and
- // -webkit-transform-origin is a compound property.
- runTransitionTest(expectedValues, setupTest, false);
+ runTransitionTest(expectedValues, setupTest, usePauseAPI);
</script>
</head>
<body>
diff --git a/LayoutTests/transitions/transition-test-helpers.js b/LayoutTests/transitions/transition-test-helpers.js
index ad9f804..f494da4 100644
--- a/LayoutTests/transitions/transition-test-helpers.js
+++ b/LayoutTests/transitions/transition-test-helpers.js
@@ -169,7 +169,7 @@ function runTest(expected, usePauseAPI)
var time = expected[i][0];
var elementId = expected[i][1];
var property = expected[i][2];
- if (!property.indexOf("-webkit-transform"))
+ if (!property.indexOf("-webkit-transform."))
property = "-webkit-transform";
var tryToPauseTransition = expected[i][6];
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f537bc8..6a89cc5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-12-08 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Fix pauseAnimation API to work with shorthand properties
+ https://bugs.webkit.org/show_bug.cgi?id=50639
+
+ The pause API is always called with a long-hand property, but that
+ property may be animating via a shorthand. Detect this, and pause
+ such shorthand animations.
+
+ * page/animation/AnimationBase.cpp:
+ (WebCore::ShorthandPropertyWrapper::propertyWrappers): Expose the vector
+ of wrappers used by a shorthand wrapper.
+
+ (WebCore::gatherEnclosingShorthandProperties): Utility function that walks
+ through the shorthand wrappers, keeping track of which can affect the given
+ property.
+ (WebCore::AnimationBase::animatableShorthandsAffectingProperty): Return a set
+ of shorthand properties that can affect the given property.
+
+ * page/animation/AnimationBase.h: New method.
+ * page/animation/CompositeAnimation.cpp:
+ (WebCore::CompositeAnimation::pauseTransitionAtTime): If we don't find the
+ property itself, check whether it's being animated via shorthands.
+
2010-12-08 David Hyatt <hyatt at apple.com>
Reviewed by Beth Dakin.
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index 913fe9f..1ba39d9 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -578,6 +578,8 @@ public:
(*it)->blend(anim, dst, a, b, progress);
}
+ const Vector<PropertyWrapperBase*> propertyWrappers() const { return m_propertyWrappers; }
+
private:
Vector<PropertyWrapperBase*> m_propertyWrappers;
};
@@ -867,6 +869,39 @@ bool AnimationBase::animationOfPropertyIsAccelerated(int prop)
}
#endif
+static bool gatherEnclosingShorthandProperties(int property, PropertyWrapperBase* wrapper, HashSet<int>& propertySet)
+{
+ if (!wrapper->isShorthandWrapper())
+ return false;
+
+ ShorthandPropertyWrapper* shorthandWrapper = static_cast<ShorthandPropertyWrapper*>(wrapper);
+
+ bool contained = false;
+ for (size_t i = 0; i < shorthandWrapper->propertyWrappers().size(); ++i) {
+ PropertyWrapperBase* currWrapper = shorthandWrapper->propertyWrappers()[i];
+
+ if (gatherEnclosingShorthandProperties(property, currWrapper, propertySet) || currWrapper->property() == property)
+ contained = true;
+ }
+
+ if (contained)
+ propertySet.add(wrapper->property());
+
+ return contained;
+}
+
+// Note: this is inefficient. It's only called from pauseTransitionAtTime().
+HashSet<int> AnimationBase::animatableShorthandsAffectingProperty(int property)
+{
+ ensurePropertyMap();
+
+ HashSet<int> foundProperties;
+ for (int i = 0; i < getNumProperties(); ++i)
+ gatherEnclosingShorthandProperties(property, (*gPropertyWrappers)[i], foundProperties);
+
+ return foundProperties;
+}
+
void AnimationBase::setNeedsStyleRecalc(Node* node)
{
ASSERT(!node || (node->document() && !node->document()->inPageCache()));
diff --git a/WebCore/page/animation/AnimationBase.h b/WebCore/page/animation/AnimationBase.h
index eb9bd12..877d649 100644
--- a/WebCore/page/animation/AnimationBase.h
+++ b/WebCore/page/animation/AnimationBase.h
@@ -31,6 +31,7 @@
#include "RenderStyleConstants.h"
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
@@ -180,6 +181,8 @@ public:
static bool animationOfPropertyIsAccelerated(int prop);
#endif
+ static HashSet<int> animatableShorthandsAffectingProperty(int property);
+
protected:
virtual void overrideAnimations() { }
virtual void resumeOverriddenAnimations() { }
diff --git a/WebCore/page/animation/CompositeAnimation.cpp b/WebCore/page/animation/CompositeAnimation.cpp
index 9d021b4..602491e 100644
--- a/WebCore/page/animation/CompositeAnimation.cpp
+++ b/WebCore/page/animation/CompositeAnimation.cpp
@@ -30,6 +30,7 @@
#include "CompositeAnimation.h"
#include "AnimationControllerPrivate.h"
+#include "CSSPropertyLonghand.h"
#include "CSSPropertyNames.h"
#include "ImplicitAnimation.h"
#include "KeyframeAnimation.h"
@@ -509,7 +510,20 @@ bool CompositeAnimation::pauseTransitionAtTime(int property, double t)
return false;
ImplicitAnimation* implAnim = m_transitions.get(property).get();
- if (!implAnim || !implAnim->running())
+ if (!implAnim) {
+ // Check to see if this property is being animated via a shorthand.
+ // This code is only used for testing, so performance is not critical here.
+ HashSet<int> shorthandProperties = AnimationBase::animatableShorthandsAffectingProperty(property);
+ bool anyPaused = false;
+ HashSet<int>::const_iterator end = shorthandProperties.end();
+ for (HashSet<int>::const_iterator it = shorthandProperties.begin(); it != end; ++it) {
+ if (pauseTransitionAtTime(*it, t))
+ anyPaused = true;
+ }
+ return anyPaused;
+ }
+
+ if (!implAnim->running())
return false;
if ((t >= 0.0) && (t <= implAnim->duration())) {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list