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

Side by Side Diff: cc/test/fake_painted_scrollbar_layer.cc

Issue 2816063003: Replace layer id with Element id for tracking scrollbar animation controllers (Closed)
Patch Set: Address reviewer comments, pull element_id.h change to another patch Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
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/test/fake_painted_scrollbar_layer.h" 5 #include "cc/test/fake_painted_scrollbar_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/test/fake_scrollbar.h" 9 #include "cc/test/fake_scrollbar.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( 13 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create(
14 bool paint_during_update, 14 bool paint_during_update,
15 bool has_thumb, 15 bool has_thumb,
16 int scrolling_layer_id) { 16 int scrolling_layer_id,
17 ElementId scrolling_element_id) {
17 return Create(paint_during_update, has_thumb, HORIZONTAL, false, false, 18 return Create(paint_during_update, has_thumb, HORIZONTAL, false, false,
18 scrolling_layer_id); 19 scrolling_layer_id, scrolling_element_id);
19 } 20 }
20 21
21 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( 22 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create(
22 bool paint_during_update, 23 bool paint_during_update,
23 bool has_thumb, 24 bool has_thumb,
24 ScrollbarOrientation orientation, 25 ScrollbarOrientation orientation,
25 bool is_left_side_vertical_scrollbar, 26 bool is_left_side_vertical_scrollbar,
26 bool is_overlay, 27 bool is_overlay,
27 int scrolling_layer_id) { 28 int scrolling_layer_id,
29 ElementId scrolling_element_id) {
28 FakeScrollbar* fake_scrollbar = 30 FakeScrollbar* fake_scrollbar =
29 new FakeScrollbar(paint_during_update, has_thumb, orientation, 31 new FakeScrollbar(paint_during_update, has_thumb, orientation,
30 is_left_side_vertical_scrollbar, is_overlay); 32 is_left_side_vertical_scrollbar, is_overlay);
31 return make_scoped_refptr( 33 return make_scoped_refptr(new FakePaintedScrollbarLayer(
32 new FakePaintedScrollbarLayer(fake_scrollbar, scrolling_layer_id)); 34 fake_scrollbar, scrolling_layer_id, scrolling_element_id));
33 } 35 }
34 36
35 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( 37 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer(
36 FakeScrollbar* fake_scrollbar, 38 FakeScrollbar* fake_scrollbar,
37 int scrolling_layer_id) 39 int scrolling_layer_id,
40 ElementId scrolling_element_id)
38 : PaintedScrollbarLayer(std::unique_ptr<Scrollbar>(fake_scrollbar), 41 : PaintedScrollbarLayer(std::unique_ptr<Scrollbar>(fake_scrollbar),
39 scrolling_layer_id), 42 scrolling_layer_id,
43 scrolling_element_id),
40 update_count_(0), 44 update_count_(0),
41 push_properties_count_(0), 45 push_properties_count_(0),
42 fake_scrollbar_(fake_scrollbar) { 46 fake_scrollbar_(fake_scrollbar) {
43 SetBounds(gfx::Size(1, 1)); 47 SetBounds(gfx::Size(1, 1));
44 SetIsDrawable(true); 48 SetIsDrawable(true);
45 } 49 }
46 50
47 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} 51 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {}
48 52
49 bool FakePaintedScrollbarLayer::Update() { 53 bool FakePaintedScrollbarLayer::Update() {
50 bool updated = PaintedScrollbarLayer::Update(); 54 bool updated = PaintedScrollbarLayer::Update();
51 ++update_count_; 55 ++update_count_;
52 return updated; 56 return updated;
53 } 57 }
54 58
55 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { 59 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
56 PaintedScrollbarLayer::PushPropertiesTo(layer); 60 PaintedScrollbarLayer::PushPropertiesTo(layer);
57 ++push_properties_count_; 61 ++push_properties_count_;
58 } 62 }
59 63
60 std::unique_ptr<base::AutoReset<bool>> 64 std::unique_ptr<base::AutoReset<bool>>
61 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { 65 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() {
62 return base::MakeUnique<base::AutoReset<bool>>(&ignore_set_needs_commit_, 66 return base::MakeUnique<base::AutoReset<bool>>(&ignore_set_needs_commit_,
63 true); 67 true);
64 } 68 }
65 69
66 } // namespace cc 70 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698