summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ScriptedAnimationController.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/dom/ScriptedAnimationController.cpp
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
downloadqtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/dom/ScriptedAnimationController.cpp')
-rw-r--r--Source/WebCore/dom/ScriptedAnimationController.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/Source/WebCore/dom/ScriptedAnimationController.cpp b/Source/WebCore/dom/ScriptedAnimationController.cpp
index 628f1092b..2f7862bdd 100644
--- a/Source/WebCore/dom/ScriptedAnimationController.cpp
+++ b/Source/WebCore/dom/ScriptedAnimationController.cpp
@@ -29,6 +29,7 @@
#if ENABLE(REQUEST_ANIMATION_FRAME)
#include "Document.h"
+#include "DocumentLoader.h"
#include "FrameView.h"
#include "InspectorInstrumentation.h"
#include "RequestAnimationFrameCallback.h"
@@ -52,7 +53,7 @@ ScriptedAnimationController::ScriptedAnimationController(Document* document, Pla
, m_suspendCount(0)
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
, m_animationTimer(this, &ScriptedAnimationController::animationTimerFired)
- , m_lastAnimationFrameTime(0)
+ , m_lastAnimationFrameTimeMonotonic(0)
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
, m_useTimer(false)
#endif
@@ -107,11 +108,13 @@ void ScriptedAnimationController::cancelCallback(CallbackId id)
}
}
-void ScriptedAnimationController::serviceScriptedAnimations(DOMTimeStamp time)
+void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTimeNow)
{
if (!m_callbacks.size() || m_suspendCount || (m_document->settings() && !m_document->settings()->requestAnimationFrameEnabled()))
return;
+ double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicTimeNow);
+
// First, generate a list of callbacks to consider. Callbacks registered from this point
// on are considered only for the "next" frame, not this one.
CallbackList callbacks(m_callbacks);
@@ -125,7 +128,7 @@ void ScriptedAnimationController::serviceScriptedAnimations(DOMTimeStamp time)
if (!callback->m_firedOrCancelled) {
callback->m_firedOrCancelled = true;
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(m_document, callback->m_id);
- callback->handleEvent(time);
+ callback->handleEvent(highResNowMs);
InspectorInstrumentation::didFireAnimationFrame(cookie);
}
}
@@ -141,7 +144,7 @@ void ScriptedAnimationController::serviceScriptedAnimations(DOMTimeStamp time)
if (m_callbacks.size())
scheduleAnimation();
}
-
+
void ScriptedAnimationController::windowScreenDidChange(PlatformDisplayID displayID)
{
if (m_document->settings() && !m_document->settings()->requestAnimationFrameEnabled())
@@ -150,7 +153,7 @@ void ScriptedAnimationController::windowScreenDidChange(PlatformDisplayID displa
DisplayRefreshMonitorManager::sharedManager()->windowScreenDidChange(displayID, this);
#else
UNUSED_PARAM(displayID);
-#endif
+#endif
}
void ScriptedAnimationController::scheduleAnimation()
@@ -163,14 +166,14 @@ void ScriptedAnimationController::scheduleAnimation()
if (!m_useTimer) {
if (DisplayRefreshMonitorManager::sharedManager()->scheduleAnimation(this))
return;
-
+
m_useTimer = true;
}
#endif
if (m_animationTimer.isActive())
return;
-
- double scheduleDelay = max<double>(MinimumAnimationInterval - (currentTime() - m_lastAnimationFrameTime), 0);
+
+ double scheduleDelay = max<double>(MinimumAnimationInterval - (monotonicallyIncreasingTime() - m_lastAnimationFrameTimeMonotonic), 0);
m_animationTimer.startOneShot(scheduleDelay);
#else
if (FrameView* frameView = m_document->view())
@@ -181,12 +184,19 @@ void ScriptedAnimationController::scheduleAnimation()
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
void ScriptedAnimationController::animationTimerFired(Timer<ScriptedAnimationController>*)
{
- m_lastAnimationFrameTime = currentTime();
- serviceScriptedAnimations(convertSecondsToDOMTimeStamp(m_lastAnimationFrameTime));
+ m_lastAnimationFrameTimeMonotonic = monotonicallyIncreasingTime();
+ serviceScriptedAnimations(m_lastAnimationFrameTimeMonotonic);
+}
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+void ScriptedAnimationController::displayRefreshFired(double monotonicTimeNow)
+{
+ serviceScriptedAnimations(monotonicTimeNow);
}
#endif
+#endif
+
+
}
#endif
-