| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" | 5 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" |
| 6 | 6 |
| 7 #import "base/mac/sdk_forward_declarations.h" | 7 #import "base/mac/sdk_forward_declarations.h" |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 gfx::Size track_size = local_bounds.size(); | 202 gfx::Size track_size = local_bounds.size(); |
| 203 track_size.SetToMax(GetThumb()->GetPreferredSize()); | 203 track_size.SetToMax(GetThumb()->GetPreferredSize()); |
| 204 local_bounds.set_size(track_size); | 204 local_bounds.set_size(track_size); |
| 205 return local_bounds; | 205 return local_bounds; |
| 206 } | 206 } |
| 207 | 207 |
| 208 ////////////////////////////////////////////////////////////////// | 208 ////////////////////////////////////////////////////////////////// |
| 209 // CocoaScrollBar, ScrollBar: | 209 // CocoaScrollBar, ScrollBar: |
| 210 | 210 |
| 211 int CocoaScrollBar::GetLayoutSize() const { | 211 int CocoaScrollBar::GetThickness() const { |
| 212 return scroller_style_ == NSScrollerStyleOverlay ? 0 : ScrollbarThickness(); | 212 return ScrollbarThickness(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 int CocoaScrollBar::GetContentOverlapSize() const { | 215 bool CocoaScrollBar::OverlapsContent() const { |
| 216 return scroller_style_ == NSScrollerStyleLegacy ? 0 : ScrollbarThickness(); | 216 return scroller_style_ == NSScrollerStyleOverlay; |
| 217 } | 217 } |
| 218 | 218 |
| 219 ////////////////////////////////////////////////////////////////// | 219 ////////////////////////////////////////////////////////////////// |
| 220 // CocoaScrollBar::View: | 220 // CocoaScrollBar::View: |
| 221 | 221 |
| 222 void CocoaScrollBar::Layout() { | 222 void CocoaScrollBar::Layout() { |
| 223 // Set the thickness of the thumb according to the track bounds. | 223 // Set the thickness of the thumb according to the track bounds. |
| 224 // The length of the thumb is set by BaseScrollBar::Update(). | 224 // The length of the thumb is set by BaseScrollBar::Update(). |
| 225 gfx::Rect thumb_bounds(GetThumb()->bounds()); | 225 gfx::Rect thumb_bounds(GetThumb()->bounds()); |
| 226 gfx::Rect track_bounds(GetTrackBounds()); | 226 gfx::Rect track_bounds(GetTrackBounds()); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 CocoaScrollBarThumb* CocoaScrollBar::GetCocoaScrollBarThumb() const { | 536 CocoaScrollBarThumb* CocoaScrollBar::GetCocoaScrollBarThumb() const { |
| 537 return static_cast<CocoaScrollBarThumb*>(GetThumb()); | 537 return static_cast<CocoaScrollBarThumb*>(GetThumb()); |
| 538 } | 538 } |
| 539 | 539 |
| 540 // static | 540 // static |
| 541 base::Timer* BaseScrollBar::GetHideTimerForTest(BaseScrollBar* scroll_bar) { | 541 base::Timer* BaseScrollBar::GetHideTimerForTest(BaseScrollBar* scroll_bar) { |
| 542 return &static_cast<CocoaScrollBar*>(scroll_bar)->hide_scrollbar_timer_; | 542 return &static_cast<CocoaScrollBar*>(scroll_bar)->hide_scrollbar_timer_; |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace views | 545 } // namespace views |
| OLD | NEW |