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

Unified Diff: ui/views/controls/scrollbar/base_scroll_bar.cc

Issue 2535943002: Fix event targeting for overlay scrollbar thumbs (in native UI). (Closed)
Patch Set: Created 4 years, 1 month 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/scrollbar/base_scroll_bar.h ('k') | ui/views/controls/scrollbar/cocoa_scroll_bar.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scrollbar/base_scroll_bar.cc
diff --git a/ui/views/controls/scrollbar/base_scroll_bar.cc b/ui/views/controls/scrollbar/base_scroll_bar.cc
index 232aa1a26b6613e5460c4cdf5932cb7624ea854b..123e59c24cc2b1198778229773d44559ca8bc569 100644
--- a/ui/views/controls/scrollbar/base_scroll_bar.cc
+++ b/ui/views/controls/scrollbar/base_scroll_bar.cc
@@ -32,9 +32,9 @@ namespace views {
///////////////////////////////////////////////////////////////////////////////
// BaseScrollBar, public:
-BaseScrollBar::BaseScrollBar(bool horizontal, BaseScrollBarThumb* thumb)
+BaseScrollBar::BaseScrollBar(bool horizontal)
: ScrollBar(horizontal),
- thumb_(thumb),
+ thumb_(nullptr),
contents_size_(0),
contents_scroll_offset_(0),
viewport_size_(0),
@@ -42,10 +42,16 @@ BaseScrollBar::BaseScrollBar(bool horizontal, BaseScrollBarThumb* thumb)
repeater_(base::Bind(&BaseScrollBar::TrackClicked,
base::Unretained(this))),
context_menu_mouse_position_(0) {
- AddChildView(thumb_);
-
set_context_menu_controller(this);
- thumb_->set_context_menu_controller(this);
+}
+
+BaseScrollBar::~BaseScrollBar() {}
+
+void BaseScrollBar::SetThumb(BaseScrollBarThumb* thumb) {
+ DCHECK(!thumb_);
+ thumb_ = thumb;
+ AddChildView(thumb);
+ thumb->set_context_menu_controller(this);
}
void BaseScrollBar::ScrollByAmount(ScrollAmount amount) {
@@ -80,9 +86,6 @@ void BaseScrollBar::ScrollByAmount(ScrollAmount amount) {
ScrollContentsToOffset();
}
-BaseScrollBar::~BaseScrollBar() {
-}
-
void BaseScrollBar::ScrollToThumbPosition(int thumb_position,
bool scroll_to_middle) {
contents_scroll_offset_ =
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar.h ('k') | ui/views/controls/scrollbar/cocoa_scroll_bar.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698