diff options
author | Trent Apted <tapted@chromium.org> | 2016-03-09 19:21:11 +1100 |
---|---|---|
committer | Trent Apted <tapted@chromium.org> | 2016-03-09 08:23:47 +0000 |
commit | 449279b9ecb1f2b2ff1d20f4a296fcc880badc7c (patch) | |
tree | 5dc4762eec221519e8008e17eea7e99c43739d80 | |
parent | 9154f3d7ad33e79b6f4d9934f2bc1bbc74387892 (diff) | |
download | chromium_src-449279b9ecb1f2b2ff1d20f4a296fcc880badc7c.zip chromium_src-449279b9ecb1f2b2ff1d20f4a296fcc880badc7c.tar.gz chromium_src-449279b9ecb1f2b2ff1d20f4a296fcc880badc7c.tar.bz2 |
[merge-m49] CrOS: Don't paint tab-loading spinners in layers while in immersive fullscreen.
This regressed in r362878 which didn't handle a case where animations
occur in immersive fullscreen.
To fix, disable layer-painting of tab spinners while in fullscreen.
In most cases the tab is hidden or animating; layers shouldn't
be used. When the tab strip is fully revealed we could use layers,
but the benefit isn't worth the extra logic.
TBR=tapted@chromium.org
BUG=591535
TEST=On CrOS, enter immersive fullscreen, reload a page, reveal the
tab strip while the page is still loading, then move the mouse down
to dismiss the tab strip. Ensure a frozen throbber doesn't stick
around, floating over the page.
Review URL: https://codereview.chromium.org/1758183002
Cr-Commit-Position: refs/heads/master@{#379140}
(cherry picked from commit fde5de1bc63b656dabaafef3e5b59badcc613a22)
Review URL: https://codereview.chromium.org/1775933004 .
Cr-Commit-Position: refs/branch-heads/2623@{#604}
Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
-rw-r--r-- | chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc | 22 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/tab.cc | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/tab_strip.cc | 8 |
3 files changed, 29 insertions, 2 deletions
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc index f33ec1b..367b42c 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc @@ -272,6 +272,28 @@ TEST_F(ImmersiveModeControllerAshTest, TabAndBrowserFullscreen) { EXPECT_TRUE(controller()->ShouldHideTabIndicators()); } +// Ensure the circular tab-loading throbbers are not painted as layers in +// immersive fullscreen, since the tab strip may animate in or out without +// moving the layers. +TEST_F(ImmersiveModeControllerAshTest, LayeredSpinners) { + AddTab(browser(), GURL("about:blank")); + + TabStrip* tabstrip = browser_view()->tabstrip(); + + // Immersive fullscreen starts out disabled; layers are OK. + EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); + EXPECT_FALSE(controller()->IsEnabled()); + EXPECT_TRUE(tabstrip->CanPaintThrobberToLayer()); + + ToggleFullscreen(); + EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); + EXPECT_TRUE(controller()->IsEnabled()); + EXPECT_FALSE(tabstrip->CanPaintThrobberToLayer()); + + ToggleFullscreen(); + EXPECT_TRUE(tabstrip->CanPaintThrobberToLayer()); +} + class ImmersiveModeControllerAshTestHostedApp : public ImmersiveModeControllerAshTest { public: diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 5c95976..597c675 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -1479,6 +1479,7 @@ void Tab::PaintIcon(gfx::Canvas* canvas) { void Tab::AdvanceLoadingAnimation() { const TabRendererData::NetworkState state = data().network_state; if (controller_->IsImmersiveStyle()) { + throbber_->SetVisible(false); if (state == TabRendererData::NETWORK_STATE_WAITING) { // Waiting steps backwards. immersive_loading_step_ = diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 56a420c..a3e1044 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -1372,9 +1372,13 @@ bool TabStrip::ShouldPaintTab(const Tab* tab, gfx::Rect* clip) { bool TabStrip::CanPaintThrobberToLayer() const { // Disable layer-painting of throbbers if dragging, if any tab animation is in - // progress, or if stacked tabs are enabled. + // progress, or if stacked tabs are enabled. Also disable in fullscreen: when + // "immersive" the tab strip could be sliding in or out while transitioning to + // or away from |immersive_style_| and, for other modes, there's no tab strip. const bool dragging = drag_controller_ && drag_controller_->started_drag(); - return !touch_layout_ && !dragging && !IsAnimating(); + const views::Widget* widget = GetWidget(); + return widget && !touch_layout_ && !dragging && !IsAnimating() && + !widget->IsFullscreen(); } bool TabStrip::IsImmersiveStyle() const { |