Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1d7be2a5f983adaea21751f2574e6058066662cd
      
https://github.com/WebKit/WebKit/commit/1d7be2a5f983adaea21751f2574e6058066662cd
  Author: Joshua Hoffman <[email protected]>
  Date:   2024-03-01 (Fri, 01 Mar 2024)

  Changed paths:
    M Source/WebCore/loader/cache/CachedImage.cpp
    M Source/WebCore/page/ContextMenuController.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/platform/graphics/BitmapImage.cpp
    M Source/WebCore/platform/graphics/Image.cpp
    M Source/WebCore/platform/graphics/Image.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKit/AnimationControl.mm

  Log Message:
  -----------
  AX: Avoid work in BitmapImage::canAnimate if animation controls are disabled
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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to