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

Unified Diff: ui/views/controls/scroll_view.cc

Issue 2411693002: views: add focus ring to TreeView (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/controls/tree/tree_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scroll_view.cc
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc
index 68ee68fee3eaa8561e097be266a8ec202f448155..a358128a5a8d73940bde2ebf762cc8c0d123dab6 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -12,6 +12,7 @@
#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
+#include "ui/views/controls/focus_ring.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/widget/widget.h"
@@ -271,6 +272,18 @@ void ScrollView::SetVerticalScrollBar(ScrollBar* vert_sb) {
vert_sb_ = vert_sb;
}
+void ScrollView::SetHasFocusRing(bool has_focus_ring) {
+ if (has_focus_ring == (focus_ring_ != nullptr))
+ return;
+ if (has_focus_ring) {
+ focus_ring_ = FocusRing::Install(this);
+ } else {
+ FocusRing::Uninstall(this);
+ focus_ring_ = nullptr;
+ }
+ SchedulePaint();
+}
+
gfx::Size ScrollView::GetPreferredSize() const {
if (!is_bounded())
return View::GetPreferredSize();
@@ -294,6 +307,9 @@ int ScrollView::GetHeightForWidth(int width) const {
}
void ScrollView::Layout() {
+ if (focus_ring_)
+ focus_ring_->Layout();
+
gfx::Rect available_rect = GetContentsBounds();
if (is_bounded()) {
int content_width = available_rect.width();
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/controls/tree/tree_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698