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

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

Issue 2228823003: When possible, draw the toolbar shadow with the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
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/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 padding_rect.y() + content_position.y()); 91 padding_rect.y() + content_position.y());
92 transform.Translate(descaled_local_content_area.x(), 92 transform.Translate(descaled_local_content_area.x(),
93 descaled_local_content_area.y()); 93 descaled_local_content_area.y());
94 padding_layer->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); 94 padding_layer->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f));
95 padding_layer->SetTransform(transform); 95 padding_layer->SetTransform(transform);
96 } 96 }
97 97
98 void TabLayer::SetProperties(int id, 98 void TabLayer::SetProperties(int id,
99 bool can_use_live_layer, 99 bool can_use_live_layer,
100 int toolbar_resource_id, 100 int toolbar_resource_id,
101 int toolbar_shadow_resource_id,
101 int close_button_resource_id, 102 int close_button_resource_id,
102 int shadow_resource_id, 103 int shadow_resource_id,
103 int contour_resource_id, 104 int contour_resource_id,
104 int back_logo_resource_id, 105 int back_logo_resource_id,
105 int border_resource_id, 106 int border_resource_id,
106 int border_inner_shadow_resource_id, 107 int border_inner_shadow_resource_id,
107 int default_background_color, 108 int default_background_color,
108 int back_logo_color, 109 int back_logo_color,
109 bool is_portrait, 110 bool is_portrait,
110 float x, 111 float x,
(...skipping 28 matching lines...) Expand all
139 int toolbar_background_color, 140 int toolbar_background_color,
140 int close_button_color, 141 int close_button_color,
141 bool anonymize_toolbar, 142 bool anonymize_toolbar,
142 int toolbar_textbox_resource_id, 143 int toolbar_textbox_resource_id,
143 int toolbar_textbox_background_color, 144 int toolbar_textbox_background_color,
144 float toolbar_textbox_alpha, 145 float toolbar_textbox_alpha,
145 float toolbar_alpha, 146 float toolbar_alpha,
146 float toolbar_y_offset, 147 float toolbar_y_offset,
147 float side_border_scale, 148 float side_border_scale,
148 bool attach_content, 149 bool attach_content,
149 bool inset_border) { 150 bool inset_border,
151 bool needs_toolbar_shadow) {
150 if (alpha <= 0) { 152 if (alpha <= 0) {
151 layer_->SetHideLayerAndSubtree(true); 153 layer_->SetHideLayerAndSubtree(true);
152 return; 154 return;
153 } 155 }
154 156
155 layer_->SetHideLayerAndSubtree(false); 157 layer_->SetHideLayerAndSubtree(false);
156 158
157 // Grab required resources 159 // Grab required resources
158 ui::ResourceManager::Resource* border_resource = 160 ui::ResourceManager::Resource* border_resource =
159 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, 161 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 contour_resource->size.height() - contour_padding.height()); 228 contour_resource->size.height() - contour_padding.height());
227 229
228 const float close_btn_effective_width = close_btn_width * close_alpha; 230 const float close_btn_effective_width = close_btn_width * close_alpha;
229 231
230 //-------------------------------------------------------------------------- 232 //--------------------------------------------------------------------------
231 // Update Resource Ids For Layers That Impact Layout 233 // Update Resource Ids For Layers That Impact Layout
232 //-------------------------------------------------------------------------- 234 //--------------------------------------------------------------------------
233 235
234 // TODO(kkimlabs): Tab switcher doesn't show the progress bar. 236 // TODO(kkimlabs): Tab switcher doesn't show the progress bar.
235 toolbar_layer_->PushResource(toolbar_resource_id, 237 toolbar_layer_->PushResource(toolbar_resource_id,
238 toolbar_shadow_resource_id,
236 toolbar_background_color, 239 toolbar_background_color,
237 anonymize_toolbar, 240 anonymize_toolbar,
238 toolbar_textbox_background_color, 241 toolbar_textbox_background_color,
239 toolbar_textbox_resource_id, 242 toolbar_textbox_resource_id,
240 toolbar_textbox_alpha, 243 toolbar_textbox_alpha,
241 false, 244 false,
242 false); 245 needs_toolbar_shadow);
243 toolbar_layer_->UpdateProgressBar(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 246 toolbar_layer_->UpdateProgressBar(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
244 247
245 float toolbar_impact_height = 0; 248 float toolbar_impact_height = 0;
246 if (show_toolbar && !back_visible) 249 if (show_toolbar && !back_visible)
247 toolbar_impact_height = toolbar_layer_->layer()->bounds().height(); 250 toolbar_impact_height = toolbar_layer_->layer()->bounds().height();
248 251
249 //---------------------------------------------------------------------------- 252 //----------------------------------------------------------------------------
250 // Compute Alpha and Visibility 253 // Compute Alpha and Visibility
251 //---------------------------------------------------------------------------- 254 //----------------------------------------------------------------------------
252 border_alpha *= alpha; 255 border_alpha *= alpha;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 title_->AddChild(layer); 725 title_->AddChild(layer);
723 } 726 }
724 } 727 }
725 728
726 if (title) 729 if (title)
727 title->SetUIResourceIds(); 730 title->SetUIResourceIds();
728 } 731 }
729 732
730 } // namespace android 733 } // namespace android
731 } // namespace chrome 734 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/android/compositor/layer/tab_layer.h ('k') | chrome/browser/android/compositor/layer/toolbar_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698