| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/controls/scroll_view.h" | 5 #include "views/controls/scroll_view.h" | 
| 6 | 6 | 
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" | 
| 8 #include "base/logging.h" | 8 #include "base/logging.h" | 
| 9 #include "views/controls/scrollbar/native_scroll_bar.h" | 9 #include "views/controls/scrollbar/native_scroll_bar.h" | 
| 10 #include "views/widget/root_view.h" | 10 #include "views/widget/root_view.h" | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 183   } | 183   } | 
| 184   bool resize_corner_required = resize_corner_ && horiz_sb_required && | 184   bool resize_corner_required = resize_corner_ && horiz_sb_required && | 
| 185                                 vert_sb_required; | 185                                 vert_sb_required; | 
| 186   // Take action. | 186   // Take action. | 
| 187   SetControlVisibility(horiz_sb_, horiz_sb_required); | 187   SetControlVisibility(horiz_sb_, horiz_sb_required); | 
| 188   SetControlVisibility(vert_sb_, vert_sb_required); | 188   SetControlVisibility(vert_sb_, vert_sb_required); | 
| 189   SetControlVisibility(resize_corner_, resize_corner_required); | 189   SetControlVisibility(resize_corner_, resize_corner_required); | 
| 190 | 190 | 
| 191   // Non-default. | 191   // Non-default. | 
| 192   if (horiz_sb_required) { | 192   if (horiz_sb_required) { | 
| 193     viewport_bounds.set_height(viewport_bounds.height() - horiz_sb_height); | 193     viewport_bounds.set_height( | 
|  | 194         std::max(0, viewport_bounds.height() - horiz_sb_height)); | 
| 194     should_layout_contents = true; | 195     should_layout_contents = true; | 
| 195   } | 196   } | 
| 196   // Default. | 197   // Default. | 
| 197   if (!vert_sb_required) { | 198   if (!vert_sb_required) { | 
| 198     viewport_bounds.set_width(viewport_bounds.width() + vert_sb_width); | 199     viewport_bounds.set_width(viewport_bounds.width() + vert_sb_width); | 
| 199     should_layout_contents = true; | 200     should_layout_contents = true; | 
| 200   } | 201   } | 
| 201 | 202 | 
| 202   if (horiz_sb_required) { | 203   if (horiz_sb_required) { | 
| 203     horiz_sb_->SetBounds(0, | 204     horiz_sb_->SetBounds(0, | 
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 507 | 508 | 
| 508 VariableRowHeightScrollHelper::RowInfo | 509 VariableRowHeightScrollHelper::RowInfo | 
| 509     FixedRowHeightScrollHelper::GetRowInfo(int y) { | 510     FixedRowHeightScrollHelper::GetRowInfo(int y) { | 
| 510   if (y < top_margin_) | 511   if (y < top_margin_) | 
| 511     return RowInfo(0, top_margin_); | 512     return RowInfo(0, top_margin_); | 
| 512   return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, | 513   return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, | 
| 513                  row_height_); | 514                  row_height_); | 
| 514 } | 515 } | 
| 515 | 516 | 
| 516 }  // namespace views | 517 }  // namespace views | 
| OLD | NEW | 
|---|