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() {
// TODO(pkasting): This whole function should go away, and we should simply
// compute child visibility state in Layout().
// Don't adjust whether we're centering the favicon during tab closure; let it
// stay however it was prior to closing the tab. This prevents the icon from
// sliding left at the end of closing a non-narrow tab.
if (!closing_)
// Don't adjust whether we're centering the favicon or adding extra padding
// during tab closure; let it stay however it was prior to closing the tab.
// This prevents the icon and text from sliding left at the end of closing
// a non-narrow tab.
if (!closing_) {
center_favicon_ = false;
extra_padding_before_content_ = false;
}
showing_icon_ = showing_alert_indicator_ = false;
extra_padding_before_content_ = false;
extra_alert_indicator_padding_ = false;
if (height() < GetLayoutConstant(TAB_HEIGHT))
......@@ -1546,21 +1548,26 @@ void Tab::UpdateIconVisibility() {
}
}
// The extra padding is intended to visually balance the close button, so 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.
// Don't update padding while the tab is closing, to avoid glitchy-looking
// behaviour when the close animation causes the tab to get very small
if (!closing_) {
// The extra padding is intended to visually balance the close button, so
// 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()) {
const int extra_left_padding =
MD::IsRefreshUi() ? kRefreshExtraLeftPaddingToBalanceCloseButtonPadding
MD::IsRefreshUi()
? kRefreshExtraLeftPaddingToBalanceCloseButtonPadding
: kExtraLeftPaddingToBalanceCloseButtonPadding;
DCHECK(!extra_padding_before_content_ ||
extra_left_padding <= available_width);
if (extra_padding_before_content_)
available_width -= extra_left_padding;
}
}
if (MD::IsRefreshUi()) {
extra_alert_indicator_padding_ = showing_alert_indicator_ &&
......
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