-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AX: Avoid work in BitmapImage::canAnimate if animation controls are d…
…isabled https://bugs.webkit.org/show_bug.cgi?id=270136 rdar://109646792 Reviewed by Tyler Wilcock. Before this patch, the expensive work that happens in BitmapImage::canAnimate would unnecessarily occur in two cases: (1) if the image has a single-frame and (2) if image animation controls were not enabled. This patch exits early from this code path if either of those two things are true. This will improve performance for users both with and without the controls enabled. Moving `systemAllowsAnimationControls` to a static global variable on `Image` also allows us to remove the method of the same name from `Page`, since this does not need to be a per-page setting. An API test had to be updated so that we invoke `Image::setSystemAllowsImageAnimation` via Internals::setImageAnimationEnabled. This is part one of related work. In a follow up, performance issues for computing canAnimate when animation controls are enabled will be addressed. * Source/WebCore/loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImageObserver::allowsAnimation const): (WebCore::CachedImage::allowsAnimation const): * Source/WebCore/page/ContextMenuController.cpp: (WebCore::ContextMenuController::populate): * Source/WebCore/page/Page.cpp: (WebCore::Page::setImageAnimationEnabled): (WebCore::Page::setSystemAllowsAnimationControls): Deleted. * Source/WebCore/page/Page.h: (WebCore::Page::imageAnimationEnabled const): (WebCore::Page::systemAllowsAnimationControls const): Deleted. * Source/WebCore/platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::canAnimate const): * Source/WebCore/platform/graphics/Image.cpp: (WebCore::Image::setSystemAllowsAnimationControls): * Source/WebCore/platform/graphics/Image.h: (WebCore::Image::systemAllowsAnimationControls): * Source/WebCore/testing/Internals.cpp: (WebCore::Internals::setImageAnimationEnabled): * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateImageAnimationEnabled): * Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updatePageAccessibilitySettings): * Tools/TestWebKitAPI/Tests/WebKit/AnimationControl.mm: (TEST): Canonical link: https://commits.webkit.org/275563@main
- Loading branch information
1 parent
9ab0a13
commit 1d7be2a
Showing
11 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters