[webkit-changes] [WebKit/WebKit] b199f7: [Mac Catalyst] Adjust autocorrection underline col...

Aditya Keerthi noreply at github.com
Tue May 9 15:06:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b199f7db6bc8daa14464c22f44e3d70845e791f7
      https://github.com/WebKit/WebKit/commit/b199f7db6bc8daa14464c22f44e3d70845e791f7
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/RenderThemeCocoa.h
    M Source/WebCore/rendering/RenderThemeCocoa.mm
    M Source/WebCore/rendering/RenderThemeIOS.h
    M Source/WebCore/rendering/RenderThemeIOS.mm
    M Source/WebCore/rendering/TextBoxPainter.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [Mac Catalyst] Adjust autocorrection underline color based on caret color
https://bugs.webkit.org/show_bug.cgi?id=256475
rdar://108355409

Reviewed by Wenson Hsieh.

The autocorrection underline color should be a variant of the current caret
color. In order to facilitate this, the insertion point color is plumbed from
the UI Process into the Web Process.

* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::autocorrectionReplacementMarkerColor const):
(WebCore::RenderTheme::documentMarkerLineColor const):
* Source/WebCore/rendering/RenderTheme.h:

Add a `RenderText` parameter to `documentMarkerLineColor`, since it is
necessary to determine the caret color.

* Source/WebCore/rendering/RenderThemeCocoa.h:
* Source/WebCore/rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::platformAutocorrectionReplacementMarkerColor const): Deleted.

Remove override, as the color is too dynamic to be cached. `caret-color` can
differ per-element, so the autocorrection underline color can no longer be cached.

* Source/WebCore/rendering/RenderThemeIOS.h:

Add a static method to set the insertion point color to avoid unnecessary
initialization of the singleton.

* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::cachedInsertionPointColor):
(WebCore::RenderThemeIOS::insertionPointColor):
(WebCore::RenderThemeIOS::autocorrectionReplacementMarkerColor const):

Adjust the autocorrection underline color based on the current caret color. If
`caret-color` is `auto`, use the default color from the UI process. The
adjustment is performed using the HSL colorspace, matching UIKit.

(WebCore::RenderThemeIOS::setInsertionPointColor):
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter<TextBoxPath>::paintPlatformDocumentMarker):
* Source/WebKit/Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _insertionPointColor]):

Get the insertion point color from the text input traits if it exists. Otherwise,
use the default color specified in UIKit.

* Source/WebKit/UIProcess/PageClient.h:

Add a `PageClient` hook to get the insertion point color.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::insertionPointColor):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView tintColorDidChange]):

Ensure the insertion point color is up-to-date, following changes to the view's
tint color.

* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::insertionPointColorDidChange):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformInitialize):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setInsertionPointColor):

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




More information about the webkit-changes mailing list