| Index: ui/views/controls/tree/tree_view.cc
|
| diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
|
| index b7918430e50b1a37e9c04d928fc15a8b67b70661..d6cfa664feb6119e3edfea537b645c8bcf2249d1 100644
|
| --- a/ui/views/controls/tree/tree_view.cc
|
| +++ b/ui/views/controls/tree/tree_view.cc
|
| @@ -44,14 +44,22 @@ static const int kTextHorizontalPadding = 2;
|
| // How much children are indented from their parent.
|
| static const int kIndent = 20;
|
|
|
| +#if defined(OS_MACOSX)
|
| +static const bool kSelectionFillsRow = true;
|
| +#else
|
| +static const bool kSelectionFillsRow = false;
|
| +#endif
|
| +
|
| // static
|
| const char TreeView::kViewClassName[] = "TreeView";
|
|
|
| namespace {
|
|
|
| -// Returns the color id for the background of selected text. |has_focus|
|
| -// indicates if the tree has focus.
|
| -ui::NativeTheme::ColorId text_background_color_id(bool has_focus) {
|
| +// Returns the color id for a row. |has_focus| indicates if the tree has focus.
|
| +ui::NativeTheme::ColorId text_background_color_id(bool is_selected_row,
|
| + bool has_focus) {
|
| + if (!is_selected_row)
|
| + return ui::NativeTheme::kColorId_TreeBackground;
|
| return has_focus ?
|
| ui::NativeTheme::kColorId_TreeSelectionBackgroundFocused :
|
| ui::NativeTheme::kColorId_TreeSelectionBackgroundUnfocused;
|
| @@ -770,6 +778,13 @@ void TreeView::PaintRow(gfx::Canvas* canvas,
|
| int depth) {
|
| gfx::Rect bounds(GetBoundsForNodeImpl(node, row, depth));
|
|
|
| + const SkColor bg_color = GetNativeTheme()->GetSystemColor(
|
| + text_background_color_id(node == selected_node_, HasFocus()));
|
| + if (kSelectionFillsRow) {
|
| + canvas->FillRect(bounds, bg_color);
|
| + bounds.set_x(depth * kIndent + kHorizontalInset);
|
| + }
|
| +
|
| if (model_->GetChildCount(node->model_node()))
|
| PaintExpandControl(canvas, bounds, node->is_expanded());
|
|
|
| @@ -797,9 +812,7 @@ void TreeView::PaintRow(gfx::Canvas* canvas,
|
| bounds.width() - text_offset_, bounds.height());
|
| if (base::i18n::IsRTL())
|
| text_bounds.set_x(bounds.x());
|
| - if (node == selected_node_) {
|
| - const SkColor bg_color = GetNativeTheme()->GetSystemColor(
|
| - text_background_color_id(HasFocus()));
|
| + if (!kSelectionFillsRow && node == selected_node_) {
|
| canvas->FillRect(text_bounds, bg_color);
|
| if (HasFocus())
|
| canvas->DrawFocusRect(text_bounds);
|
| @@ -874,10 +887,11 @@ gfx::Rect TreeView::GetBoundsForNode(InternalNode* node) {
|
| gfx::Rect TreeView::GetBoundsForNodeImpl(InternalNode* node,
|
| int row,
|
| int depth) {
|
| - gfx::Rect rect(depth * kIndent + kHorizontalInset,
|
| - row * row_height_ + kVerticalInset,
|
| - text_offset_ + node->text_width() +
|
| - kTextHorizontalPadding * 2,
|
| + int row_x = kSelectionFillsRow ? 0 : depth * kIndent + kHorizontalInset;
|
| + int row_width = kSelectionFillsRow ? width() : text_offset_ +
|
| + node->text_width() +
|
| + kTextHorizontalPadding * 2;
|
| + gfx::Rect rect(row_x, row * row_height_ + kVerticalInset, row_width,
|
| row_height_);
|
| rect.set_x(GetMirroredXWithWidthInView(rect.x(), rect.width()));
|
| return rect;
|
|
|