Commit d275874b authored by Theresa's avatar Theresa Committed by Commit Bot

Force a toolbar texture capture if the tab count has changed

If the tab count has changed since the last toolbar texture capture,
force a texture capture the next time #setForceTextureCapture is called.

Prior to splitting the tab switcher and browsing mode toolbar views this
wasn't necessary because changing the tab count caused an invalidation
to propogate to the ViewResourceFrameLayout. After the split, however,
the invalidation doesn't get propogated becaused the browsing mode view
is invisible while in the tab switcher.

BUG=917805

Change-Id: I451767a6d24bf570a60eac22ef1c2d76decf9740
Reviewed-on: https://chromium-review.googlesource.com/c/1391677Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619457}
parent b858a242
......@@ -153,6 +153,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O
private boolean mForceTextureCapture;
private boolean mUseLightDrawablesForTextureCapture;
private boolean mLightDrawablesUsedForLastTextureCapture;
private int mTabCountForLastTextureCapture;
@ViewDebug.ExportedProperty(category = "chrome")
private boolean mAnimateNormalToolbar;
......@@ -1297,6 +1298,10 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O
mLightDrawablesUsedForLastTextureCapture = mUseLightDrawablesForTextureCapture;
if (mTabSwitcherAnimationTabStackDrawable != null && mToggleTabStackButton != null) {
mTabCountForLastTextureCapture = mTabSwitcherAnimationTabStackDrawable.getTabCount();
}
canvas.restore();
}
......@@ -1525,9 +1530,17 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O
public boolean setForceTextureCapture(boolean forceTextureCapture) {
if (forceTextureCapture) {
setUseLightDrawablesForTextureCapture();
// Only force a texture capture if the tint for the toolbar drawables is changing.
// Only force a texture capture if the tint for the toolbar drawables is changing or
// if the tab count has changed since the last texture capture.
mForceTextureCapture =
mLightDrawablesUsedForLastTextureCapture != mUseLightDrawablesForTextureCapture;
if (mTabSwitcherAnimationTabStackDrawable != null && mToggleTabStackButton != null) {
mForceTextureCapture = mForceTextureCapture
|| mTabCountForLastTextureCapture
!= mTabSwitcherAnimationTabStackDrawable.getTabCount();
}
return mForceTextureCapture;
}
......
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