Commit 3361a101 authored by Ryan Meier's avatar Ryan Meier Committed by Commit Bot

Disable automatically modifying tab padding while a tab is closing

Adds checks before modifying whether or not a tab uses extra padding to
ensure that padding doesn't get changed while the tab is closing.
Without these checks, tab titles would suddenly jump several pixels to
the left near the end of the tab's closing animation.

Found while reproducing/fixing
Bug: 859321

Change-Id: Id7db4b160530535af520cdfaf99202aa863a019a
Reviewed-on: https://chromium-review.googlesource.com/1162359
Commit-Queue: Ryan Meier <rameier@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580652}
parent dc752939
...@@ -1458,14 +1458,16 @@ void Tab::UpdateIconVisibility() { ...@@ -1458,14 +1458,16 @@ void Tab::UpdateIconVisibility() {
// TODO(pkasting): This whole function should go away, and we should simply // TODO(pkasting): This whole function should go away, and we should simply
// compute child visibility state in Layout(). // compute child visibility state in Layout().
// Don't adjust whether we're centering the favicon during tab closure; let it // Don't adjust whether we're centering the favicon or adding extra padding
// stay however it was prior to closing the tab. This prevents the icon from // during tab closure; let it stay however it was prior to closing the tab.
// sliding left at the end of closing a non-narrow tab. // This prevents the icon and text from sliding left at the end of closing
if (!closing_) // a non-narrow tab.
if (!closing_) {
center_favicon_ = false; center_favicon_ = false;
extra_padding_before_content_ = false;
}
showing_icon_ = showing_alert_indicator_ = false; showing_icon_ = showing_alert_indicator_ = false;
extra_padding_before_content_ = false;
extra_alert_indicator_padding_ = false; extra_alert_indicator_padding_ = false;
if (height() < GetLayoutConstant(TAB_HEIGHT)) if (height() < GetLayoutConstant(TAB_HEIGHT))
...@@ -1546,20 +1548,25 @@ void Tab::UpdateIconVisibility() { ...@@ -1546,20 +1548,25 @@ void Tab::UpdateIconVisibility() {
} }
} }
// The extra padding is intended to visually balance the close button, so only // Don't update padding while the tab is closing, to avoid glitchy-looking
// include it when the close button is shown or will be shown on hover. We // behaviour when the close animation causes the tab to get very small
// also check this for active tabs so that the extra padding doesn't pop in if (!closing_) {
// and out as you switch tabs. // The extra padding is intended to visually balance the close button, so
extra_padding_before_content_ = large_enough_for_close_button; // only include it when the close button is shown or will be shown on hover.
// We also check this for active tabs so that the extra padding doesn't pop
// in and out as you switch tabs.
extra_padding_before_content_ = large_enough_for_close_button;
if (DCHECK_IS_ON()) { if (DCHECK_IS_ON()) {
const int extra_left_padding = const int extra_left_padding =
MD::IsRefreshUi() ? kRefreshExtraLeftPaddingToBalanceCloseButtonPadding MD::IsRefreshUi()
: kExtraLeftPaddingToBalanceCloseButtonPadding; ? kRefreshExtraLeftPaddingToBalanceCloseButtonPadding
DCHECK(!extra_padding_before_content_ || : kExtraLeftPaddingToBalanceCloseButtonPadding;
extra_left_padding <= available_width); DCHECK(!extra_padding_before_content_ ||
if (extra_padding_before_content_) extra_left_padding <= available_width);
available_width -= extra_left_padding; if (extra_padding_before_content_)
available_width -= extra_left_padding;
}
} }
if (MD::IsRefreshUi()) { if (MD::IsRefreshUi()) {
......
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