Diff
Modified: trunk/LayoutTests/compositing/repaint/become-overlay-composited-layer.html (107574 => 107575)
--- trunk/LayoutTests/compositing/repaint/become-overlay-composited-layer.html 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/LayoutTests/compositing/repaint/become-overlay-composited-layer.html 2012-02-13 16:39:34 UTC (rev 107575)
@@ -51,8 +51,10 @@
document.getElementById("container").className = "right";
window.setTimeout(function() {
document.getElementById("container").className = "";
- if (window.layoutTestController)
- layoutTestController.notifyDone();
+ window.setTimeout(function() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 250);
}, 250);
}
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (107574 => 107575)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-13 16:39:34 UTC (rev 107575)
@@ -997,6 +997,9 @@
// SVG TESTS
// -----------------------------------------------------------------
+// Need rebaselining after bug 64591
+BUGWK64591 : compositing/repaint/become-overlay-composited-layer.html = PASS FAIL
+
BUGCR8763 MAC : svg/custom/use-on-g-containing-foreignObject-and-image.svg = IMAGE
Modified: trunk/LayoutTests/platform/chromium-linux/compositing/repaint/become-overlay-composited-layer-expected.png
(Binary files differ)
Added: trunk/LayoutTests/platform/chromium-linux/compositing/repaint/become-overlay-composited-layer-expected.txt (0 => 107575)
--- trunk/LayoutTests/platform/chromium-linux/compositing/repaint/become-overlay-composited-layer-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/compositing/repaint/become-overlay-composited-layer-expected.txt 2012-02-13 16:39:34 UTC (rev 107575)
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x20
+ RenderInline {A} at (0,0) size 146x19 [color=#0000EE]
+ RenderText {#text} at (0,0) size 146x19
+ text run at (0,0) width 146: "rdar://problem/6983207"
+ RenderText {#text} at (146,0) size 374x19
+ text run at (146,0) width 374: "Should not leave blue box behind after moving to the top right."
+layer at (8,44) size 502x102
+ RenderBlock (relative positioned) {DIV} at (0,36) size 502x102 [border: (1px solid #000000)]
+layer at (259,45) size 250x100
+ RenderBlock (positioned) {DIV} at (251,1) size 250x100 [bgcolor=#0000FF]
+layer at (9,45) size 50x50
+ RenderBlock (positioned) {DIV} at (1,1) size 50x50 [bgcolor=#000000]
Modified: trunk/Source/WebCore/ChangeLog (107574 => 107575)
--- trunk/Source/WebCore/ChangeLog 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/Source/WebCore/ChangeLog 2012-02-13 16:39:34 UTC (rev 107575)
@@ -1,3 +1,24 @@
+2012-02-13 Joel Webber <[email protected]>
+
+ Use requestAnimationFrame callbacks to pump CSS animations
+ https://bugs.webkit.org/show_bug.cgi?id=64591
+
+ Reviewed by James Robinson.
+
+ No new tests needed (covered by tests in animations/*).
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::serviceScriptedAnimations):
+ * page/animation/AnimationController.cpp:
+ (WebCore::AnimationControllerPrivate::updateAnimations):
+ (WebCore::AnimationControllerPrivate::updateAnimationTimer):
+ (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle):
+ (WebCore::AnimationControllerPrivate::animationFrameCallbackFired):
+ (WebCore::AnimationController::updateAnimations):
+ (WebCore::AnimationController::serviceAnimations):
+ * page/animation/AnimationController.h:
+ * page/animation/AnimationControllerPrivate.h:
+
2012-02-13 Patrick Gansterer <[email protected]>
Add WindowsExtras.h
Modified: trunk/Source/WebCore/page/FrameView.cpp (107574 => 107575)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-02-13 16:39:34 UTC (rev 107575)
@@ -2113,8 +2113,11 @@
#if ENABLE(REQUEST_ANIMATION_FRAME)
void FrameView::serviceScriptedAnimations(DOMTimeStamp time)
{
+ Vector<AnimationController*> animations;
+ for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext())
+ frame->animation()->serviceAnimations();
+
Vector<RefPtr<Document> > documents;
-
for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext())
documents.append(frame->document());
Modified: trunk/Source/WebCore/page/animation/AnimationController.cpp (107574 => 107575)
--- trunk/Source/WebCore/page/animation/AnimationController.cpp 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/Source/WebCore/page/animation/AnimationController.cpp 2012-02-13 16:39:34 UTC (rev 107575)
@@ -35,6 +35,7 @@
#include "CompositeAnimation.h"
#include "EventNames.h"
#include "Frame.h"
+#include "FrameView.h"
#include "RenderView.h"
#include "WebKitAnimationEvent.h"
#include "WebKitAnimationList.h"
@@ -44,7 +45,6 @@
namespace WebCore {
-// FIXME: Why isn't this set to 60fps or something?
static const double cAnimationTimerDelay = 0.025;
static const double cBeginAnimationUpdateTimeNotSet = -1;
@@ -84,9 +84,9 @@
return animation->suspended();
}
-void AnimationControllerPrivate::updateAnimationTimer(bool callSetChanged/* = false*/)
+double AnimationControllerPrivate::updateAnimations(SetChanged callSetChanged/* = DoNotCallSetChanged*/)
{
- double needsService = -1;
+ double timeToNextService = -1;
bool calledSetChanged = false;
RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
@@ -94,10 +94,10 @@
CompositeAnimation* compAnim = it->second.get();
if (!compAnim->suspended() && compAnim->hasAnimations()) {
double t = compAnim->timeToNextService();
- if (t != -1 && (t < needsService || needsService == -1))
- needsService = t;
- if (needsService == 0) {
- if (callSetChanged) {
+ if (t != -1 && (t < timeToNextService || timeToNextService == -1))
+ timeToNextService = t;
+ if (!timeToNextService) {
+ if (callSetChanged == CallSetChanged) {
Node* node = it->first->node();
ASSERT(!node || (node->document() && !node->document()->inPageCache()));
node->setNeedsStyleRecalc(SyntheticStyleChange);
@@ -108,28 +108,35 @@
}
}
}
-
+
if (calledSetChanged)
m_frame->document()->updateStyleIfNeeded();
-
+
+ return timeToNextService;
+}
+
+void AnimationControllerPrivate::updateAnimationTimer(SetChanged callSetChanged/* = DoNotCallSetChanged*/)
+{
+ double timeToNextService = updateAnimations(callSetChanged);
+
// If we want service immediately, we start a repeating timer to reduce the overhead of starting
- if (needsService == 0) {
+ if (!timeToNextService) {
if (!m_animationTimer.isActive() || m_animationTimer.repeatInterval() == 0)
m_animationTimer.startRepeating(cAnimationTimerDelay);
return;
}
-
+
// If we don't need service, we want to make sure the timer is no longer running
- if (needsService < 0) {
+ if (timeToNextService < 0) {
if (m_animationTimer.isActive())
m_animationTimer.stop();
return;
}
-
+
// Otherwise, we want to start a one-shot timer so we get here again
if (m_animationTimer.isActive())
m_animationTimer.stop();
- m_animationTimer.startOneShot(needsService);
+ m_animationTimer.startOneShot(timeToNextService);
}
void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*)
@@ -143,7 +150,7 @@
RefPtr<Frame> protector = m_frame;
bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
-
+
// fire all the events
Vector<EventToDispatch> eventsToDispatch = m_eventsToDispatch;
m_eventsToDispatch.clear();
@@ -154,14 +161,14 @@
else
it->element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime));
}
-
+
// call setChanged on all the elements
Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end();
for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it)
(*it)->setNeedsStyleRecalc(SyntheticStyleChange);
-
+
m_nodeChangesToDispatch.clear();
-
+
if (updateStyle && m_frame)
m_frame->document()->updateStyleIfNeeded();
}
@@ -194,6 +201,16 @@
startUpdateStyleIfNeededDispatcher();
}
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+void AnimationControllerPrivate::animationFrameCallbackFired()
+{
+ double timeToNextService = updateAnimations(CallSetChanged);
+
+ if (timeToNextService >= 0)
+ m_frame->document()->view()->scheduleAnimation();
+}
+#endif
+
void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPrivate>*)
{
// Make sure animationUpdateTime is updated, so that it is current even if no
@@ -202,7 +219,7 @@
// When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate
// updateStyleIfNeeded. It will then call back to us with new information.
- updateAnimationTimer(true);
+ updateAnimationTimer(CallSetChanged);
// Fire events right away, to avoid a flash of unanimated style after an animation completes, and before
// the 'end' event fires.
@@ -499,8 +516,13 @@
RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnimation(renderer);
RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, oldStyle, newStyle);
- if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations()))
+ if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) {
m_data->updateAnimationTimer();
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ if (FrameView* view = renderer->document()->view())
+ view->scheduleAnimation();
+#endif
+ }
if (blendedStyle != newStyle) {
// If the animations/transitions change opacity or transform, we need to update
@@ -557,6 +579,13 @@
m_data->resumeAnimations();
}
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+void AnimationController::serviceAnimations()
+{
+ m_data->animationFrameCallbackFired();
+}
+#endif
+
void AnimationController::suspendAnimationsForDocument(Document* document)
{
m_data->suspendAnimationsForDocument(document);
Modified: trunk/Source/WebCore/page/animation/AnimationController.h (107574 => 107575)
--- trunk/Source/WebCore/page/animation/AnimationController.h 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/Source/WebCore/page/animation/AnimationController.h 2012-02-13 16:39:34 UTC (rev 107575)
@@ -66,6 +66,9 @@
void suspendAnimations();
void resumeAnimations();
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ void serviceAnimations();
+#endif
void suspendAnimationsForDocument(Document*);
void resumeAnimationsForDocument(Document*);
Modified: trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h (107574 => 107575)
--- trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h 2012-02-13 16:29:46 UTC (rev 107574)
+++ trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h 2012-02-13 16:39:34 UTC (rev 107575)
@@ -51,13 +51,20 @@
class RenderStyle;
class WebKitAnimationList;
+enum SetChanged {
+ DoNotCallSetChanged = 0,
+ CallSetChanged = 1
+};
+
class AnimationControllerPrivate {
WTF_MAKE_NONCOPYABLE(AnimationControllerPrivate); WTF_MAKE_FAST_ALLOCATED;
public:
AnimationControllerPrivate(Frame*);
~AnimationControllerPrivate();
- void updateAnimationTimer(bool callSetChanged = false);
+ // Returns the time until the next animation needs to be serviced, or -1 if there are none.
+ double updateAnimations(SetChanged callSetChanged = DoNotCallSetChanged);
+ void updateAnimationTimer(SetChanged callSetChanged = DoNotCallSetChanged);
PassRefPtr<CompositeAnimation> accessCompositeAnimation(RenderObject*);
bool clear(RenderObject*);
@@ -71,6 +78,9 @@
void suspendAnimations();
void resumeAnimations();
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ void animationFrameCallbackFired();
+#endif
void suspendAnimationsForDocument(Document*);
void resumeAnimationsForDocument(Document*);