[webkit-changes] [WebKit/WebKit] a2cbeb: SVG animations should respect Page::imageAnimation...
Tyler Wilcock
noreply at github.com
Fri Oct 28 17:18:26 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a2cbeb35dc5185e2c7f501cc19db8deea5e7de8f
https://github.com/WebKit/WebKit/commit/a2cbeb35dc5185e2c7f501cc19db8deea5e7de8f
Author: Tyler Wilcock <tyler_w at apple.com>
Date: 2022-10-28 (Fri, 28 Oct 2022)
Changed paths:
A LayoutTests/fast/images/pagewide-play-pause-animateTransform-svg-animation-expected.txt
A LayoutTests/fast/images/pagewide-play-pause-animateTransform-svg-animation.html
A LayoutTests/fast/images/pagewide-play-pause-offscreen-animations-expected.txt
A LayoutTests/fast/images/pagewide-play-pause-offscreen-animations.html
M LayoutTests/platform/mac-wk1/TestExpectations
M Source/WebCore/page/FrameView.cpp
M Source/WebCore/page/FrameView.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/rendering/RenderElement.cpp
M Source/WebCore/rendering/RenderView.cpp
M Source/WebCore/rendering/RenderView.h
M Source/WebCore/svg/SVGDocumentExtensions.cpp
M Source/WebCore/svg/SVGDocumentExtensions.h
M Source/WebCore/svg/SVGSVGElement.cpp
M Source/WebCore/svg/SVGSVGElement.h
M Source/WebCore/svg/graphics/SVGImage.cpp
M Source/WebCore/svg/graphics/SVGImage.h
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
Log Message:
-----------
SVG animations should respect Page::imageAnimationEnabled
https://bugs.webkit.org/show_bug.cgi?id=245399
rdar://100143723
Reviewed by Chris Fleizach.
In https://bugs.webkit.org/show_bug.cgi?id=244128 (Add experimental
feature to control image animation play/pause state), we added a
page-wide setting to control animation play/pause state. SVG
animations should respect this setting too.
This patch also fixes a bug where re-enabling page-wide animation did
not cause animations offscreen during the setting change to be
resumed when they later became visible in the viewport (instead, they
remained permanently paused).
* LayoutTests/fast/images/pagewide-play-pause-animateTransform-svg-animation-expected.txt: Added.
* LayoutTests/fast/images/pagewide-play-pause-animateTransform-svg-animation.html: Added.
* LayoutTests/fast/images/pagewide-play-pause-offscreen-animations-expected.txt: Added.
* LayoutTests/fast/images/pagewide-play-pause-offscreen-animations.html: Added.
* LayoutTests/platform/mac-wk1/TestExpectations:
Skip new pagewide-play-pause-offscreen-animations.html test due to differences in animation and
viewport behavior in WK1 / DumpRenderTree.
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::updatePlayStateForAllAnimations):
(WebCore::FrameView::updatePlayStateForAllAnimationsIncludingSubframes):
(WebCore::FrameView::repaintVisibleImageAnimations): Deleted.
(WebCore::FrameView::repaintVisibleImageAnimationsIncludingSubframes): Deleted.
* Source/WebCore/page/FrameView.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::setImageAnimationEnabled):
(WebCore::Page::updatePlayStateForAllAnimations):
(WebCore::Page::repaintAnimatedImages): Deleted.
* Source/WebCore/page/Page.h:
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::resumePausedImageAnimationsIfNeeded):
Check new m_SVGSVGElementsWithPausedImageAnimation member for paused SVG
animations and resume them if needed.
(WebCore::svgSvgElementFrom): Added.
(WebCore::RenderView::updatePlayStateForAllAnimations):
(WebCore::RenderView::repaintImageAnimationsIfNeeded): Deleted.
All methods added in https://bugs.webkit.org/show_bug.cgi?id=244128 and
named like "repaintImageAnimationsIfNeeded" are renamed to updatePlayStateForAllAnimations,
since these methods now do more than repaints (because SVG animations have explicit resume / pause methods).
* Source/WebCore/rendering/RenderView.h:
Add new m_SVGSVGElementsWithPausedImageAnimation member. This allows us
to keep track of the paused SVG animations so that we can resume them as
they become visible in the viewport, similar to m_renderersWithPausedImageAnimation.
* Source/WebCore/svg/SVGDocumentExtensions.cpp:
(WebCore::animationsPausedForDocument): Added.
(WebCore::SVGDocumentExtensions::SVGDocumentExtensions):
(WebCore::SVGDocumentExtensions::allSVGSVGElements const): Added.
* Source/WebCore/svg/SVGDocumentExtensions.h:
* Source/WebCore/svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::resumePausedAnimationsIfNeeded): Added.
* Source/WebCore/svg/SVGSVGElement.h:
* Source/WebCore/svg/graphics/SVGImage.cpp:
* Source/WebCore/svg/graphics/SVGImage.h:
(WebCore::SVGImage::resumeAnimation):
Added. Different from SVGImage::startAnimation in that it starts the
animation from where it last left off rather than from the beginning.
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::allSVGSVGElements const): Added.
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
Canonical link: https://commits.webkit.org/256122@main
More information about the webkit-changes
mailing list