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

Side by Side Diff: content/child/webthemeengine_impl_mac.cc

Issue 542903002: Do the murdering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « content/child/webthemeengine_impl_mac.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 "content/child/webthemeengine_impl_mac.h"
6
7 #include <Carbon/Carbon.h>
8
9 #include "skia/ext/skia_utils_mac.h"
10 #include "third_party/WebKit/public/platform/WebCanvas.h"
11 #include "third_party/WebKit/public/platform/WebRect.h"
12
13 using blink::WebCanvas;
14 using blink::WebRect;
15 using blink::WebThemeEngine;
16
17 namespace content {
18
19 static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) {
20 switch (state) {
21 case WebThemeEngine::StateDisabled:
22 return kThemeTrackDisabled;
23 case WebThemeEngine::StateInactive:
24 return kThemeTrackInactive;
25 default:
26 return kThemeTrackActive;
27 }
28 }
29
30 void WebThemeEngineImpl::paintScrollbarThumb(
31 WebCanvas* canvas,
32 WebThemeEngine::State state,
33 WebThemeEngine::Size size,
34 const WebRect& rect,
35 const WebThemeEngine::ScrollbarInfo& scrollbarInfo) {
36 HIThemeTrackDrawInfo trackInfo;
37 trackInfo.version = 0;
38 trackInfo.kind = size == WebThemeEngine::SizeRegular ?
39 kThemeMediumScrollBar : kThemeSmallScrollBar;
40 trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height);
41 trackInfo.min = 0;
42 trackInfo.max = scrollbarInfo.maxValue;
43 trackInfo.value = scrollbarInfo.currentValue;
44 trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize;
45 trackInfo.attributes = 0;
46 if (scrollbarInfo.orientation ==
47 WebThemeEngine::ScrollbarOrientationHorizontal) {
48 trackInfo.attributes |= kThemeTrackHorizontal;
49 }
50
51 trackInfo.enableState = stateToHIEnableState(state);
52
53 trackInfo.trackInfo.scrollbar.pressState =
54 state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0;
55 trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack);
56 gfx::SkiaBitLocker bitLocker(canvas);
57 CGContextRef cgContext = bitLocker.cgContext();
58 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal);
59 }
60
61 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webthemeengine_impl_mac.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698