OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/tabs/tab_resources.h" | 5 #include "chrome/browser/ui/tabs/tab_resources.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gfx/path.h" | 8 #include "ui/gfx/path.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 // Hit mask constants. | 12 // Hit mask constants. |
13 const SkScalar kTabCapWidth = 15; | 13 const SkScalar kTabCapWidth = 15; |
14 const SkScalar kTabTopCurveWidth = 4; | 14 const SkScalar kTabTopCurveWidth = 4; |
15 const SkScalar kTabBottomCurveWidth = 3; | 15 const SkScalar kTabBottomCurveWidth = 3; |
16 #if defined(TOOLKIT_VIEWS) | 16 #if defined(OS_MACOSX) |
17 // Windows and Ash have shadows in the left, right and top parts of the tab. | 17 // Mac's Cocoa UI doesn't have shadows. |
| 18 const SkScalar kTabInset = 0; |
| 19 const SkScalar kTabTop = 0; |
| 20 #elif defined(TOOLKIT_VIEWS) |
| 21 // The views browser UI has shadows in the left, right and top parts of the tab. |
18 const SkScalar kTabInset = 6; | 22 const SkScalar kTabInset = 6; |
19 const SkScalar kTabTop = 2; | 23 const SkScalar kTabTop = 2; |
20 #else | |
21 // Linux GTK and Mac don't have the shadows. | |
22 const SkScalar kTabInset = 0; | |
23 const SkScalar kTabTop = 0; | |
24 #endif | 24 #endif |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 // static | 28 // static |
29 void TabResources::GetHitTestMask(int width, | 29 void TabResources::GetHitTestMask(int width, |
30 int height, | 30 int height, |
31 bool include_top_shadow, | 31 bool include_top_shadow, |
32 gfx::Path* path) { | 32 gfx::Path* path) { |
33 DCHECK(path); | 33 DCHECK(path); |
(...skipping 24 matching lines...) Expand all Loading... |
58 // Right end cap. | 58 // Right end cap. |
59 path->lineTo(right - kTabCapWidth + kTabTopCurveWidth, | 59 path->lineTo(right - kTabCapWidth + kTabTopCurveWidth, |
60 top + kTabTopCurveWidth); | 60 top + kTabTopCurveWidth); |
61 path->lineTo(right - kTabBottomCurveWidth, bottom - kTabBottomCurveWidth); | 61 path->lineTo(right - kTabBottomCurveWidth, bottom - kTabBottomCurveWidth); |
62 path->lineTo(right, bottom); | 62 path->lineTo(right, bottom); |
63 | 63 |
64 // Close out the path. | 64 // Close out the path. |
65 path->lineTo(left, bottom); | 65 path->lineTo(left, bottom); |
66 path->close(); | 66 path->close(); |
67 } | 67 } |
OLD | NEW |