Throttle RequestAnimationFrame in subframes that are outside the viewport
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 06:51:55 +0000 (06:51 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 06:51:55 +0000 (06:51 +0000)
commit081ad66edb1d7d828ce396296d81e6eb37fc3217
tree458dae01e978d7ed8e90115aa8547868878f9306
parentbf65b6bdb5d7c05d37fd6aa22a3b87b9c1738488
Throttle RequestAnimationFrame in subframes that are outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=144718
<rdar://problem/20688782>

Reviewed by Simon Fraser.

Source/WebCore:

Throttle RequestAnimationFrame in subframes that are outside the
viewport or have "display: none" for performance and power.

Tests: fast/animation/request-animation-frame-throttle-subframe-display-none.html
       fast/animation/request-animation-frame-throttle-subframe.html

* dom/Document.h:
(WebCore::Document::scriptedAnimationController):
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::setThrottled):
(WebCore::ScriptedAnimationController::isThrottled):
* dom/ScriptedAnimationController.h:
* page/FrameView.cpp:
(WebCore::FrameView::viewportContentsChanged):
(WebCore::FrameView::applyRecursivelyWithVisibleRect):
(WebCore::FrameView::resumeVisibleImageAnimations):
(WebCore::FrameView::updateScriptedAnimationsThrottlingState):
(WebCore::FrameView::resumeVisibleImageAnimationsIncludingSubframes):
(WebCore::FrameView::updateThrottledDOMTimersState):
(WebCore::FrameView::scrollPositionChanged): Deleted.
(WebCore::FrameView::sendResizeEventIfNeeded): Deleted.
* page/FrameView.h:
* testing/Internals.cpp:
(WebCore::Internals::isRequestAnimationFrameThrottled):
(WebCore::Internals::isTimerThrottled): Deleted.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt: Added.
* fast/animation/request-animation-frame-throttle-subframe-display-none.html: Added.
Add layout test to test that RequestAnimationFrame is properly throttled
in "display: none" subframes.

* fast/animation/request-animation-frame-throttle-subframe-expected.txt: Added.
* fast/animation/request-animation-frame-throttle-subframe.html: Added.
Add layout test to test that RequestAnimationFrame is properly throttled
in frames that are outside the viewport.

* fast/animation/resources/requestAnimationFrame-frame-2.html: Added.
* fast/animation/resources/requestAnimationFrame-frame.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt [new file with mode: 0644]
LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none.html [new file with mode: 0644]
LayoutTests/fast/animation/request-animation-frame-throttle-subframe-expected.txt [new file with mode: 0644]
LayoutTests/fast/animation/request-animation-frame-throttle-subframe.html [new file with mode: 0644]
LayoutTests/fast/animation/resources/requestAnimationFrame-frame-2.html [new file with mode: 0644]
LayoutTests/fast/animation/resources/requestAnimationFrame-frame.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.h
Source/WebCore/dom/ScriptedAnimationController.cpp
Source/WebCore/dom/ScriptedAnimationController.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl