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

Side by Side Diff: chrome/browser/ui/tabs/tab_resources.cc

Issue 7640004: Gtk: Make click target of tabs match their appearance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/tabs/tab_resources.h"
6
7 #include "base/logging.h"
8 #include "ui/gfx/path.h"
9
10 namespace {
11
12 // Hit mask constants.
13 static const SkScalar kTabCapWidth = 15;
James Hawkins 2011/08/11 23:41:19 Remove static since they're already in an unnamed
mattm 2011/08/11 23:59:47 Done.
14 static const SkScalar kTabTopCurveWidth = 4;
15 static const SkScalar kTabBottomCurveWidth = 3;
16
17 } // namespace
18
19 // static
20 void TabResources::GetHitTestMask(int width, int height, gfx::Path* path) {
21 DCHECK(path);
22
23 SkScalar h = SkIntToScalar(height);
24 SkScalar w = SkIntToScalar(width);
25
26 path->moveTo(0, h);
27
28 // Left end cap.
29 path->lineTo(kTabBottomCurveWidth, h - kTabBottomCurveWidth);
30 path->lineTo(kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth);
31 path->lineTo(kTabCapWidth, 0);
32
33 // Connect to the right cap.
34 path->lineTo(w - kTabCapWidth, 0);
35
36 // Right end cap.
37 path->lineTo(w - kTabCapWidth + kTabTopCurveWidth, kTabTopCurveWidth);
38 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth);
39 path->lineTo(w, h);
40
41 // Close out the path.
42 path->lineTo(0, h);
43 path->close();
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698