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

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

Issue 2512583002: Remove *RowHeightScrollHelper from scroll_view.h/cc (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/scroll_view.h ('k') | no next file » | 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 8a0c2590e8d2eae11644a63eddd61455fc6c0fa6..f38d8c55fb43630a2b5ad3912d5284f7e422e062 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -715,77 +715,4 @@ void ScrollView::ScrollHeader() {
}
}
-// VariableRowHeightScrollHelper ----------------------------------------------
-
-VariableRowHeightScrollHelper::VariableRowHeightScrollHelper(
- Controller* controller) : controller_(controller) {
-}
-
-VariableRowHeightScrollHelper::~VariableRowHeightScrollHelper() {
-}
-
-int VariableRowHeightScrollHelper::GetPageScrollIncrement(
- ScrollView* scroll_view, bool is_horizontal, bool is_positive) {
- if (is_horizontal)
- return 0;
- // y coordinate is most likely negative.
- int y = abs(scroll_view->contents()->y());
- int vis_height = scroll_view->contents()->parent()->height();
- if (is_positive) {
- // Align the bottom most row to the top of the view.
- int bottom = std::min(scroll_view->contents()->height() - 1,
- y + vis_height);
- RowInfo bottom_row_info = GetRowInfo(bottom);
- // If 0, ScrollView will provide a default value.
- return std::max(0, bottom_row_info.origin - y);
- } else {
- // Align the row on the previous page to to the top of the view.
- int last_page_y = y - vis_height;
- RowInfo last_page_info = GetRowInfo(std::max(0, last_page_y));
- if (last_page_y != last_page_info.origin)
- return std::max(0, y - last_page_info.origin - last_page_info.height);
- return std::max(0, y - last_page_info.origin);
- }
-}
-
-int VariableRowHeightScrollHelper::GetLineScrollIncrement(
- ScrollView* scroll_view, bool is_horizontal, bool is_positive) {
- if (is_horizontal)
- return 0;
- // y coordinate is most likely negative.
- int y = abs(scroll_view->contents()->y());
- RowInfo row = GetRowInfo(y);
- if (is_positive) {
- return row.height - (y - row.origin);
- } else if (y == row.origin) {
- row = GetRowInfo(std::max(0, row.origin - 1));
- return y - row.origin;
- } else {
- return y - row.origin;
- }
-}
-
-VariableRowHeightScrollHelper::RowInfo
- VariableRowHeightScrollHelper::GetRowInfo(int y) {
- return controller_->GetRowInfo(y);
-}
-
-// FixedRowHeightScrollHelper -----------------------------------------------
-
-FixedRowHeightScrollHelper::FixedRowHeightScrollHelper(int top_margin,
- int row_height)
- : VariableRowHeightScrollHelper(NULL),
- top_margin_(top_margin),
- row_height_(row_height) {
- DCHECK_GT(row_height, 0);
-}
-
-VariableRowHeightScrollHelper::RowInfo
- FixedRowHeightScrollHelper::GetRowInfo(int y) {
- if (y < top_margin_)
- return RowInfo(0, top_margin_);
- return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
- row_height_);
-}
-
} // namespace views
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698