Commit 734d2825 authored by Ryan Landay's avatar Ryan Landay Committed by Commit Bot

Fix animation jankiness after selecting the current NTP in Android tab switcher

If you open an NTP on Android, open the tab switcher, and then focus the NTP,
there is often some jankiness at the end of the animation where the page very
quickly appears to jump back-and-forth by a few pixels.

It turns out that this happens when we switch from TabListSceneLayer (what we
use to display the tab switcher) to StaticTabSceneLayer (what we use to show
the tab during normal browsing): for the NTP, we never use the live layer in
the tab switcher, so we have to use the static layer. When we switch to
StaticTabSceneLayer, it (sometimes?) still uses the static layer very briefly,
but displays it at not quite the right size, which causes the jumpiness before
we switch back to the live layer.

The fix is to make ContentLayer clip the static layer to the value of
ComputedSize() in the case where should_clip == false.

Bug: 748648
Change-Id: I2999ee1be91681d692e381a9aff230567ace20fc
Reviewed-on: https://chromium-review.googlesource.com/1114349Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Ryan Landay <rlanday@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570974}
parent dab1f896
...@@ -91,10 +91,17 @@ void ContentLayer::SetProperties(int id, ...@@ -91,10 +91,17 @@ void ContentLayer::SetProperties(int id,
} }
if (static_layer.get()) { if (static_layer.get()) {
static_layer->layer()->SetIsDrawable(true); static_layer->layer()->SetIsDrawable(true);
if (should_clip)
if (should_clip) {
static_layer->Clip(clip); static_layer->Clip(clip);
else } else {
static_layer->ClearClip(); // Clipping to the computed size of the layer fixes an issue where the tab
// contents briefly jump back-and-forth when transitioning from a
// TabListSceneLayer to a StaticTabSceneLayer.
const gfx::Size& size = ComputeSize(id);
static_layer->Clip(gfx::Rect(0, 0, size.width(), size.height()));
}
SetOpacityOnLeaf(static_layer->layer(), static_opacity); SetOpacityOnLeaf(static_layer->layer(), static_opacity);
cc::FilterOperations static_filter_operations; cc::FilterOperations static_filter_operations;
......
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