OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "webkit/glue/webthemeengine_impl_mac.h" | 5 #include "webkit/glue/webthemeengine_impl_mac.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
| 9 #include "skia/ext/skia_utils_mac.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
11 | 12 |
12 #if WEBKIT_USING_SKIA | |
13 #include "skia/ext/skia_utils_mac.h" | |
14 #endif | |
15 | |
16 using WebKit::WebCanvas; | 13 using WebKit::WebCanvas; |
17 using WebKit::WebRect; | 14 using WebKit::WebRect; |
18 using WebKit::WebThemeEngine; | 15 using WebKit::WebThemeEngine; |
19 | 16 |
20 namespace webkit_glue { | 17 namespace webkit_glue { |
21 | 18 |
22 static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) { | 19 static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) { |
23 switch (state) { | 20 switch (state) { |
24 case WebThemeEngine::StateDisabled: | 21 case WebThemeEngine::StateDisabled: |
25 return kThemeTrackDisabled; | 22 return kThemeTrackDisabled; |
(...skipping 23 matching lines...) Expand all Loading... |
49 if (scrollbarInfo.orientation == | 46 if (scrollbarInfo.orientation == |
50 WebThemeEngine::ScrollbarOrientationHorizontal) { | 47 WebThemeEngine::ScrollbarOrientationHorizontal) { |
51 trackInfo.attributes |= kThemeTrackHorizontal; | 48 trackInfo.attributes |= kThemeTrackHorizontal; |
52 } | 49 } |
53 | 50 |
54 trackInfo.enableState = stateToHIEnableState(state); | 51 trackInfo.enableState = stateToHIEnableState(state); |
55 | 52 |
56 trackInfo.trackInfo.scrollbar.pressState = | 53 trackInfo.trackInfo.scrollbar.pressState = |
57 state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; | 54 state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; |
58 trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); | 55 trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); |
59 #if WEBKIT_USING_SKIA | |
60 gfx::SkiaBitLocker bitLocker(canvas); | 56 gfx::SkiaBitLocker bitLocker(canvas); |
61 CGContextRef cgContext = bitLocker.cgContext(); | 57 CGContextRef cgContext = bitLocker.cgContext(); |
62 #else | |
63 CGContextRef cgContext = canvas; | |
64 #endif | |
65 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); | 58 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); |
66 } | 59 } |
67 | 60 |
68 } // namespace webkit_glue | 61 } // namespace webkit_glue |
OLD | NEW |