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

Side by Side Diff: chrome/browser/android/compositor/layer/tab_layer.cc

Issue 2569893002: Do not show tab title when it is not needed (Closed)
Patch Set: remove extra new line Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/android/compositor/layer/tab_layer.h" 5 #include "chrome/browser/android/compositor/layer/tab_layer.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/layers/layer_collections.h" 10 #include "cc/layers/layer_collections.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 float static_to_view_blend, 129 float static_to_view_blend,
130 float content_width, 130 float content_width,
131 float content_height, 131 float content_height,
132 float view_width, 132 float view_width,
133 float view_height, 133 float view_height,
134 bool show_toolbar, 134 bool show_toolbar,
135 int default_theme_color, 135 int default_theme_color,
136 int toolbar_background_color, 136 int toolbar_background_color,
137 int close_button_color, 137 int close_button_color,
138 bool anonymize_toolbar, 138 bool anonymize_toolbar,
139 bool show_tab_title,
139 int toolbar_textbox_resource_id, 140 int toolbar_textbox_resource_id,
140 int toolbar_textbox_background_color, 141 int toolbar_textbox_background_color,
141 float toolbar_textbox_alpha, 142 float toolbar_textbox_alpha,
142 float toolbar_alpha, 143 float toolbar_alpha,
143 float toolbar_y_offset, 144 float toolbar_y_offset,
144 float side_border_scale, 145 float side_border_scale,
145 bool inset_border) { 146 bool inset_border) {
146 if (alpha <= 0) { 147 if (alpha <= 0) {
147 layer_->SetHideLayerAndSubtree(true); 148 layer_->SetHideLayerAndSubtree(true);
148 return; 149 return;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 gfx::Size desired_content_size(desired_content_size_pt.x(), 381 gfx::Size desired_content_size(desired_content_size_pt.x(),
381 desired_content_size_pt.y()); 382 desired_content_size_pt.y());
382 383
383 //---------------------------------------------------------------------------- 384 //----------------------------------------------------------------------------
384 // Calculate Content Visibility 385 // Calculate Content Visibility
385 //---------------------------------------------------------------------------- 386 //----------------------------------------------------------------------------
386 // Check if the rect we are drawing is larger than the content rect. 387 // Check if the rect we are drawing is larger than the content rect.
387 bool content_visible = desired_content_size.GetArea() > 0.f; 388 bool content_visible = desired_content_size.GetArea() > 0.f;
388 389
389 // TODO(dtrainor): Improve these calculations to prune these layers out. 390 // TODO(dtrainor): Improve these calculations to prune these layers out.
390 bool title_visible = border_alpha > 0.f && !back_visible; 391 bool title_visible = border_alpha > 0.f && !back_visible && show_tab_title;
391 bool close_btn_visible = title_visible; 392 bool close_btn_visible = title_visible;
392 bool toolbar_visible = show_toolbar && toolbar_alpha > 0.f && !back_visible; 393 bool toolbar_visible = show_toolbar && toolbar_alpha > 0.f && !back_visible;
393 394
394 //---------------------------------------------------------------------------- 395 //----------------------------------------------------------------------------
395 // Fix jaggies 396 // Fix jaggies
396 //---------------------------------------------------------------------------- 397 //----------------------------------------------------------------------------
397 border_position.Offset(0.5f, 0.5f); 398 border_position.Offset(0.5f, 0.5f);
398 border_inner_shadow_position.Offset(0.5f, 0.5f); 399 border_inner_shadow_position.Offset(0.5f, 0.5f);
399 shadow_position.Offset(0.5f, 0.5f); 400 shadow_position.Offset(0.5f, 0.5f);
400 contour_position.Offset(0.5f, 0.5f); 401 contour_position.Offset(0.5f, 0.5f);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 title_->RemoveAllChildren(); 679 title_->RemoveAllChildren();
679 title_->AddChild(layer); 680 title_->AddChild(layer);
680 } 681 }
681 } 682 }
682 683
683 if (title) 684 if (title)
684 title->SetUIResourceIds(); 685 title->SetUIResourceIds();
685 } 686 }
686 687
687 } // namespace android 688 } // namespace android
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698