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

Side by Side Diff: ui/views/controls/tree/tree_view.cc

Issue 2714753002: Improve appearance of focus rings at fractional scales. (Closed)
Patch Set: no treeview update 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 unified diff | Download patch
« no previous file with comments | « ui/views/controls/slider.cc ('k') | ui/views/painter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/tree/tree_view.h" 5 #include "ui/views/controls/tree/tree_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 int arrow_dx = depth * kIndent + kHorizontalInset; 1051 int arrow_dx = depth * kIndent + kHorizontalInset;
1052 gfx::Rect arrow_bounds(bounds().x() + arrow_dx, 1052 gfx::Rect arrow_bounds(bounds().x() + arrow_dx,
1053 row * row_height_ + kVerticalInset, kArrowRegionSize, 1053 row * row_height_ + kVerticalInset, kArrowRegionSize,
1054 row_height_); 1054 row_height_);
1055 if (base::i18n::IsRTL()) 1055 if (base::i18n::IsRTL())
1056 arrow_bounds.set_x(bounds().width() - arrow_dx - kArrowRegionSize); 1056 arrow_bounds.set_x(bounds().width() - arrow_dx - kArrowRegionSize);
1057 return arrow_bounds.Contains(point); 1057 return arrow_bounds.Contains(point);
1058 } 1058 }
1059 1059
1060 void TreeView::SetHasFocusRing(bool shows) { 1060 void TreeView::SetHasFocusRing(bool shows) {
1061 if (!ui::MaterialDesignController::IsSecondaryUiMaterial() || 1061 if (/*!ui::MaterialDesignController::IsSecondaryUiMaterial() ||*/
msw 2017/02/23 19:15:13 Fix this
Evan Stade 2017/02/23 20:07:30 my bad, this is residue from the CL I split off.
1062 !PlatformStyle::kTreeViewHasFocusRing) { 1062 !PlatformStyle::kTreeViewHasFocusRing) {
1063 return; 1063 return;
1064 } 1064 }
1065 // If this View is the grandchild of a ScrollView, use the grandparent 1065 // If this View is the grandchild of a ScrollView, use the grandparent
1066 // ScrollView for the focus ring instead of this View so that the focus ring 1066 // ScrollView for the focus ring instead of this View so that the focus ring
1067 // won't be scrolled. Since ScrollViews have a single content view, which they 1067 // won't be scrolled. Since ScrollViews have a single content view, which they
1068 // wrap in a ScrollView::Viewport, being the grandchild of a ScrollView 1068 // wrap in a ScrollView::Viewport, being the grandchild of a ScrollView
1069 // implies being the sole grandchild, which means it's fine to wrap the focus 1069 // implies being the sole grandchild, which means it's fine to wrap the focus
1070 // ring around the grandparent here. 1070 // ring around the grandparent here.
1071 View* grandparent = parent() ? parent()->parent() : nullptr; 1071 View* grandparent = parent() ? parent()->parent() : nullptr;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 if (!is_expanded_) 1106 if (!is_expanded_)
1107 return max_width; 1107 return max_width;
1108 for (int i = 0; i < child_count(); ++i) { 1108 for (int i = 0; i < child_count(); ++i) {
1109 max_width = std::max(max_width, 1109 max_width = std::max(max_width,
1110 GetChild(i)->GetMaxWidth(indent, depth + 1)); 1110 GetChild(i)->GetMaxWidth(indent, depth + 1));
1111 } 1111 }
1112 return max_width; 1112 return max_width;
1113 } 1113 }
1114 1114
1115 } // namespace views 1115 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/slider.cc ('k') | ui/views/painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698