0

Do not ignore SolidColorScrollbarLayer's scroll_layer_id ctor argument

SolidColorScrollbarLayer's constructor takes a scroll_layer_id argument
similar to the other ScrollbarLayerInterface subclasses, but this
argument was ignored. This patch fixes this bug which lets us remove
some redundant code in tests.

BUG=693740

Review-Url: https://codereview.chromium.org/2734583002
Cr-Commit-Position: refs/heads/master@{#454894}
This commit is contained in:
pdr
2017-03-06 10:28:16 -08:00
committed by Commit bot
parent 3f08a50143
commit 84d15f489b
3 changed files with 6 additions and 11 deletions

@ -224,8 +224,8 @@ TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> scroll_layer = Layer::Create();
scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<Layer> scrollbar_layer = PaintedScrollbarLayer::Create(
std::move(scrollbar), layer_tree_root->id());
scoped_refptr<Layer> scrollbar_layer =
PaintedScrollbarLayer::Create(std::move(scrollbar), scroll_layer->id());
// Choose bounds to give max_scroll_offset = (30, 50).
layer_tree_root->SetBounds(gfx::Size(70, 150));
@ -238,7 +238,6 @@ TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
layer_tree_root->AddChild(scroll_layer);
scroll_layer->AddChild(content_layer);
layer_tree_root->AddChild(scrollbar_layer);
scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
layer_tree_root->SavePaintProperties();
content_layer->SavePaintProperties();
@ -531,8 +530,7 @@ TEST_F(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {
const bool kIsLeftSideVerticalScrollbar = false;
child2 = SolidColorScrollbarLayer::Create(
scrollbar->Orientation(), kThumbThickness, kTrackStart,
kIsLeftSideVerticalScrollbar, child1->id());
child2->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
kIsLeftSideVerticalScrollbar, scroll_layer->id());
scroll_layer->AddChild(child1);
scroll_layer->InsertChild(child2, 1);
layer_tree_root->AddChild(scroll_layer);
@ -584,8 +582,7 @@ TEST_F(ScrollbarLayerTest, ScrollbarLayerOpacity) {
const bool kIsLeftSideVerticalScrollbar = false;
scrollbar_layer = SolidColorScrollbarLayer::Create(
scrollbar->Orientation(), kThumbThickness, kTrackStart,
kIsLeftSideVerticalScrollbar, child1->id());
scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
kIsLeftSideVerticalScrollbar, scroll_layer->id());
scroll_layer->AddChild(child1);
scroll_layer->InsertChild(scrollbar_layer, 1);
layer_tree_root->AddChild(scroll_layer);
@ -666,9 +663,8 @@ TEST_F(ScrollbarLayerTest, ScrollbarLayerPushProperties) {
const bool kIsLeftSideVerticalScrollbar = false;
scrollbar_layer = SolidColorScrollbarLayer::Create(
scrollbar->Orientation(), kThumbThickness, kTrackStart,
kIsLeftSideVerticalScrollbar, child1->id());
kIsLeftSideVerticalScrollbar, scroll_layer->id());
scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
scroll_layer->AddChild(child1);
scroll_layer->InsertChild(scrollbar_layer, 1);
layer_tree_root->AddChild(scroll_layer);

@ -39,7 +39,7 @@ SolidColorScrollbarLayer::SolidColorScrollbarLayerInputs::
int track_start,
bool is_left_side_vertical_scrollbar,
int scroll_layer_id)
: scroll_layer_id(Layer::INVALID_ID),
: scroll_layer_id(scroll_layer_id),
orientation(orientation),
thumb_thickness(thumb_thickness),
track_start(track_start),

@ -354,7 +354,6 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest {
FakePaintedScrollbarLayer::Create(false, true, content_layer_->id());
scrollbar_layer->SetPosition(gfx::PointF(300.f, 300.f));
scrollbar_layer->SetBounds(gfx::Size(10, 100));
scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(content_layer_->id());
root_layer->AddChild(scrollbar_layer);
gfx::RectF content_rect(content_layer_->position(),