Commit 9c46717e authored by ananta's avatar ananta Committed by Commit bot

Fix the white background regression on the Extensions overflow menu.

This was a regression introduced by my patch https://codereview.chromium.org/2813353002/ for
bugs 665412, 656198. This patch ensured that the parent views get notified when a child adds a layer.

This notification is handled by the scrollview, where we enable layering on the viewport.

We need to call SetFillsBoundsOpaquely() on the viewport layer for the scrollview to ensure that
transparent views like the overflow menu work correctly.

Thanks for timbrown for helping debug on his Linux Box and to sky for
the suggestions.

BUG=722965

Review-Url: https://codereview.chromium.org/2895003002
Cr-Commit-Position: refs/heads/master@{#473787}
parent 4d47b5db
...@@ -747,10 +747,18 @@ void ScrollView::EnableViewPortLayer() { ...@@ -747,10 +747,18 @@ void ScrollView::EnableViewPortLayer() {
return; return;
viewport_layer_enabled_ = true; viewport_layer_enabled_ = true;
background_color_ = SK_ColorWHITE;
contents_viewport_->set_background(
Background::CreateSolidBackground(background_color_));
contents_viewport_->SetPaintToLayer(); contents_viewport_->SetPaintToLayer();
if (scroll_with_layers_enabled_) {
background_color_ = SK_ColorWHITE;
contents_viewport_->set_background(
Background::CreateSolidBackground(background_color_));
} else {
// We may have transparent children who want to blend into the default
// background.
contents_viewport_->layer()->SetFillsBoundsOpaquely(false);
}
contents_viewport_->layer()->SetMasksToBounds(true); contents_viewport_->layer()->SetMasksToBounds(true);
} }
......
...@@ -5039,6 +5039,12 @@ TEST_F(ViewObserverTest, ScrollViewChildAddLayerTest) { ...@@ -5039,6 +5039,12 @@ TEST_F(ViewObserverTest, ScrollViewChildAddLayerTest) {
child_view->SetPaintToLayer(ui::LAYER_TEXTURED); child_view->SetPaintToLayer(ui::LAYER_TEXTURED);
EXPECT_TRUE(scroll_view->contents_viewport_->layer()); EXPECT_TRUE(scroll_view->contents_viewport_->layer());
// We don't want the viewport's layer to have the fill_bounds_opaquely() bit
// set, as we may have transparent children who want to blend into the
// default background.
EXPECT_FALSE(
scroll_view->contents_viewport_->layer()->fills_bounds_opaquely());
scroll_view->RemoveChildView(child_view.get()); scroll_view->RemoveChildView(child_view.get());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment