Changeset 116230 in webkit


Ignore:
Timestamp:
May 5, 2012 2:38:17 PM (12 years ago)
Author:
dino@apple.com
Message:

Add new Setting/Preference to disable requestAnimationFrame
https://bugs.webkit.org/show_bug.cgi?id=85693

Reviewed by Simon Fraser.

Source/WebCore:

Hook up the new WebPreference for disabling requestAnimationFrame
to Settings. This isn't disabling the feature in the typical
WebKit ENABLE() way - it's still available in the DOM, it's
just that the animations will never be serviced. This allows a client
to disable the machinery without breaking content (other than the
animations).

The new test is currently skipped on all platforms because toggling
the preference interferes with the other tests that are running
at the same time (and expect a working requestAnimationFrame).
https://bugs.webkit.org/show_bug.cgi?id=85689

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

  • dom/ScriptedAnimationController.cpp:

(WebCore::ScriptedAnimationController::serviceScriptedAnimations):
(WebCore::ScriptedAnimationController::windowScreenDidChange):
(WebCore::ScriptedAnimationController::scheduleAnimation):
Check the setting before deciding to act.

  • page/Settings.cpp:

(WebCore::Settings::Settings):

  • page/Settings.h:

(WebCore::Settings::setRequestAnimationFrameEnabled):
(WebCore::Settings::requestAnimationFrameEnabled):
(Settings):

Source/WebKit/mac:

Exposes a new WebPreference: WebKitRequestAnimationFrameEnabled.
The default value is true. The majority of applications will leave
it this way.

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):
(-[WebPreferences requestAnimationFrameEnabled]):
(-[WebPreferences setRequestAnimationFrameEnabled:]):

  • WebView/WebPreferencesPrivate.h:
  • WebView/WebView.mm:

(-[WebView _preferencesChanged:]):

Source/WebKit/win:

Exposes a new WebPreference: WebKitRequestAnimationFrameEnabled.
The default value is true. The majority of applications will leave
it this way.

  • Interfaces/IWebPreferencesPrivate.idl:
  • WebPreferenceKeysPrivate.h:
  • WebPreferences.cpp:

(WebPreferences::initializeDefaultSettings):
(WebPreferences::setRequestAnimationFrameEnabled):
(WebPreferences::requestAnimationFrameEnabled):

  • WebPreferences.h:

(WebPreferences):

  • WebView.cpp:

(WebView::notifyPreferencesChanged):

Source/WebKit2:

Exposes a new WebPreference: WebKitRequestAnimationFrameEnabled.
The default value is true. The majority of applications will leave
it this way.

  • Shared/WebPreferencesStore.h:

(WebKit):

  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetRequestAnimationFrameEnabled):
(WKPreferencesGetRequestAnimationFrameEnabled):

  • UIProcess/API/C/WKPreferencesPrivate.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

LayoutTests:

A new test that exercises turning the requestAnimationFrame
preference off. Unfortunately this conflicts with the parallel
tests that expect the preference to be on (as it should by default),
so the test is skipped on all platforms. It can be run in isolation.
https://bugs.webkit.org/show_bug.cgi?id=85689

  • fast/animation/request-animation-frame-disabled-expected.txt: Added.
  • fast/animation/request-animation-frame-disabled.html: Added.
  • fast/animation/script-tests/request-animation-frame-disabled.js: Added.
  • platform/chromium/test_expectations.txt:
  • platform/efl/test_expectations.txt:
  • platform/gtk/test_expectations.txt:
  • platform/mac/Skipped:
  • platform/mac/test_expectations.txt:
  • platform/qt/test_expectations.txt:
  • platform/win/Skipped:
  • platform/win/test_expectations.txt:
