OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/layers/painted_scrollbar_layer.h" | 5 #include "cc/layers/painted_scrollbar_layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| 11 #include "cc/input/main_thread_scrolling_reason.h" |
11 #include "cc/layers/painted_scrollbar_layer_impl.h" | 12 #include "cc/layers/painted_scrollbar_layer_impl.h" |
12 #include "cc/resources/ui_resource_bitmap.h" | 13 #include "cc/resources/ui_resource_bitmap.h" |
13 #include "cc/trees/draw_property_utils.h" | 14 #include "cc/trees/draw_property_utils.h" |
14 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
15 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
16 #include "skia/ext/platform_canvas.h" | 17 #include "skia/ext/platform_canvas.h" |
17 #include "skia/ext/refptr.h" | 18 #include "skia/ext/refptr.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
20 #include "third_party/skia/include/core/SkSize.h" | 21 #include "third_party/skia/include/core/SkSize.h" |
(...skipping 22 matching lines...) Expand all Loading... |
43 : Layer(settings), | 44 : Layer(settings), |
44 scrollbar_(std::move(scrollbar)), | 45 scrollbar_(std::move(scrollbar)), |
45 scroll_layer_id_(scroll_layer_id), | 46 scroll_layer_id_(scroll_layer_id), |
46 internal_contents_scale_(1.f), | 47 internal_contents_scale_(1.f), |
47 thumb_thickness_(scrollbar_->ThumbThickness()), | 48 thumb_thickness_(scrollbar_->ThumbThickness()), |
48 thumb_length_(scrollbar_->ThumbLength()), | 49 thumb_length_(scrollbar_->ThumbLength()), |
49 is_overlay_(scrollbar_->IsOverlay()), | 50 is_overlay_(scrollbar_->IsOverlay()), |
50 has_thumb_(scrollbar_->HasThumb()), | 51 has_thumb_(scrollbar_->HasThumb()), |
51 thumb_opacity_(scrollbar_->ThumbOpacity()) { | 52 thumb_opacity_(scrollbar_->ThumbOpacity()) { |
52 if (!scrollbar_->IsOverlay()) | 53 if (!scrollbar_->IsOverlay()) |
53 AddMainThreadScrollingReasons(InputHandler::SCROLL_BAR_SCROLLING); | 54 AddMainThreadScrollingReasons( |
| 55 MainThreadScrollingReason::kScrollbarScrolling); |
54 } | 56 } |
55 | 57 |
56 PaintedScrollbarLayer::~PaintedScrollbarLayer() {} | 58 PaintedScrollbarLayer::~PaintedScrollbarLayer() {} |
57 | 59 |
58 int PaintedScrollbarLayer::ScrollLayerId() const { | 60 int PaintedScrollbarLayer::ScrollLayerId() const { |
59 return scroll_layer_id_; | 61 return scroll_layer_id_; |
60 } | 62 } |
61 | 63 |
62 void PaintedScrollbarLayer::SetScrollLayer(int layer_id) { | 64 void PaintedScrollbarLayer::SetScrollLayer(int layer_id) { |
63 if (layer_id == scroll_layer_id_) | 65 if (layer_id == scroll_layer_id_) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 303 |
302 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 304 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
303 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 305 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
304 // allocation and copying. | 306 // allocation and copying. |
305 skbitmap.setImmutable(); | 307 skbitmap.setImmutable(); |
306 | 308 |
307 return UIResourceBitmap(skbitmap); | 309 return UIResourceBitmap(skbitmap); |
308 } | 310 } |
309 | 311 |
310 } // namespace cc | 312 } // namespace cc |
OLD | NEW |