[webkit-changes] [WebKit/WebKit] 7fe2f3: Adopt UIExtendedTextInputTraits and -[UIAsyncTextI...

Wenson Hsieh noreply at github.com
Thu Nov 16 16:39:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7fe2f32f2d486d5a1a92e0095b108bede6790568
      https://github.com/WebKit/WebKit/commit/7fe2f32f2d486d5a1a92e0095b108bede6790568
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    A Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h
    A Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  Adopt UIExtendedTextInputTraits and -[UIAsyncTextInput extendedTraitsDelegate]
https://bugs.webkit.org/show_bug.cgi?id=264977
rdar://118526529

Reviewed by Tim Horton.

Adopt the new `UIExtendedTextInputTraits` protocol (which offers additional properties in addition
to the existing API properties on `UITextInputTraits`); this is passed from WebKit to UIKit via a
new `UIAsyncTextInput` delegate method, `-extendedTraitsDelegate`.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:

Rename the existing `_traits` object (a concrete `UITextInputTraits` object) to
`_legacyTextInputTraits`, and introduce a new `_extendedTextInputTraits` object, which is returned
from the new `UIAsyncTextInput` delegate method.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateTextInputTraitsForInteractionTintColor]):
(-[WKContentView tintColorDidChange]):
(-[WKContentView textInputTraits]):
(-[WKContentView textInputTraitsForWebView]):
(-[WKContentView _updateTextInputTraits:]):
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
(-[WKContentView extendedTraitsDelegate]):
(-[WKContentView _updateInteractionTintColor:]): Deleted.

Update this to set colors on either `_extendedTextInputTraits` or `_legacyTextInputTraits`, instead
of having the caller pass in the traits object. This is only ever used to update the currently
cached traits object, so there's no change in behavior here.

* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h: Added.
* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.mm: Added.
(WebKit::defaultInsertionPointColor):
(WebKit::defaultSelectionGrabberColor):
(WebKit::defaultSelectionHighlightColor):
(-[WKExtendedTextInputTraits setTextContentType:]):
(-[WKExtendedTextInputTraits textContentType]):
(-[WKExtendedTextInputTraits setInsertionPointColor:]):
(-[WKExtendedTextInputTraits insertionPointColor]):
(-[WKExtendedTextInputTraits setSelectionBarColor:]):
(-[WKExtendedTextInputTraits selectionBarColor]):
(-[WKExtendedTextInputTraits setSelectionHighlightColor:]):
(-[WKExtendedTextInputTraits selectionHighlightColor]):
(-[WKExtendedTextInputTraits setSelectionColorsToMatchTintColor:]):

Add a new concrete implementation of `UIExtendedTextInputTraits` that's instantiated in WebKit and
returned via `-[UIAsyncTextInput extendedTraitsDelegate]`. This also eliminates use of another SPI
method, `-_setColorsToMatchTintColor:`, albeit at the cost of hard-coding some system colors related
to text interaction.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

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




More information about the webkit-changes mailing list