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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 1853173002: The Material Design ink drops on the ToolbarView are supposed to expand beyond the bounds of the To… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 2256
2257 // Check for updates to the desired size. 2257 // Check for updates to the desired size.
2258 if (bookmark_bar_view_->GetPreferredSize().height() != 2258 if (bookmark_bar_view_->GetPreferredSize().height() !=
2259 bookmark_bar_view_->height()) 2259 bookmark_bar_view_->height())
2260 needs_layout = true; 2260 needs_layout = true;
2261 2261
2262 return needs_layout; 2262 return needs_layout;
2263 } 2263 }
2264 2264
2265 void BrowserView::SetBookmarkBarParent(views::View* new_parent) { 2265 void BrowserView::SetBookmarkBarParent(views::View* new_parent) {
2266 // Because children are drawn in order, the child order also affects z-order:
2267 // earlier children will appear "below" later ones. This is important for ink
2268 // drops, which are drawn with the z-order of the view that parents them. Ink
2269 // drops in the toolbar can spread beyond the toolbar bounds, so if the
2270 // bookmark bar is attached, we want it to be below the toolbar so the toolbar
2271 // ink drops draw atop it. This doesn't cause a problem for interactions with
2272 // the bookmark bar, since it does not host any ink drops that spread beyond
2273 // its bounds. If it did, we would need to change how ink drops are drawn.
2274 // TODO(bruthig): Consider a more general mechanism for manipulating the
2275 // z-order of the ink drops.
2276
2266 if (new_parent == this) { 2277 if (new_parent == this) {
2267 // Add it underneath |top_container_| or at the end if top container isn't 2278 // BookmarkBarView is detached.
2268 // found. 2279 const int top_container_index = GetIndexOf(top_container_);
2269 int top_container_index = GetIndexOf(top_container_); 2280 DCHECK_GE(top_container_index, 0);
2270 if (top_container_index >= 0) 2281 // |top_container_| contains the toolbar, so putting the bookmark bar ahead
2271 AddChildViewAt(bookmark_bar_view_.get(), top_container_index); 2282 // of it will ensure it's drawn before the toolbar.
2272 else 2283 AddChildViewAt(bookmark_bar_view_.get(), top_container_index);
2273 AddChildView(bookmark_bar_view_.get()); 2284 } else if (new_parent == top_container_) {
2274 } else if (new_parent) { 2285 // BookmarkBarView is attached.
2275 // No special stacking is required for other parents. 2286
2276 new_parent->AddChildView(bookmark_bar_view_.get()); 2287 // The toolbar is a child of |top_container_|, so making the bookmark bar
2288 // the first child ensures it's drawn before the toolbar.
2289 new_parent->AddChildViewAt(bookmark_bar_view_.get(), 0);
2277 } else { 2290 } else {
2291 DCHECK(!new_parent);
2278 // Bookmark bar is being detached from all views because it is hidden. 2292 // Bookmark bar is being detached from all views because it is hidden.
2279 bookmark_bar_view_->parent()->RemoveChildView(bookmark_bar_view_.get()); 2293 bookmark_bar_view_->parent()->RemoveChildView(bookmark_bar_view_.get());
2280 } 2294 }
2281 } 2295 }
2282 2296
2283 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { 2297 bool BrowserView::MaybeShowInfoBar(WebContents* contents) {
2284 // TODO(beng): Remove this function once the interface between 2298 // TODO(beng): Remove this function once the interface between
2285 // InfoBarContainer, DownloadShelfView and WebContents and this 2299 // InfoBarContainer, DownloadShelfView and WebContents and this
2286 // view is sorted out. 2300 // view is sorted out.
2287 return true; 2301 return true;
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
2721 } 2735 }
2722 2736
2723 extensions::ActiveTabPermissionGranter* 2737 extensions::ActiveTabPermissionGranter*
2724 BrowserView::GetActiveTabPermissionGranter() { 2738 BrowserView::GetActiveTabPermissionGranter() {
2725 content::WebContents* web_contents = GetActiveWebContents(); 2739 content::WebContents* web_contents = GetActiveWebContents();
2726 if (!web_contents) 2740 if (!web_contents)
2727 return nullptr; 2741 return nullptr;
2728 return extensions::TabHelper::FromWebContents(web_contents) 2742 return extensions::TabHelper::FromWebContents(web_contents)
2729 ->active_tab_permission_granter(); 2743 ->active_tab_permission_granter();
2730 } 2744 }
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