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

Side by Side Diff: webkit/glue/webthemeengine_impl_mac.cc

Issue 6041005: Add implementation of WebThemeEngine for the Mac (declared by... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
« no previous file with comments | « webkit/glue/webthemeengine_impl_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 "webkit/glue/webthemeengine_impl_mac.h"
6
7 #include <Carbon/Carbon.h>
darin (slow to review) 2010/12/23 07:24:24 nit: we usually put a new line between system head
8 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
10
11 using WebKit::WebCanvas;
12 using WebKit::WebRect;
13 using WebKit::WebThemeEngine;
14
15 namespace webkit_glue {
16
17 static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) {
18 switch (state) {
19 case WebThemeEngine::StateDisabled:
20 return kThemeTrackDisabled;
21 case WebThemeEngine::StateInactive:
22 return kThemeTrackInactive;
23 default:
24 return kThemeTrackActive;
25 }
26 }
27
28 void WebThemeEngineImpl::paintScrollbarThumb(
29 WebCanvas* canvas,
30 WebThemeEngine::State state,
31 WebThemeEngine::Size size,
32 const WebRect& rect,
33 const WebThemeEngine::ScrollbarInfo& scrollbarInfo) {
34 HIThemeTrackDrawInfo trackInfo;
35 trackInfo.version = 0;
36 trackInfo.kind = size == WebThemeEngine::SizeRegular ?
37 kThemeMediumScrollBar : kThemeSmallScrollBar;
38 trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height);
39 trackInfo.min = 0;
40 trackInfo.max = scrollbarInfo.maxValue;
41 trackInfo.value = scrollbarInfo.currentValue;
42 trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize;
43 trackInfo.attributes = 0;
44 if (scrollbarInfo.orientation ==
45 WebThemeEngine::ScrollbarOrientationHorizontal) {
46 trackInfo.attributes |= kThemeTrackHorizontal;
47 }
48
49 trackInfo.enableState = stateToHIEnableState(state);
50
51 trackInfo.trackInfo.scrollbar.pressState =
52 state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0;
53 trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack);
54 HIThemeDrawTrack(&trackInfo, 0, canvas, kHIThemeOrientationNormal);
55 }
56 } // namespace webkit_glue
darin (slow to review) 2010/12/23 07:24:24 nit: add a new line above here.
OLDNEW
« no previous file with comments | « webkit/glue/webthemeengine_impl_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698