Composition underline color is always black
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2017 06:31:35 +0000 (06:31 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2017 06:31:35 +0000 (06:31 +0000)
commit3395a5a98499fae76540003725ef531097fcbfed
tree9a840e4e08f8ea1e616ff31fdca8ad086495be40
parentb49befb978c502114a6cf95536be90420985fad5
Composition underline color is always black
https://bugs.webkit.org/show_bug.cgi?id=174675

Reviewed by Ryosuke Niwa.

Source/WebCore:

This patch uses the current color of the text instead of black
for the composition underline marker.
This makes it visible in the case we have a black/dark background.

Test: editing/composition-underline-color.html

* editing/CompositionUnderline.h:
(WebCore::CompositionUnderline::CompositionUnderline):
Added new attribute compositionUnderlineColor.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintCompositionUnderline):
Use the text color if compositionUnderlineColor is TextColor.

Source/WebKit:

This patch uses the current color of the text instead of black
for the composition underline marker.
This makes it visible in the case we have a black/dark background.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::extractUnderlines): If NSUnderlineColorAttributeName
is not present use text color for composition underline.
(WebKit::WebViewImpl::setMarkedText): Use text color
for composition underline in the plain text case.
* UIProcess/gtk/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::handleKeyboardEventWithCompositionResults):
Use text color for composition underline.
(WebKit::InputMethodFilter::updatePreedit): Ditto.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setCompositionForTesting): Ditto.

Source/WebKitLegacy/mac:

* WebView/WebHTMLView.mm:
(extractUnderlines): If NSUnderlineColorAttributeName
is not present use text color for composition underline.
(-[WebHTMLView setMarkedText:selectedRange:]): Use text color
for composition underline in the plain text case.

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::setCompositionForTesting): Use text color for
composition underline.

LayoutTests:

Added new test to check that the composition underline
is using the text color.
The test hides the text and the caret, so it only shows
the composition underline and checks against an -expected-mismatch
that the color of the composition marker is different.

* editing/composition-underline-color-expected-mismatch.html: Added.
* editing/composition-underline-color.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/composition-underline-color-expected-mismatch.html [new file with mode: 0644]
LayoutTests/editing/composition-underline-color.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/CompositionUnderline.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/gtk/InputMethodFilter.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebView.cpp