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

Unified Diff: chrome/browser/android/compositor/layer/contextual_search_layer.cc

Issue 1061063005: [Contextual Search] Fix Promo behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync & rebase Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagementDelegate.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/compositor/layer/contextual_search_layer.cc
diff --git a/chrome/browser/android/compositor/layer/contextual_search_layer.cc b/chrome/browser/android/compositor/layer/contextual_search_layer.cc
index ad18013c281dc04a9474f72f07eb9143e6858c11..23b96b27be7231dad97b698bd82f6c8afe7042ab 100644
--- a/chrome/browser/android/compositor/layer/contextual_search_layer.cc
+++ b/chrome/browser/android/compositor/layer/contextual_search_layer.cc
@@ -146,12 +146,14 @@ void ContextualSearchLayer::SetProperties(
ui::ResourceManager::Resource* search_promo_resource =
resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_DYNAMIC,
search_promo_resource_id);
+ // Search Promo Container
+ if (search_promo_container_->parent() != layer_) {
+ // NOTE(pedrosimonetti): The Promo layer should be always placed before
+ // Search Bar Shadow to make sure it won't occlude the shadow.
+ layer_->InsertChild(search_promo_container_, 0);
+ }
if (search_promo_resource) {
- // Search Promo Container
- if (search_promo_container_->parent() != layer_)
- layer_->AddChild(search_promo_container_);
-
int search_promo_content_height = search_promo_resource->size.height();
gfx::Size search_promo_size(search_panel_width, search_promo_height);
search_promo_container_->SetBounds(search_promo_size);
@@ -171,9 +173,6 @@ void ContextualSearchLayer::SetProperties(
search_promo_->SetOpacity(search_promo_opacity);
}
} else {
- // TODO(pedrosimonetti): confirm with dtrainor@ that we don't need to remove
- // the child too (since it's going to be removed when the parent is gone).
-
// Search Promo Container
if (search_promo_container_.get() && search_promo_container_->parent())
search_promo_container_->RemoveFromParent();
@@ -203,16 +202,16 @@ void ContextualSearchLayer::SetProperties(
if (search_bar_shadow_resource) {
if (search_bar_shadow_->parent() != layer_)
layer_->AddChild(search_bar_shadow_);
- }
- int shadow_height = search_bar_shadow_resource->size.height();
- gfx::Size shadow_size(search_panel_width, shadow_height);
+ int shadow_height = search_bar_shadow_resource->size.height();
+ gfx::Size shadow_size(search_panel_width, shadow_height);
- search_bar_shadow_->SetUIResourceId(
- search_bar_shadow_resource->ui_resource->id());
- search_bar_shadow_->SetBounds(shadow_size);
- search_bar_shadow_->SetPosition(gfx::PointF(0.f, search_bar_height));
- search_bar_shadow_->SetOpacity(search_bar_shadow_opacity);
+ search_bar_shadow_->SetUIResourceId(
+ search_bar_shadow_resource->ui_resource->id());
+ search_bar_shadow_->SetBounds(shadow_size);
+ search_bar_shadow_->SetPosition(gfx::PointF(0.f, search_bar_height));
+ search_bar_shadow_->SetOpacity(search_bar_shadow_opacity);
+ }
} else {
if (search_bar_shadow_.get() && search_bar_shadow_->parent())
search_bar_shadow_->RemoveFromParent();
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagementDelegate.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698