| Index: ui/gfx/render_text.cc
|
| diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
|
| index eb2e8cf59efff1be9368ff7276313af02dd2b3d3..84306154723c31c23c6aef7b65b90530f8578e56 100644
|
| --- a/ui/gfx/render_text.cc
|
| +++ b/ui/gfx/render_text.cc
|
| @@ -852,7 +852,7 @@ void RenderText::Draw(Canvas* canvas) {
|
| canvas->ClipRect(clip_rect);
|
| }
|
|
|
| - if (!text().empty() && focused())
|
| + if (!selection().is_empty())
|
| DrawSelection(canvas);
|
|
|
| if (cursor_enabled() && cursor_visible() && focused())
|
| @@ -1062,7 +1062,8 @@ RenderText::RenderText()
|
| cursor_visible_(false),
|
| cursor_color_(kDefaultColor),
|
| selection_color_(kDefaultColor),
|
| - selection_background_focused_color_(kDefaultSelectionBackgroundColor),
|
| + selection_background_color_(kDefaultSelectionBackgroundColor),
|
| + draw_text_selection_(false),
|
| focused_(false),
|
| composition_range_(Range::InvalidRange()),
|
| colors_(kDefaultColor),
|
| @@ -1636,8 +1637,10 @@ void RenderText::UpdateCachedBoundsAndOffset() {
|
| }
|
|
|
| void RenderText::DrawSelection(Canvas* canvas) {
|
| + if (!draw_text_selection_)
|
| + return;
|
| for (const Rect& s : GetSubstringBounds(selection()))
|
| - canvas->FillRect(s, selection_background_focused_color_);
|
| + canvas->FillRect(s, selection_background_color_);
|
| }
|
|
|
| size_t RenderText::GetNearestWordStartBoundary(size_t index) const {
|
|
|