Commit 6e408343 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: have scrollview mark its contents as non-opaque

ScrollView, when using layers to scroll, imposes a layer on its contents;
doing so implies by default that the contents opaquely fill their entire
bounds. This is not true for many kinds of contents, so don't assume it to
avoid patches of un-drawn area.

Bug: 826472
Change-Id: I1364c06f43241e6cecbc4eaddb20311047b89bdf
Reviewed-on: https://chromium-review.googlesource.com/987527Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547448}
parent 9696438d
......@@ -254,13 +254,22 @@ void ScrollView::SetContents(View* a_view) {
// Protect against clients passing a contents view that has its own Layer.
DCHECK(!a_view->layer());
if (ScrollsWithLayers()) {
if (!a_view->background() && GetBackgroundColor() != SK_ColorTRANSPARENT) {
a_view->SetBackground(CreateSolidBackground(GetBackgroundColor()));
bool fills_opaquely = true;
if (!a_view->background()) {
// Contents views may not be aware they need to fill their entire bounds -
// play it safe here to avoid graphical glitches
// (https://crbug.com/826472). If there's no solid background, mark the
// view as not filling its bounds opaquely.
if (GetBackgroundColor() != SK_ColorTRANSPARENT)
a_view->SetBackground(CreateSolidBackground(GetBackgroundColor()));
else
fills_opaquely = false;
}
a_view->SetPaintToLayer();
a_view->layer()->SetDidScrollCallback(
base::Bind(&ScrollView::OnLayerScrolled, base::Unretained(this)));
a_view->layer()->SetScrollable(contents_viewport_->bounds().size());
a_view->layer()->SetFillsBoundsOpaquely(fills_opaquely);
}
SetHeaderOrContents(contents_viewport_, a_view, &contents_);
}
......
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