Changeset 139635 in webkit


Ignore:
Timestamp:
Jan 14, 2013, 11:45:56 AM (12 years ago)
Author:
simonjam@chromium.org
Message:

Merge 139509

Restore old semantics to webkitRequestAnimationFrame callbacks
https://bugs.webkit.org/show_bug.cgi?id=106697

Reviewed by James Robinson.

Source/WebCore:

Sites that use GWT <= 2.4 are buggy and rely on Date.now()-like callback values.
We'll restore that behavior to the prefixed version of webkitRequestAnimationFrame.
requestAnimationFrame will continue to follow the spec.

Test: fast/animation/request-animation-frame-prefix.html

  • dom/RequestAnimationFrameCallback.h:

(RequestAnimationFrameCallback):

  • dom/ScriptedAnimationController.cpp:

(WebCore::ScriptedAnimationController::serviceScriptedAnimations):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::requestAnimationFrame):
(WebCore):
(WebCore::DOMWindow::webkitRequestAnimationFrame):

  • page/DOMWindow.h:

(DOMWindow):

  • page/DOMWindow.idl:

LayoutTests:

  • fast/animation/request-animation-frame-prefix-expected.txt: Added.
  • fast/animation/request-animation-frame-prefix.html: Added.
  • fast/animation/script-tests/request-animation-frame-prefix.js: Added.

(busyWait):
(window.webkitRequestAnimationFrame):

TBR=simonjam@chromium.org
Review URL: https://codereview.chromium.org/11876026

Location:
branches/chromium/1364
Files:
5 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/chromium/1364/Source/WebCore/dom/RequestAnimationFrameCallback.h

    r131131 r139635  
    4343    int m_id;
    4444    bool m_firedOrCancelled;
     45    bool m_useLegacyTimeBase;
    4546};
    4647
  • branches/chromium/1364/Source/WebCore/dom/ScriptedAnimationController.cpp

    r131131 r139635  
    115115
    116116    double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicTimeNow);
     117    double legacyHighResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToPseudoWallTime(monotonicTimeNow);
    117118
    118119    // First, generate a list of callbacks to consider.  Callbacks registered from this point
     
    129130            callback->m_firedOrCancelled = true;
    130131            InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(m_document, callback->m_id);
    131             callback->handleEvent(highResNowMs);
     132            if (callback->m_useLegacyTimeBase)
     133                callback->handleEvent(legacyHighResNowMs);
     134            else
     135                callback->handleEvent(highResNowMs);
    132136            InspectorInstrumentation::didFireAnimationFrame(cookie);
    133137        }
  • branches/chromium/1364/Source/WebCore/page/DOMWindow.cpp

    r138269 r139635  
    15501550int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
    15511551{
     1552    callback->m_useLegacyTimeBase = false;
     1553    if (Document* d = document())
     1554        return d->requestAnimationFrame(callback);
     1555    return 0;
     1556}
     1557
     1558int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
     1559{
     1560    callback->m_useLegacyTimeBase = true;
    15521561    if (Document* d = document())
    15531562        return d->requestAnimationFrame(callback);
  • branches/chromium/1364/Source/WebCore/page/DOMWindow.h

    r134586 r139635  
    265265#if ENABLE(REQUEST_ANIMATION_FRAME)
    266266        int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
     267        int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
    267268        void cancelAnimationFrame(int id);
    268269#endif
  • branches/chromium/1364/Source/WebCore/page/DOMWindow.idl

    r138925 r139635  
    217217    [V8MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
    218218    void cancelAnimationFrame(in long id);
    219     [ImplementedAs=requestAnimationFrame, V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
     219    [V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
    220220    [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(in long id);
    221221    [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(in long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
Note: See TracChangeset for help on using the changeset viewer.