Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 702c47ccd9244a4f95caddb607cdb2b638c0fa77
      
https://github.com/WebKit/WebKit/commit/702c47ccd9244a4f95caddb607cdb2b638c0fa77
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2025-12-04 (Thu, 04 Dec 2025)

  Changed paths:
    M LayoutTests/platform/mac-wk1/TestExpectations
    A LayoutTests/svg/custom/resources/light-dark-red-green.svg
    A LayoutTests/svg/custom/resources/prefers-color-scheme-dark-red-green.svg
    A LayoutTests/svg/custom/svg-image-dark-mode-dynamic-expected.html
    A LayoutTests/svg/custom/svg-image-dark-mode-dynamic.html
    A LayoutTests/svg/custom/svg-image-dark-mode-initial-expected.html
    A LayoutTests/svg/custom/svg-image-dark-mode-initial.html
    M Source/WebCore/loader/cache/CachedImage.cpp
    M Source/WebCore/loader/cache/CachedImage.h
    M Source/WebCore/loader/cache/CachedImageClient.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/platform/graphics/ImageObserver.h
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderObject.cpp
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/svg/graphics/SVGImage.cpp

  Log Message:
  -----------
  Dark mode does not work in SVGImages
https://bugs.webkit.org/show_bug.cgi?id=283489
rdar://140661763

Reviewed by Simon Fraser.

Page::useColorAppearance() is not propagated to the Page of the SVGImage when it
is first created. To fix this issue, SVGImage will query the container Page
useSystemDarkAppearance() through the ImageObserver and set it in its Page.

Also if the dark mode changes after the SVGImage is loaded, the SVGImage does 
not
recalculate its style colors. To sync the setUseColorAppearance() of all the
SVGImages when the system appearance changes, Page::setUseColorAppearance() 
needs
to scan all the SVGImages in all Documents and call setUseColorAppearance() of
the Pages of these Documents.

* LayoutTests/platform/mac-wk1/TestExpectations:
* LayoutTests/svg/custom/resources/light-dark-red-green.svg: Added.
* LayoutTests/svg/custom/resources/prefers-color-scheme-dark-red-green.svg: 
Added.
* LayoutTests/svg/custom/svg-image-dark-mode-dynamic-expected.html: Added.
* LayoutTests/svg/custom/svg-image-dark-mode-dynamic.html: Added.
* LayoutTests/svg/custom/svg-image-dark-mode-initial-expected.html: Added.
* LayoutTests/svg/custom/svg-image-dark-mode-initial.html: Added.
* Source/WebCore/loader/cache/CachedImage.cpp:
(WebCore::CachedImage::useSystemDarkAppearance const):
* Source/WebCore/loader/cache/CachedImage.h:
* Source/WebCore/loader/cache/CachedImageClient.h:
(WebCore::CachedImageClient::useSystemDarkAppearance const):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::setUseColorAppearance):
* Source/WebCore/platform/graphics/ImageObserver.h:
(WebCore::ImageObserver::useSystemDarkAppearance const):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::useSystemDarkAppearance const):
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::CachedImageListener::useSystemDarkAppearance const):
* Source/WebCore/rendering/RenderObject.h:
(WebCore::RenderObject::useSystemDarkAppearance const):
* Source/WebCore/svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Canonical link: https://commits.webkit.org/303920@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to