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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webthemeengine_impl_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webthemeengine_impl_mac.cc
===================================================================
--- webkit/glue/webthemeengine_impl_mac.cc (revision 0)
+++ webkit/glue/webthemeengine_impl_mac.cc (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/glue/webthemeengine_impl_mac.h"
+
+#include <Carbon/Carbon.h>
darin (slow to review) 2010/12/23 07:24:24 nit: we usually put a new line between system head
+#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
+
+using WebKit::WebCanvas;
+using WebKit::WebRect;
+using WebKit::WebThemeEngine;
+
+namespace webkit_glue {
+
+static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) {
+ switch (state) {
+ case WebThemeEngine::StateDisabled:
+ return kThemeTrackDisabled;
+ case WebThemeEngine::StateInactive:
+ return kThemeTrackInactive;
+ default:
+ return kThemeTrackActive;
+ }
+}
+
+void WebThemeEngineImpl::paintScrollbarThumb(
+ WebCanvas* canvas,
+ WebThemeEngine::State state,
+ WebThemeEngine::Size size,
+ const WebRect& rect,
+ const WebThemeEngine::ScrollbarInfo& scrollbarInfo) {
+ HIThemeTrackDrawInfo trackInfo;
+ trackInfo.version = 0;
+ trackInfo.kind = size == WebThemeEngine::SizeRegular ?
+ kThemeMediumScrollBar : kThemeSmallScrollBar;
+ trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height);
+ trackInfo.min = 0;
+ trackInfo.max = scrollbarInfo.maxValue;
+ trackInfo.value = scrollbarInfo.currentValue;
+ trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize;
+ trackInfo.attributes = 0;
+ if (scrollbarInfo.orientation ==
+ WebThemeEngine::ScrollbarOrientationHorizontal) {
+ trackInfo.attributes |= kThemeTrackHorizontal;
+ }
+
+ trackInfo.enableState = stateToHIEnableState(state);
+
+ trackInfo.trackInfo.scrollbar.pressState =
+ state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0;
+ trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack);
+ HIThemeDrawTrack(&trackInfo, 0, canvas, kHIThemeOrientationNormal);
+}
+} // namespace webkit_glue
darin (slow to review) 2010/12/23 07:24:24 nit: add a new line above here.
Property changes on: webkit/glue/webthemeengine_impl_mac.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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