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 = | |
147 GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP) - border->height(); | |
148 | 146 |
149 const int x = bounds.x(); | 147 const int x = bounds.x(); |
150 const int y = bounds.y() + top_inset; | 148 const int y = bounds.y() - border->height(); |
151 const int w = bounds.width(); | 149 const int w = bounds.width(); |
152 const int h = bounds.height() - top_inset; | 150 const int h = bounds.height() + border->height(); |
153 | 151 |
154 // The tabstrip border image height is 2*scale pixels, but only the bottom 2 | 152 // 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 | 153 // 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. | 154 // the toolbar image below this transparent upper area when scale > 1. |
157 const int fill_y = y + canvas->image_scale() - 1; | 155 const int fill_y = y + canvas->image_scale() - 1; |
158 const int fill_height = bounds.bottom() - fill_y; | 156 const int fill_height = bounds.bottom() - fill_y; |
159 | 157 |
160 // Draw the toolbar fill. | 158 // Draw the toolbar fill. |
161 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), | 159 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), |
162 x + GetThemeBackgroundXInset(), | 160 x + GetThemeBackgroundXInset(), |
163 fill_y - GetTopInset(false), x, fill_y, w, fill_height); | 161 fill_y - GetTopInset(false), x, fill_y, w, fill_height); |
164 | 162 |
165 // Draw the tabstrip/toolbar separator. | 163 // Draw the tabstrip/toolbar separator. |
166 canvas->TileImageInt(*border, 0, 0, x, y, w, border->height()); | 164 canvas->TileImageInt(*border, 0, 0, x, y, w, border->height()); |
167 | 165 |
168 // Draw the content/toolbar separator. | 166 // Draw the content/toolbar separator. |
169 canvas->FillRect( | 167 canvas->FillRect( |
170 gfx::Rect(x, y + h - kClientEdgeThickness, w, kClientEdgeThickness), | 168 gfx::Rect(x, y + h - kClientEdgeThickness, w, kClientEdgeThickness), |
171 ThemeProperties::GetDefaultColor( | 169 ThemeProperties::GetDefaultColor( |
172 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR, | 170 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR, |
173 browser_view()->IsIncognito())); | 171 browser_view()->IsIncognito())); |
174 } | 172 } |
OLD | NEW |