Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_non_client_frame_view_mac.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h" |
| 6 | 6 |
| 7 #include "chrome/browser/themes/theme_properties.h" | 7 #include "chrome/browser/themes/theme_properties.h" |
| 8 #include "chrome/browser/ui/layout_constants.h" | 8 #include "chrome/browser/ui/layout_constants.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_frame.h" | 9 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 canvas->TileImageInt(overlay, 0, 0, width(), overlay.height()); | 136 canvas->TileImageInt(overlay, 0, 0, width(), overlay.height()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void BrowserNonClientFrameViewMac::PaintToolbarBackground(gfx::Canvas* canvas) { | 139 void BrowserNonClientFrameViewMac::PaintToolbarBackground(gfx::Canvas* canvas) { |
| 140 gfx::Rect bounds(browser_view()->GetToolbarBounds()); | 140 gfx::Rect bounds(browser_view()->GetToolbarBounds()); |
| 141 if (bounds.IsEmpty()) | 141 if (bounds.IsEmpty()) |
| 142 return; | 142 return; |
| 143 | 143 |
| 144 const ui::ThemeProvider* tp = GetThemeProvider(); | 144 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 145 gfx::ImageSkia* border = tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_TOP); | 145 gfx::ImageSkia* border = tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_TOP); |
| 146 const int top_inset = | 146 const int top_inset = -border->height(); |
|
Peter Kasting
2016/09/22 23:27:24
Nit: Just use "- border->height()" directly below
Evan Stade
2016/09/23 00:31:07
Done.
| |
| 147 GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP) - border->height(); | |
| 148 | 147 |
| 149 const int x = bounds.x(); | 148 const int x = bounds.x(); |
| 150 const int y = bounds.y() + top_inset; | 149 const int y = bounds.y() + top_inset; |
| 151 const int w = bounds.width(); | 150 const int w = bounds.width(); |
| 152 const int h = bounds.height() - top_inset; | 151 const int h = bounds.height() - top_inset; |
| 153 | 152 |
| 154 // The tabstrip border image height is 2*scale pixels, but only the bottom 2 | 153 // The tabstrip border image height is 2*scale pixels, but only the bottom 2 |
| 155 // pixels contain the actual border (the rest is transparent). We can't draw | 154 // pixels contain the actual border (the rest is transparent). We can't draw |
| 156 // the toolbar image below this transparent upper area when scale > 1. | 155 // the toolbar image below this transparent upper area when scale > 1. |
| 157 const int fill_y = y + canvas->image_scale() - 1; | 156 const int fill_y = y + canvas->image_scale() - 1; |
| 158 const int fill_height = bounds.bottom() - fill_y; | 157 const int fill_height = bounds.bottom() - fill_y; |
| 159 | 158 |
| 160 // Draw the toolbar fill. | 159 // Draw the toolbar fill. |
| 161 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), | 160 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), |
| 162 x + GetThemeBackgroundXInset(), | 161 x + GetThemeBackgroundXInset(), |
| 163 fill_y - GetTopInset(false), x, fill_y, w, fill_height); | 162 fill_y - GetTopInset(false), x, fill_y, w, fill_height); |
| 164 | 163 |
| 165 // Draw the tabstrip/toolbar separator. | 164 // Draw the tabstrip/toolbar separator. |
| 166 canvas->TileImageInt(*border, 0, 0, x, y, w, border->height()); | 165 canvas->TileImageInt(*border, 0, 0, x, y, w, border->height()); |
| 167 | 166 |
| 168 // Draw the content/toolbar separator. | 167 // Draw the content/toolbar separator. |
| 169 canvas->FillRect( | 168 canvas->FillRect( |
| 170 gfx::Rect(x, y + h - kClientEdgeThickness, w, kClientEdgeThickness), | 169 gfx::Rect(x, y + h - kClientEdgeThickness, w, kClientEdgeThickness), |
| 171 ThemeProperties::GetDefaultColor( | 170 ThemeProperties::GetDefaultColor( |
| 172 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR, | 171 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR, |
| 173 browser_view()->IsIncognito())); | 172 browser_view()->IsIncognito())); |
| 174 } | 173 } |
| OLD | NEW |