Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 80d228d. rdar://problem/102218556
REGRESSION (255095@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@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@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 Canonical link: https://commits.webkit.org/256138.44@safari-7615.1.12-branch
- Loading branch information