Changeset 139509 in webkit


Ignore:
Timestamp:
Jan 11, 2013 3:18:06 PM (11 years ago)
Author:
simonjam@chromium.org
Message:

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):

Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139504 r139509  
     12013-01-11  James Simonsen  <simonjam@chromium.org>
     2
     3        Restore old semantics to webkitRequestAnimationFrame callbacks
     4        https://bugs.webkit.org/show_bug.cgi?id=106697
     5
     6        Reviewed by James Robinson.
     7
     8        * fast/animation/request-animation-frame-prefix-expected.txt: Added.
     9        * fast/animation/request-animation-frame-prefix.html: Added.
     10        * fast/animation/script-tests/request-animation-frame-prefix.js: Added.
     11        (busyWait):
     12        (window.webkitRequestAnimationFrame):
     13
    1142013-01-11  Kenneth Russell  <kbr@google.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r139503 r139509  
     12013-01-11  James Simonsen  <simonjam@chromium.org>
     2
     3        Restore old semantics to webkitRequestAnimationFrame callbacks
     4        https://bugs.webkit.org/show_bug.cgi?id=106697
     5
     6        Reviewed by James Robinson.
     7
     8        Sites that use GWT <= 2.4 are buggy and rely on Date.now()-like callback values.
     9        We'll restore that behavior to the prefixed version of webkitRequestAnimationFrame.
     10        requestAnimationFrame will continue to follow the spec.
     11
     12        Test: fast/animation/request-animation-frame-prefix.html
     13
     14        * dom/RequestAnimationFrameCallback.h:
     15        (RequestAnimationFrameCallback):
     16        * dom/ScriptedAnimationController.cpp:
     17        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
     18        * page/DOMWindow.cpp:
     19        (WebCore::DOMWindow::requestAnimationFrame):
     20        (WebCore):
     21        (WebCore::DOMWindow::webkitRequestAnimationFrame):
     22        * page/DOMWindow.h:
     23        (DOMWindow):
     24        * page/DOMWindow.idl:
     25
    1262013-01-11  Sheriff Bot  <webkit.review.bot@gmail.com>
    227
  • trunk/Source/WebCore/dom/RequestAnimationFrameCallback.h

    r131131 r139509  
    4343    int m_id;
    4444    bool m_firedOrCancelled;
     45    bool m_useLegacyTimeBase;
    4546};
    4647
  • trunk/Source/WebCore/dom/ScriptedAnimationController.cpp

    r131131 r139509  
    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        }
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r139050 r139509  
    15511551int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
    15521552{
     1553    callback->m_useLegacyTimeBase = false;
     1554    if (Document* d = document())
     1555        return d->requestAnimationFrame(callback);
     1556    return 0;
     1557}
     1558
     1559int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
     1560{
     1561    callback->m_useLegacyTimeBase = true;
    15531562    if (Document* d = document())
    15541563        return d->requestAnimationFrame(callback);
  • trunk/Source/WebCore/page/DOMWindow.h

    r138674 r139509  
    265265#if ENABLE(REQUEST_ANIMATION_FRAME)
    266266        int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
     267        int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
    267268        void cancelAnimationFrame(int id);
    268269#endif
  • trunk/Source/WebCore/page/DOMWindow.idl

    r139372 r139509  
    209209    [V8MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
    210210    void cancelAnimationFrame(in long id);
    211     [ImplementedAs=requestAnimationFrame, V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
     211    [V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
    212212    [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(in long id);
    213213    [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.