Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: ui/views/controls/tree/tree_view.cc

Issue 2715813002: Change focus indicator for TableView and TreeView. (Closed)
Patch Set: commit the treeview change Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7e964f96c66ea799acd3547c60ee57475be07fbd..0d6173ee6adf6258747178c2cf1aa6b9c68625a0 100644
--- a/ui/views/controls/tree/tree_view.cc
+++ b/ui/views/controls/tree/tree_view.cc
@@ -807,8 +807,6 @@ void TreeView::PaintRow(gfx::Canvas* canvas,
if (!PlatformStyle::kTreeViewSelectionPaintsEntireRow &&
node == selected_node_) {
canvas->FillRect(text_bounds, selected_row_bg_color);
- if (HasFocus())
- canvas->DrawFocusRect(text_bounds);
}
// Paint the text.
@@ -1058,19 +1056,12 @@ bool TreeView::IsPointInExpandControl(InternalNode* node,
}
void TreeView::SetHasFocusRing(bool shows) {
- if (!ui::MaterialDesignController::IsSecondaryUiMaterial() ||
- !PlatformStyle::kTreeViewHasFocusRing) {
- return;
- }
// If this View is the grandchild of a ScrollView, use the grandparent
// ScrollView for the focus ring instead of this View so that the focus ring
- // won't be scrolled. Since ScrollViews have a single content view, which they
- // wrap in a ScrollView::Viewport, being the grandchild of a ScrollView
- // implies being the sole grandchild, which means it's fine to wrap the focus
- // ring around the grandparent here.
- View* grandparent = parent() ? parent()->parent() : nullptr;
- if (grandparent && grandparent->GetClassName() == ScrollView::kViewClassName)
- static_cast<ScrollView*>(grandparent)->SetHasFocusRing(shows);
+ // won't be scrolled.
+ ScrollView* scroll_view = ScrollView::GetScrollViewForContents(this);
+ if (scroll_view)
+ scroll_view->SetHasFocusRing(shows);
}
// InternalNode ----------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698