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

Unified Diff: chrome/browser/ui/views/frame/glass_browser_frame_view.cc

Issue 2381283003: Have Chrome draw top window border when using custom titlebar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove default Created 4 years, 2 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/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..be1dad8c04e1cb5c13baf0e5ceaefdf82c09fdf7 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -509,14 +509,36 @@ 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.
+ //
+ // We let the DWM do this for the other sides of the window by insetting the
+ // client area to leave nonclient area available. However, along the top
+ // window edge, we have to have zero nonclient area or the DWM will draw a
+ // full native titlebar outside our client area. See
+ // BrowserDesktopWindowTreeHostWin::GetClientAreaInsets().
+ //
+ // We could ask the DWM to draw the top accent border in the client area (by
+ // calling DwmExtendFrameIntoClientArea() in
+ // BrowserDesktopWindowTreeHostWin::UpdateDWMFrame()), but this requires
+ // that we leave part of the client surface transparent. If we draw this
+ // ourselves, we can make the client surface fully opaque and avoid the
+ // power consumption needed for DWM to blend the window contents.
+ //
+ // So the accent border also has to be opaque, but native inactive borders
+ // are #565656 with 80% alpha. We copy Edge (which also custom-draws its top
+ // border) and use #A2A2A2 instead.
+ constexpr SkColor inactive_border_color = 0xFFA2A2A2;
+ paint.setColor(
+ ShouldPaintAsActive()
+ ? GetThemeProvider()->GetColor(ThemeProperties::COLOR_ACCENT_BORDER)
+ : inactive_border_color);
+ canvas->DrawRect(gfx::RectF(0, 0, width() * scale, y), paint);
+
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 {
« no previous file with comments | « chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698