Commit 1053faaf authored by rlanday's avatar rlanday Committed by Commit Bot

Show selection highlight even if we have a composition underline

We currently have some logic (dating back to 2005) to not show the selection
highlight if we're also showing a composition underline. We're not 100% sure
why this (probably to avoid some sort of interaction between the selection
color and the underline), but we think it's unnecessary. There are already
certain interactions we don't do anything about, for example the composition
underline matching the background color of the text.

This CL removes this logic so we can show the selection highlight while the
Android Voice IME (which keeps an underlined composition range open) is
active.

BUG=628670
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2896273003
Cr-Commit-Position: refs/heads/master@{#476178}
parent 2553f281
<!DOCTYPE html>
<html>
<head>
<script>
function runTest() {
if (!window.testRunner)
return;
var input = document.getElementById('test');
input.focus();
textInputController.setComposition('Hello, world!');
input.selectionStart = 0;
input.selectionEnd = 13;
}
</script>
</head>
<body onload="runTest()">
<input id="test" />
</body>
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x38
LayoutBlockFlow {HTML} at (0,0) size 800x38
LayoutBlockFlow {BODY} at (8,8) size 784x22
LayoutTextControl {INPUT} at (0,0) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (10,11) size 150x16
LayoutBlockFlow {DIV} at (2,3) size 150x16
LayoutText {#text} at (0,0) size 71x16
text run at (0,0) width 71: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x38
LayoutBlockFlow {HTML} at (0,0) size 800x38
LayoutBlockFlow {BODY} at (8,8) size 784x22
LayoutTextControl {INPUT} at (0,0) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (10,11) size 150x16
LayoutBlockFlow {DIV} at (2,3) size 150x16
LayoutText {#text} at (0,0) size 71x16
text run at (0,0) width 71: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 63x13
text run at (0,0) width 63: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 63x13
text run at (0,0) width 63: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 65x13
text run at (0,0) width 65: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 65x13
text run at (0,0) width 65: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 123x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 117x13
LayoutBlockFlow {DIV} at (3,3) size 117x13
LayoutText {#text} at (0,0) size 68x13
text run at (0,0) width 68: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 123x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 117x13
LayoutBlockFlow {DIV} at (3,3) size 117x13
LayoutText {#text} at (0,0) size 68x13
text run at (0,0) width 68: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 65x13
text run at (0,0) width 65: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 65x13
text run at (0,0) width 65: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 66x13
text run at (0,0) width 66: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x35
LayoutBlockFlow {HTML} at (0,0) size 800x35
LayoutBlockFlow {BODY} at (8,8) size 784x19
LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (11,11) size 125x13
LayoutBlockFlow {DIV} at (3,3) size 125x13
LayoutText {#text} at (0,0) size 66x13
text run at (0,0) width 66: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x38
LayoutBlockFlow {HTML} at (0,0) size 800x38
LayoutBlockFlow {BODY} at (8,8) size 784x22
LayoutTextControl {INPUT} at (0,0) size 173x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (10,11) size 169x16
LayoutBlockFlow {DIV} at (2,3) size 169x16
LayoutText {#text} at (0,0) size 70x16
text run at (0,0) width 70: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x38
LayoutBlockFlow {HTML} at (0,0) size 800x38
LayoutBlockFlow {BODY} at (8,8) size 784x22
LayoutTextControl {INPUT} at (0,0) size 173x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
LayoutText {#text} at (0,0) size 0x0
layer at (10,11) size 169x16
LayoutBlockFlow {DIV} at (2,3) size 169x16
LayoutText {#text} at (0,0) size 70x16
text run at (0,0) width 70: "Hello, world!"
selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
selection end: position 13 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
...@@ -152,15 +152,6 @@ bool InlineTextBoxPainter::PaintsMarkerHighlights( ...@@ -152,15 +152,6 @@ bool InlineTextBoxPainter::PaintsMarkerHighlights(
layout_object.GetNode()); layout_object.GetNode());
} }
static bool PaintsCompositionMarkers(const LayoutObject& layout_object) {
return layout_object.GetNode() &&
layout_object.GetDocument()
.Markers()
.MarkersFor(layout_object.GetNode(),
DocumentMarker::kComposition)
.size() > 0;
}
static void PrepareContextForDecoration( static void PrepareContextForDecoration(
GraphicsContext& context, GraphicsContext& context,
GraphicsContextStateSaver& state_saver, GraphicsContextStateSaver& state_saver,
...@@ -400,9 +391,7 @@ void InlineTextBoxPainter::Paint(const PaintInfo& paint_info, ...@@ -400,9 +391,7 @@ void InlineTextBoxPainter::Paint(const PaintInfo& paint_info,
paint_info.phase != kPaintPhaseTextClip && !is_printing) { paint_info.phase != kPaintPhaseTextClip && !is_printing) {
PaintDocumentMarkers(paint_info, box_origin, style_to_use, font, PaintDocumentMarkers(paint_info, box_origin, style_to_use, font,
DocumentMarkerPaintPhase::kBackground); DocumentMarkerPaintPhase::kBackground);
if (have_selection) {
const LayoutObject& text_box_layout_object = InlineLayoutObject();
if (have_selection && !PaintsCompositionMarkers(text_box_layout_object)) {
if (combined_text) if (combined_text)
PaintSelection<InlineTextBoxPainter::PaintOptions::kCombinedText>( PaintSelection<InlineTextBoxPainter::PaintOptions::kCombinedText>(
context, box_rect, style_to_use, font, selection_style.fill_color, context, box_rect, style_to_use, font, selection_style.fill_color,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment