Reland "Suspend SVG image animations when the page is hidden"

Check Document::hidden() in LayoutObject::WillRenderImage,
thus pausing animations on pages that are not visible.
To resume animations, we may need to explicitly resume the
timeline, so a hook is added in Page::SetVisibilityState to
allow calling StartAnimation() on the relevant SVGImages.

Update: Added RunPendingTasks() to test to make sure the later
code is actually waiting for a proper animation frame.

Bug: 856082
Change-Id: I457fc0b92576edf7d70933373d12d49d52a0b912
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Reviewed-by: Fredrik Söderquist <>
Commit-Queue: Fredrik Söderquist <>
Cr-Commit-Position: refs/heads/master@{#571904}
7 files changed