Location:
trunk
Files:
3 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116221 r116230  
     12012-05-05  Dean Jackson  <dino@apple.com>
     2
     3        Add new Setting/Preference to disable requestAnimationFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=85693
     5
     6        Reviewed by Simon Fraser.
     7
     8        A new test that exercises turning the requestAnimationFrame
     9        preference off. Unfortunately this conflicts with the parallel
     10        tests that expect the preference to be on (as it should by default),
     11        so the test is skipped on all platforms. It can be run in isolation.
     12        https://bugs.webkit.org/show_bug.cgi?id=85689
     13
     14        * fast/animation/request-animation-frame-disabled-expected.txt: Added.
     15        * fast/animation/request-animation-frame-disabled.html: Added.
     16        * fast/animation/script-tests/request-animation-frame-disabled.js: Added.
     17        * platform/chromium/test_expectations.txt:
     18        * platform/efl/test_expectations.txt:
     19        * platform/gtk/test_expectations.txt:
     20        * platform/mac/Skipped:
     21        * platform/mac/test_expectations.txt:
     22        * platform/qt/test_expectations.txt:
     23        * platform/win/Skipped:
     24        * platform/win/test_expectations.txt:
     25
    1262012-05-05  Zhenyao Mo  <zmo@google.com>
    227
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r116197 r116230  
    39103910BUGDPRANKE MAC : userscripts/user-style-all-frames.html = TEXT PASS
    39113911
     3912// Interferes with the rAF tests that are enabled
     3913BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
  • trunk/LayoutTests/platform/efl/test_expectations.txt

    r116208 r116230  
    291291BUGWK85599 : http/tests/navigation/postredirect-basic.html = TEXT
    292292BUGWK85599 : http/tests/navigation/postredirect-goback1.html = TEXT
     293
     294// Interferes with the rAF tests that are enabled
     295BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
  • trunk/LayoutTests/platform/gtk/test_expectations.txt

    r116214 r116230  
    13441344BUGWK85700 : fullscreen/non-ancestor-iframe.html = FAIL
    13451345
     1346// Interferes with the rAF tests that are enabled
     1347BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
     1348
    13461349//////////////////////////////////////////////////////////////////////////////////////////
    13471350// End of Tests failing
  • trunk/LayoutTests/platform/mac/test_expectations.txt

    r116069 r116230  
    206206BUGWK85565 : fast/block/float/016.html = IMAGE
    207207BUGWK85565 : fast/css/border-solid-single-edge-antialias.html = IMAGE
     208
     209// Interferes with the tests that should pass
     210BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
  • trunk/LayoutTests/platform/qt/test_expectations.txt

    r116074 r116230  
    7373BUGWK85567 : fast/images/png-suite/test.html = IMAGE
    7474
     75// Interferes with the tests that should pass
     76BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
  • trunk/LayoutTests/platform/win/Skipped

    r116009 r116230  
    17331733# http://webkit.org/b/82886
    17341734inspector/styles/override-screen-size.html
     1735
     1736# Interferes with the other requestAnimationFrame tests
     1737# https://bugs.webkit.org/show_bug.cgi?id=85689
     1738fast/animation/request-animation-frame-disabled.html
  • trunk/Source/WebCore/ChangeLog

    r116227 r116230  
     12012-05-05  Dean Jackson  <dino@apple.com>
     2
     3        Add new Setting/Preference to disable requestAnimationFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=85693
     5
     6        Reviewed by Simon Fraser.
     7
     8        Hook up the new WebPreference for disabling requestAnimationFrame
     9        to Settings. This isn't disabling the feature in the typical
     10        WebKit ENABLE() way - it's still available in the DOM, it's
     11        just that the animations will never be serviced. This allows a client
     12        to disable the machinery without breaking content (other than the
     13        animations).
     14
     15        The new test is currently skipped on all platforms because toggling
     16        the preference interferes with the other tests that are running
     17        at the same time (and expect a working requestAnimationFrame).
     18        https://bugs.webkit.org/show_bug.cgi?id=85689
     19
     20        Test: fast/animation/request-animation-frame-disabled.html
     21
     22        * dom/ScriptedAnimationController.cpp:
     23        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
     24        (WebCore::ScriptedAnimationController::windowScreenDidChange):
     25        (WebCore::ScriptedAnimationController::scheduleAnimation):
     26        Check the setting before deciding to act.
     27        * page/Settings.cpp:
     28        (WebCore::Settings::Settings):
     29        * page/Settings.h:
     30        (WebCore::Settings::setRequestAnimationFrameEnabled):
     31        (WebCore::Settings::requestAnimationFrameEnabled):
     32        (Settings):
     33
    1342012-05-05  Gustavo Noronha Silva  <gns@gnome.org>
    235
  • trunk/Source/WebCore/dom/ScriptedAnimationController.cpp

    r115525 r116230  
    3434#include "InspectorInstrumentation.h"
    3535#include "RequestAnimationFrameCallback.h"
     36#include "Settings.h"
    3637
    3738#if USE(REQUEST_ANIMATION_FRAME_TIMER)
     
    110111void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTimeNow)
    111112{
    112     if (!m_callbacks.size() || m_suspendCount)
     113    if (!m_callbacks.size() || m_suspendCount || (m_document->settings() && !m_document->settings()->requestAnimationFrameEnabled()))
    113114        return;
    114115
     
    119120    CallbackList callbacks(m_callbacks);
    120121
    121     // Invoking callbacks may detach elements from our document, which clear's the document's
     122    // Invoking callbacks may detach elements from our document, which clears the document's
    122123    // reference to us, so take a defensive reference.
    123124    RefPtr<ScriptedAnimationController> protector(this);
     
    147148void ScriptedAnimationController::windowScreenDidChange(PlatformDisplayID displayID)
    148149{
     150    if (m_document->settings() && !m_document->settings()->requestAnimationFrameEnabled())
     151        return;
    149152#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    150153    DisplayRefreshMonitorManager::sharedManager()->windowScreenDidChange(displayID, this);
     
    156159void ScriptedAnimationController::scheduleAnimation()
    157160{
    158     if (!m_document)
     161    if (!m_document || (m_document->settings() && !m_document->settings()->requestAnimationFrameEnabled()))
    159162        return;
    160163
  • trunk/Source/WebCore/page/Settings.cpp

    r115948 r116230  
    265265    , m_shouldRespectImageOrientation(false)
    266266    , m_wantsBalancedSetDefersLoadingBehavior(false)
     267    , m_requestAnimationFrameEnabled(true)
    267268    , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
    268269    , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds)
  • trunk/Source/WebCore/page/Settings.h

    r115948 r116230  
    555555        void setWantsBalancedSetDefersLoadingBehavior(bool flag) { m_wantsBalancedSetDefersLoadingBehavior = flag; }
    556556        bool wantsBalancedSetDefersLoadingBehavior() const { return m_wantsBalancedSetDefersLoadingBehavior; }
    557        
     557
    558558        void setIncrementalRenderingSuppressionTimeoutInSeconds(double timeout) { m_incrementalRenderingSuppressionTimeoutInSeconds = timeout; }
    559559        double incrementalRenderingSuppressionTimeoutInSeconds() const { return m_incrementalRenderingSuppressionTimeoutInSeconds; }
    560        
     560
     561        void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; }
     562        bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; }
     563
    561564#if USE(JSC)
    562565        static void setShouldRespectPriorityInCSSAttributeSetters(bool);
     
    722725        bool m_shouldRespectImageOrientation : 1;
    723726        bool m_wantsBalancedSetDefersLoadingBehavior : 1;
     727        bool m_requestAnimationFrameEnabled : 1;
    724728
    725729        Timer<Settings> m_loadsImagesAutomaticallyTimer;
  • trunk/Source/WebKit/mac/ChangeLog

    r116179 r116230  
     12012-05-05  Dean Jackson  <dino@apple.com>
     2
     3        Add new Setting/Preference to disable requestAnimationFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=85693
     5
     6        Reviewed by Simon Fraser.
     7
     8        Exposes a new WebPreference: WebKitRequestAnimationFrameEnabled.
     9        The default value is true. The majority of applications will leave
     10        it this way.
     11
     12        * WebView/WebPreferenceKeysPrivate.h:
     13        * WebView/WebPreferences.mm:
     14        (+[WebPreferences initialize]):
     15        (-[WebPreferences requestAnimationFrameEnabled]):
     16        (-[WebPreferences setRequestAnimationFrameEnabled:]):
     17        * WebView/WebPreferencesPrivate.h:
     18        * WebView/WebView.mm:
     19        (-[WebView _preferencesChanged:]):
     20
    1212012-05-04  Jer Noble  <jer.noble@apple.com>
    222
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r115925 r116230  
    122122#define WebKitRegionBasedColumnsEnabledKey @"WebKitRegionBasedColumnsEnabled"
    123123#define WebKitShouldRespectImageOrientationKey @"WebKitShouldRespectImageOrientation"
     124#define WebKitRequestAnimationFrameEnabledPreferenceKey @"WebKitRequestAnimationFrameEnabled"
    124125
    125126// These are private both because callers should be using the cover methods and because the
  • trunk/Source/WebKit/mac/WebView/WebPreferences.mm

    r115925 r116230  
    398398        [NSNumber numberWithBool:YES],  WebKitNotificationsEnabledKey,
    399399        [NSNumber numberWithBool:NO],   WebKitShouldRespectImageOrientationKey,
     400        [NSNumber numberWithBool:YES],  WebKitRequestAnimationFrameEnabledPreferenceKey,
    400401        [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
    401402
     
    403404        [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
    404405        nil];
     406
    405407
    406408    // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
     
    16881690}
    16891691
     1692- (BOOL)requestAnimationFrameEnabled
     1693{
     1694    return [self _boolValueForKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
     1695}
     1696
     1697- (void)setRequestAnimationFrameEnabled:(BOOL)enabled
     1698{
     1699    [self _setBoolValue:enabled forKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
     1700}
     1701
    16901702- (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout
    16911703{
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r115925 r116230  
    299299- (BOOL)shouldRespectImageOrientation;
    300300
     301- (BOOL)requestAnimationFrameEnabled;
     302- (void)setRequestAnimationFrameEnabled:(BOOL)enabled;
     303
    301304- (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout;
    302305- (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds;
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r116179 r116230  
    15331533    settings->setShouldRespectImageOrientation([preferences shouldRespectImageOrientation]);
    15341534    settings->setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]);
     1535    settings->setRequestAnimationFrameEnabled([preferences requestAnimationFrameEnabled]);
    15351536   
    15361537    NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
  • trunk/Source/WebKit/win/ChangeLog

    r116121 r116230  
     12012-05-05  Dean Jackson  <dino@apple.com>
     2
     3        Add new Setting/Preference to disable requestAnimationFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=85693
     5
     6        Reviewed by Simon Fraser.
     7
     8        Exposes a new WebPreference: WebKitRequestAnimationFrameEnabled.
     9        The default value is true. The majority of applications will leave
     10        it this way.
     11
     12        * Interfaces/IWebPreferencesPrivate.idl:
     13        * WebPreferenceKeysPrivate.h:
     14        * WebPreferences.cpp:
     15        (WebPreferences::initializeDefaultSettings):
     16        (WebPreferences::setRequestAnimationFrameEnabled):
     17        (WebPreferences::requestAnimationFrameEnabled):
     18        * WebPreferences.h:
     19        (WebPreferences):
     20        * WebView.cpp:
     21        (WebView::notifyPreferencesChanged):
     22
    1232012-05-04  Nate Chapin  <japhet@chromium.org>
    224
  • trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r107603 r116230  
    143143    HRESULT setShouldInvertColors([in] BOOL);
    144144    HRESULT shouldInvertColors([out, retval] BOOL*);
     145
     146    HRESULT setRequestAnimationFrameEnabled([in] BOOL);
     147    HRESULT requestAnimationFrameEnabled([out, retval] BOOL*);
    145148}
  • trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h

    r107603 r116230  
    163163
    164164#define WebKitAVFoundationEnabledPreferenceKey "WebKitAVFoundationEnabled"
     165
     166#define WebKitRequestAnimationFrameEnabledPreferenceKey "WebKitRequestAnimationFrameEnabled"
     167
  • trunk/Source/WebKit/win/WebPreferences.cpp

    r107689 r116230  
    274274    CFDictionaryAddValue(defaults, CFSTR(WebKitMediaPlaybackAllowsInlinePreferenceKey), kCFBooleanTrue);
    275275
     276    CFDictionaryAddValue(defaults, CFSTR(WebKitRequestAnimationFrameEnabledPreferenceKey), kCFBooleanTrue);
     277
    276278    defaultSettings = defaults;
    277279}
     
    17371739#endif
    17381740}
     1741
     1742HRESULT WebPreferences::setRequestAnimationFrameEnabled(BOOL enabled)
     1743{
     1744    setBoolValue(CFSTR(WebKitRequestAnimationFrameEnabledPreferenceKey), enabled);
     1745    return S_OK;
     1746}
     1747
     1748HRESULT WebPreferences::requestAnimationFrameEnabled(BOOL* enabled)
     1749{
     1750    *enabled = boolValueForKey(CFSTR(WebKitRequestAnimationFrameEnabledPreferenceKey));
     1751    return S_OK;
     1752}
     1753
  • trunk/Source/WebKit/win/WebPreferences.h

    r107603 r116230  
    472472    virtual HRESULT STDMETHODCALLTYPE setShouldInvertColors(BOOL);
    473473
     474    virtual HRESULT STDMETHODCALLTYPE requestAnimationFrameEnabled(BOOL*);
     475    virtual HRESULT STDMETHODCALLTYPE setRequestAnimationFrameEnabled(BOOL);
     476
    474477    // WebPreferences
    475478
  • trunk/Source/WebKit/win/WebView.cpp

    r115760 r116230  
    49484948    setShouldInvertColors(enabled);
    49494949
     4950    hr = prefsPrivate->requestAnimationFrameEnabled(&enabled);
     4951    if (FAILED(hr))
     4952        return hr;
     4953    settings->setRequestAnimationFrameEnabled(enabled);
     4954
    49504955    return S_OK;
    49514956}
  • trunk/Source/WebKit2/ChangeLog

    r116226 r116230  
     12012-05-05  Dean Jackson  <dino@apple.com>
     2
     3        Add new Setting/Preference to disable requestAnimationFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=85693
     5
     6        Reviewed by Simon Fraser.
     7
     8        Exposes a new WebPreference: WebKitRequestAnimationFrameEnabled.
     9        The default value is true. The majority of applications will leave
     10        it this way.
     11
     12        * Shared/WebPreferencesStore.h:
     13        (WebKit):
     14        * UIProcess/API/C/WKPreferences.cpp:
     15        (WKPreferencesSetRequestAnimationFrameEnabled):
     16        (WKPreferencesGetRequestAnimationFrameEnabled):
     17        * UIProcess/API/C/WKPreferencesPrivate.h:
     18        * WebProcess/WebPage/WebPage.cpp:
     19        (WebKit::WebPage::updatePreferences):
     20
    1212012-05-04  Jon Lee  <jonlee@apple.com>
    222
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.h

    r115948 r116230  
    112112    macro(ShouldRespectImageOrientation, shouldRespectImageOrientation, Bool, bool, false) \
    113113    macro(WantsBalancedSetDefersLoadingBehavior, wantsBalancedSetDefersLoadingBehavior, Bool, bool, false) \
     114    macro(RequestAnimationFrameEnabled, requestAnimationFrameEnabled, Bool, bool, true) \
    114115    \
    115116
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r113486 r116230  
    789789}
    790790
     791void WKPreferencesSetRequestAnimationFrameEnabled(WKPreferencesRef preferencesRef, bool flag)
     792{
     793    toImpl(preferencesRef)->setRequestAnimationFrameEnabled(flag);
     794}
     795
     796bool WKPreferencesGetRequestAnimationFrameEnabled(WKPreferencesRef preferencesRef)
     797{
     798    return toImpl(preferencesRef)->requestAnimationFrameEnabled();
     799}
     800
    791801void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef)
    792802{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h

    r112894 r116230  
    180180WK_EXPORT bool WKPreferencesGetJavaEnabledForLocalFiles(WKPreferencesRef preferences);
    181181
     182// Defaults to true.
     183WK_EXPORT void WKPreferencesSetRequestAnimationFrameEnabled(WKPreferencesRef, bool);
     184WK_EXPORT bool WKPreferencesGetRequestAnimationFrameEnabled(WKPreferencesRef);
     185
    182186WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
    183187
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r116178 r116230  
    19671967    settings->setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
    19681968    settings->setHyperlinkAuditingEnabled(store.getBoolValueForKey(WebPreferencesKey::hyperlinkAuditingEnabledKey()));
     1969    settings->setRequestAnimationFrameEnabled(store.getBoolValueForKey(WebPreferencesKey::requestAnimationFrameEnabledKey()));
    19691970
    19701971    // <rdar://problem/10697417>: It is necessary to force compositing when accelerate drawing
Note: See TracChangeset for help on using the changeset viewer.