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 "cc/paint/paint_shader.h" | 8 #include "cc/paint/paint_shader.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "third_party/skia/include/effects/SkGradientShader.h" | 10 #include "third_party/skia/include/effects/SkGradientShader.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 SkPoint gradient_bounds[2]; | 252 SkPoint gradient_bounds[2]; |
253 if (IsHorizontal()) { | 253 if (IsHorizontal()) { |
254 gradient_bounds[0].set(track_rect.x(), track_rect.y()); | 254 gradient_bounds[0].set(track_rect.x(), track_rect.y()); |
255 gradient_bounds[1].set(track_rect.x(), track_rect.bottom()); | 255 gradient_bounds[1].set(track_rect.x(), track_rect.bottom()); |
256 } else { | 256 } else { |
257 gradient_bounds[0].set(track_rect.x(), track_rect.y()); | 257 gradient_bounds[0].set(track_rect.x(), track_rect.y()); |
258 gradient_bounds[1].set(track_rect.right(), track_rect.y()); | 258 gradient_bounds[1].set(track_rect.right(), track_rect.y()); |
259 } | 259 } |
260 cc::PaintFlags gradient; | 260 cc::PaintFlags gradient; |
261 gradient.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear( | 261 gradient.setShader(cc::PaintShader::MakeLinearGradient( |
262 gradient_bounds, kScrollerTrackGradientColors, nullptr, | 262 gradient_bounds, kScrollerTrackGradientColors, nullptr, |
263 arraysize(kScrollerTrackGradientColors), SkShader::kClamp_TileMode))); | 263 arraysize(kScrollerTrackGradientColors), SkShader::kClamp_TileMode)); |
264 canvas->DrawRect(track_rect, gradient); | 264 canvas->DrawRect(track_rect, gradient); |
265 | 265 |
266 // Draw the inner border: top if horizontal, left if vertical. | 266 // Draw the inner border: top if horizontal, left if vertical. |
267 cc::PaintFlags flags; | 267 cc::PaintFlags flags; |
268 flags.setColor(kScrollerTrackInnerBorderColor); | 268 flags.setColor(kScrollerTrackInnerBorderColor); |
269 gfx::Rect inner_border(track_rect); | 269 gfx::Rect inner_border(track_rect); |
270 if (IsHorizontal()) | 270 if (IsHorizontal()) |
271 inner_border.set_height(kScrollerTrackBorderWidth); | 271 inner_border.set_height(kScrollerTrackBorderWidth); |
272 else | 272 else |
273 inner_border.set_width(kScrollerTrackBorderWidth); | 273 inner_border.set_width(kScrollerTrackBorderWidth); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 CocoaScrollBarThumb* CocoaScrollBar::GetCocoaScrollBarThumb() const { | 537 CocoaScrollBarThumb* CocoaScrollBar::GetCocoaScrollBarThumb() const { |
538 return static_cast<CocoaScrollBarThumb*>(GetThumb()); | 538 return static_cast<CocoaScrollBarThumb*>(GetThumb()); |
539 } | 539 } |
540 | 540 |
541 // static | 541 // static |
542 base::Timer* BaseScrollBar::GetHideTimerForTest(BaseScrollBar* scroll_bar) { | 542 base::Timer* BaseScrollBar::GetHideTimerForTest(BaseScrollBar* scroll_bar) { |
543 return &static_cast<CocoaScrollBar*>(scroll_bar)->hide_scrollbar_timer_; | 543 return &static_cast<CocoaScrollBar*>(scroll_bar)->hide_scrollbar_timer_; |
544 } | 544 } |
545 | 545 |
546 } // namespace views | 546 } // namespace views |
OLD | NEW |