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:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::open):
Call FrameView::setFrameRect() only *after* the view has been
set on the Frame. Otherwise, setFrameRect() ends up calling
viewportContentsChanged() and we hit the
ASSERT(frame().view() == this) assertion in windowClipRect()
because the Frame still has its old FrameView. This is covered
by loader/go-back-to-different-window-size.html layout test.
* 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.
* platform/win/TestExpectations:
Skip the 2 new tests on Windows as requestAnimationFrame throttling is
only supported on Cocoa.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183998
268f45cc-cd09-0410-ab3c-
d52691b4dbfc