Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 1566313002: Remove layout during paint in Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unconditionally call layout in ActiveStateChanged Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 hover_controller_.SetAnimationContainer(container); 538 hover_controller_.SetAnimationContainer(container);
539 } 539 }
540 540
541 bool Tab::IsActive() const { 541 bool Tab::IsActive() const {
542 return controller_->IsActiveTab(this); 542 return controller_->IsActiveTab(this);
543 } 543 }
544 544
545 void Tab::ActiveStateChanged() { 545 void Tab::ActiveStateChanged() {
546 OnButtonColorMaybeChanged(); 546 OnButtonColorMaybeChanged();
547 media_indicator_button_->UpdateEnabledForMuteToggle(); 547 media_indicator_button_->UpdateEnabledForMuteToggle();
548 Layout();
sky 2016/01/08 16:40:32 Can we call layout only if we actually need to?
enne (OOO) 2016/01/08 18:22:27 Can you and miu sort out what you want to do here?
548 } 549 }
549 550
550 bool Tab::IsSelected() const { 551 bool Tab::IsSelected() const {
551 return controller_->IsTabSelected(this); 552 return controller_->IsTabSelected(this);
552 } 553 }
553 554
554 void Tab::SetData(const TabRendererData& data) { 555 void Tab::SetData(const TabRendererData& data) {
555 DCHECK(GetWidget()); 556 DCHECK(GetWidget());
556 557
557 if (data_.Equals(data)) 558 if (data_.Equals(data))
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 if (data().blocked == old.blocked) 1170 if (data().blocked == old.blocked)
1170 return; 1171 return;
1171 1172
1172 if (data().blocked) 1173 if (data().blocked)
1173 StartPulse(); 1174 StartPulse();
1174 else 1175 else
1175 StopPulse(); 1176 StopPulse();
1176 } 1177 }
1177 1178
1178 void Tab::PaintTab(gfx::Canvas* canvas) { 1179 void Tab::PaintTab(gfx::Canvas* canvas) {
1179 // See if the model changes whether the icons should be painted.
1180 const bool show_icon = ShouldShowIcon();
1181 const bool show_media_indicator = ShouldShowMediaIndicator();
1182 const bool show_close_button = ShouldShowCloseBox();
1183 if (show_icon != showing_icon_ ||
1184 show_media_indicator != showing_media_indicator_ ||
1185 show_close_button != showing_close_button_)
1186 Layout();
1187
1188 PaintTabBackground(canvas); 1180 PaintTabBackground(canvas);
1189 1181
1190 if (show_icon) 1182 if (showing_icon_)
1191 PaintIcon(canvas); 1183 PaintIcon(canvas);
1192 } 1184 }
1193 1185
1194 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { 1186 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) {
1195 // Use transparency for the draw-attention animation. 1187 // Use transparency for the draw-attention animation.
1196 int alpha = 255; 1188 int alpha = 255;
1197 if (pulse_animation_ && pulse_animation_->is_animating() && !data().pinned) { 1189 if (pulse_animation_ && pulse_animation_->is_animating() && !data().pinned) {
1198 alpha = pulse_animation_->CurrentValueBetween( 1190 alpha = pulse_animation_->CurrentValueBetween(
1199 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); 1191 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity));
1200 } 1192 }
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 const gfx::ImageSkia& image) { 1757 const gfx::ImageSkia& image) {
1766 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1758 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1767 ImageCacheEntry entry; 1759 ImageCacheEntry entry;
1768 entry.resource_id = resource_id; 1760 entry.resource_id = resource_id;
1769 entry.scale_factor = scale_factor; 1761 entry.scale_factor = scale_factor;
1770 entry.image = image; 1762 entry.image = image;
1771 image_cache_->push_front(entry); 1763 image_cache_->push_front(entry);
1772 if (image_cache_->size() > kMaxImageCacheSize) 1764 if (image_cache_->size() > kMaxImageCacheSize)
1773 image_cache_->pop_back(); 1765 image_cache_->pop_back();
1774 } 1766 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698