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