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

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

Issue 2899133004: Reduce overdraw on bookmark bar (Closed)
Patch Set: address comments Created 3 years, 6 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 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 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // The number of milliseconds between loading animation frames. 193 // The number of milliseconds between loading animation frames.
194 const int kLoadingAnimationFrameTimeMs = 30; 194 const int kLoadingAnimationFrameTimeMs = 30;
195 195
196 // Paints the horizontal border separating the Bookmarks Bar from the Toolbar 196 // Paints the horizontal border separating the Bookmarks Bar from the Toolbar
197 // or page content according to |at_top| with |color|. 197 // or page content according to |at_top| with |color|.
198 void PaintDetachedBookmarkBar(gfx::Canvas* canvas, 198 void PaintDetachedBookmarkBar(gfx::Canvas* canvas,
199 BookmarkBarView* view) { 199 BookmarkBarView* view) {
200 // Paint background for detached state; if animating, this is fade in/out. 200 // Paint background for detached state; if animating, this is fade in/out.
201 const ui::ThemeProvider* tp = view->GetThemeProvider(); 201 const ui::ThemeProvider* tp = view->GetThemeProvider();
202 gfx::Rect fill_rect = view->GetLocalBounds(); 202 gfx::Rect fill_rect = view->GetLocalBounds();
203 // We have to not color the top 1dp, because that should be painted by the
204 // toolbar. We will, however, paint the 1px separator at the bottom of the
205 // first dp. See crbug.com/610359
206 fill_rect.Inset(0, 1, 0, 0);
207 203
208 // In detached mode, the bar is meant to overlap with |contents_container_|. 204 // In detached mode, the bar is meant to overlap with |contents_container_|.
209 // The detached background color may be partially transparent, but the layer 205 // The detached background color may be partially transparent, but the layer
210 // for |view| must be painted opaquely to avoid subpixel anti-aliasing 206 // for |view| must be painted opaquely to avoid subpixel anti-aliasing
211 // artifacts, so we recreate the contents container base color here. 207 // artifacts, so we recreate the contents container base color here.
212 canvas->FillRect(fill_rect, 208 canvas->FillRect(fill_rect,
213 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); 209 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND));
214 canvas->FillRect( 210 canvas->FillRect(
215 fill_rect, 211 fill_rect,
216 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); 212 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND));
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), flags); 498 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), flags);
503 } 499 }
504 500
505 void BrowserView::InitStatusBubble() { 501 void BrowserView::InitStatusBubble() {
506 status_bubble_.reset( 502 status_bubble_.reset(
507 new StatusBubbleViews(contents_web_view_, HasClientEdge())); 503 new StatusBubbleViews(contents_web_view_, HasClientEdge()));
508 contents_web_view_->SetStatusBubble(status_bubble_.get()); 504 contents_web_view_->SetStatusBubble(status_bubble_.get());
509 } 505 }
510 506
511 gfx::Rect BrowserView::GetToolbarBounds() const { 507 gfx::Rect BrowserView::GetToolbarBounds() const {
512 gfx::Rect toolbar_bounds(toolbar_->bounds()); 508 return toolbar_->bounds();
513 if (toolbar_bounds.IsEmpty())
514 return toolbar_bounds;
515 // The apparent toolbar edges are outside the "real" toolbar edges.
516 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
Peter Kasting 2017/05/31 02:16:03 Can you explain why you removed this horizontal ou
yiyix 2017/06/01 21:13:55 Sorry about it. I will pay more attention where I
517 return toolbar_bounds;
518 } 509 }
519 510
520 gfx::Rect BrowserView::GetFindBarBoundingBox() const { 511 gfx::Rect BrowserView::GetFindBarBoundingBox() const {
521 return GetBrowserViewLayout()->GetFindBarBoundingBox(); 512 return GetBrowserViewLayout()->GetFindBarBoundingBox();
522 } 513 }
523 514
524 int BrowserView::GetTabStripHeight() const { 515 int BrowserView::GetTabStripHeight() const {
525 // We want to return tabstrip_->height(), but we might be called in the midst 516 // We want to return tabstrip_->height(), but we might be called in the midst
526 // of layout, when that hasn't yet been updated to reflect the current state. 517 // of layout, when that hasn't yet been updated to reflect the current state.
527 // So return what the tabstrip height _ought_ to be right now. 518 // So return what the tabstrip height _ought_ to be right now.
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 #endif 2534 #endif
2544 } 2535 }
2545 2536
2546 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { 2537 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
2547 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || 2538 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED ||
2548 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { 2539 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) {
2549 return 0; 2540 return 0;
2550 } 2541 }
2551 // Don't use bookmark_bar_view_->height() which won't be the final height if 2542 // Don't use bookmark_bar_view_->height() which won't be the final height if
2552 // the bookmark bar is animating. 2543 // the bookmark bar is animating.
2553 return chrome::kNTPBookmarkBarHeight - 2544 return chrome::kNTPBookmarkBarHeight;
2554 views::NonClientFrameView::kClientEdgeThickness;
2555 } 2545 }
2556 2546
2557 void BrowserView::ExecuteExtensionCommand( 2547 void BrowserView::ExecuteExtensionCommand(
2558 const extensions::Extension* extension, 2548 const extensions::Extension* extension,
2559 const extensions::Command& command) { 2549 const extensions::Command& command) {
2560 extension_keybinding_registry_->ExecuteCommand(extension->id(), 2550 extension_keybinding_registry_->ExecuteCommand(extension->id(),
2561 command.accelerator()); 2551 command.accelerator());
2562 } 2552 }
2563 2553
2564 ExclusiveAccessContext* BrowserView::GetExclusiveAccessContext() { 2554 ExclusiveAccessContext* BrowserView::GetExclusiveAccessContext() {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 } 2682 }
2693 2683
2694 extensions::ActiveTabPermissionGranter* 2684 extensions::ActiveTabPermissionGranter*
2695 BrowserView::GetActiveTabPermissionGranter() { 2685 BrowserView::GetActiveTabPermissionGranter() {
2696 content::WebContents* web_contents = GetActiveWebContents(); 2686 content::WebContents* web_contents = GetActiveWebContents();
2697 if (!web_contents) 2687 if (!web_contents)
2698 return nullptr; 2688 return nullptr;
2699 return extensions::TabHelper::FromWebContents(web_contents) 2689 return extensions::TabHelper::FromWebContents(web_contents)
2700 ->active_tab_permission_granter(); 2690 ->active_tab_permission_granter();
2701 } 2691 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/frame/browser_view_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698