[webkit-changes] [WebKit/WebKit] 80d228: REGRESSION (255095 at main): [iOS] 'caret-color: auto...

Aditya Keerthi noreply at github.com
Thu Nov 3 11:20:45 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 80d228d483a602d40fa685f4b54325ccf2fc343e
      https://github.com/WebKit/WebKit/commit/80d228d483a602d40fa685f4b54325ccf2fc343e
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2022-11-03 (Thu, 03 Nov 2022)

  Changed paths:
    A LayoutTests/editing/caret/ios/caret-color-auto-expected.txt
    A LayoutTests/editing/caret/ios/caret-color-auto.html
    A LayoutTests/editing/caret/ios/caret-color-currentcolor-expected.txt
    A LayoutTests/editing/caret/ios/caret-color-currentcolor.html
    M Source/WebCore/editing/FrameSelection.cpp

  Log Message:
  -----------
  REGRESSION (255095 at main): [iOS] 'caret-color: auto' displays a black caret color
https://bugs.webkit.org/show_bug.cgi?id=247382
rdar://101579150

Reviewed by Wenson Hsieh.

On iOS, the caret is drawn in the UIProcess, and the caret color is set using
post-layout data on EditorState. The system default caret color is used whenever
the Color is invalid.

Prior to 255095 at main, `RenderStyle::caretColor()` returned a Color, rather than
a StyleColor, and 'currentcolor' was represented using an invalid Color. The
initial value of caret color was the invalid Color, meaning that if no caret
color was specified by the author, or a value of 'currentcolor' was specified,
the system default caret color would be used.

Now that `RenderStyle::caretColor()` returns a StyleColor rather than a Color,
it must be resolved prior to its use. StyleColor is only aware of 'currentcolor',
absolute colors, and system colors. Since there is no "invalid" StyleColor, the
initial value is `StyleColor::currentColor()`. This color is then resolved to
the value of the element's color property, which is commonly black ('CanvasText' in
light mode). The UIProcess always receives a valid Color in the post-layout data,
and does not use the system default caret color.

To fix, return an invalid color when 'caret-color: auto' is specified. This
ensures the UIProcess will prefer the system default caret color. Additionally,
this solution preserves an improvement introduced by 255095 at main, which is that
explicitly specifying "caret-color: currentcolor" will customize the caret color.

* LayoutTests/editing/caret/ios/caret-color-auto-expected.txt: Added.
* LayoutTests/editing/caret/ios/caret-color-auto.html: Added.
* LayoutTests/editing/caret/ios/caret-color-currentcolor-expected.txt: Added.
* LayoutTests/editing/caret/ios/caret-color-currentcolor.html: Added.
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::CaretBase::computeCaretColor):

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




More information about the webkit-changes mailing list