Chromium Code Reviews| Index: chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| index 98d1063b2ea1f5353d5ccd642c28927d41fbee11..58ec6a93a39c76389ac1ce80472370aad594aa41 100644 |
| --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
| @@ -498,6 +498,11 @@ Windows10CaptionButton* GlassBrowserFrameView::CreateCaptionButton( |
| } |
| void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const { |
| + // Normally the inactive accent border is semi-transparent, but we want to |
| + // make it opaque so that DWM won't need to blend with windows behind |
| + // Chrome. This color is the same as Edge uses and closely matches the |
| + // appearance of the normal inactive accent border. |
| + constexpr SkColor inactive_border_color = 0xFFA2A2A2; |
| SkColor frame_color = 0xFFCCCCCC; |
| gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view()->tabstrip()); |
|
Peter Kasting
2016/10/06 08:02:47
Nit: Let's move these constants down to just above
|
| @@ -509,14 +514,24 @@ void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const { |
| // BrowserDesktopWindowTreeHostWin::UpdateDWMFrame()). |
| const int y = IsMaximized() ? FrameTopBorderThicknessPx(false) : 1; |
| SkPaint paint; |
| + |
| + // Draw the top of the accent border. DWM does this for the other sides of |
| + // the window, and Chrome uses an inset to avoid drawing over top of them. |
| + // However the top of the window must have an inset of 0 or else DWM draws a |
| + // full set of caption buttons outside the window. |
| + // |
| + // Chrome should draw this itself instead of using transparency so that |
| + // alpha blending can be disabled on the window, which saves power when |
| + // compositing. |
|
Peter Kasting
2016/10/06 08:02:47
Nit: This comment partially restates info from the
Bret
2016/10/06 20:48:10
I like Peter's suggestion in general. I made some
|
| + paint.setColor( |
| + ShouldPaintAsActive() |
| + ? GetThemeProvider()->GetColor(ThemeProperties::COLOR_ACCENT_BORDER) |
| + : inactive_border_color); |
| + canvas->DrawRect(gfx::RectF(0, 0, width() * scale, y), paint); |
|
Peter Kasting
2016/10/06 08:02:47
Nit: Blank line below this, since the comment abov
|
| paint.setColor(frame_color); |
| canvas->DrawRect( |
| gfx::RectF(0, y, width() * scale, tabstrip_bounds.bottom() * scale - y), |
| paint); |
| - |
| - // The 1 pixel line at the top is drawn by Windows when we leave that section |
| - // of the window blank because we have called DwmExtendFrameIntoClientArea() |
| - // inside BrowserDesktopWindowTreeHostWin::UpdateDWMFrame(). |
| } |
| void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { |