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

Side by Side Diff: ui/views/controls/scrollbar/base_scroll_bar.h

Issue 1769553003: Guard against division by zero for useless scroll bars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | ui/views/controls/scrollbar/base_scroll_bar.cc » ('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 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/views/animation/scroll_animator.h" 10 #include "ui/views/animation/scroll_animator.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Wrapper functions that calls the controller. We need this since native 108 // Wrapper functions that calls the controller. We need this since native
109 // scrollbars wrap around a different scrollbar. When calling the controller 109 // scrollbars wrap around a different scrollbar. When calling the controller
110 // we need to pass in the appropriate scrollbar. For normal scrollbars it's 110 // we need to pass in the appropriate scrollbar. For normal scrollbars it's
111 // the |this| scrollbar, for native scrollbars it's the native scrollbar used 111 // the |this| scrollbar, for native scrollbars it's the native scrollbar used
112 // to create this. 112 // to create this.
113 virtual void ScrollToPosition(int position); 113 virtual void ScrollToPosition(int position);
114 virtual int GetScrollIncrement(bool is_page, bool is_positive); 114 virtual int GetScrollIncrement(bool is_page, bool is_positive);
115 115
116 private: 116 private:
117 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ScrollBarFitsToBottom); 117 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ScrollBarFitsToBottom);
118 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ThumbFullLengthOfTrack);
118 int GetThumbSizeForTest(); 119 int GetThumbSizeForTest();
119 120
120 // Changes to 'pushed' state and starts a timer to scroll repeatedly. 121 // Changes to 'pushed' state and starts a timer to scroll repeatedly.
121 void ProcessPressEvent(const ui::LocatedEvent& event); 122 void ProcessPressEvent(const ui::LocatedEvent& event);
122 123
123 // Sets state to |state| and stops the repeater. 124 // Sets state to |state| and stops the repeater.
124 void SetState(CustomButton::ButtonState state); 125 void SetState(CustomButton::ButtonState state);
125 126
126 // Called when the mouse is pressed down in the track area. 127 // Called when the mouse is pressed down in the track area.
127 void TrackClicked(); 128 void TrackClicked();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // TODO(tdresser): This should be removed when raw pixel scrolling for views 185 // TODO(tdresser): This should be removed when raw pixel scrolling for views
185 // is enabled. See crbug.com/329354. 186 // is enabled. See crbug.com/329354.
186 gfx::Vector2dF roundoff_error_; 187 gfx::Vector2dF roundoff_error_;
187 188
188 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); 189 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar);
189 }; 190 };
190 191
191 } // namespace views 192 } // namespace views
192 193
193 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ 194 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/scrollbar/base_scroll_bar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698