Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a42bf61dfe36584d85b7a1ac6265ad32f2835bc
      
https://github.com/WebKit/WebKit/commit/4a42bf61dfe36584d85b7a1ac6265ad32f2835bc
  Author: Aditya Keerthi <akeer...@apple.com>
  Date:   2025-08-20 (Wed, 20 Aug 2025)

  Changed paths:
    M Source/WebCore/page/writing-tools/WritingToolsController.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

  Log Message:
  -----------
  REGRESSION (iOS 26): Smart Reply text is black when in dark mode
https://bugs.webkit.org/show_bug.cgi?id=297602
rdar://157514394

Reviewed by Abrar Rahman Protyasha and Richard Robinson.

In iOS 26, Mail removed their use of `-apple-color-filter: 
apple-invert-lightness()`
in cases where the content explicitly supports dark mode. This change broke
smart replies, which are currently always inserted with a black text color
specified in inline style. When the color filter was present, the black text
would become white.

A black text color is specified in inline style because the attributed string
provided by Writing Tools does not have a text color, and markup sanitization
introduces inline style. The context attributed string given to Writing Tools
also does not contain text color information. However, even after adding color
information at context retrieval time, Writing Tools does not preserve the 
color.
The lack of color preservation is specific to Smart Reply and not other 
compositions.

Consequently, fix the issue by updating the attributed string *returned* from
Writing Tools use the body's text color. When the markup is inserted into the
document, the inline style will be removed due to deduplication.

* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::attributedStringApplyingBodyTextColorIfNecessary):

Don't apply a text color if one is specified.

(WebCore::WritingToolsController::replaceContentsOfRangeInSession):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, SmartRepliesTextColor)):
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView forceLightMode]):

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



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

Reply via email to