From a3d79ab709a169177f8f82852e6bfe4ab81bc1a1 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Tue, 10 Mar 2009 18:52:09 +0000 Subject: Adds WebThemeEngine, WebColor, and WebCanvas to the WebKit API (chrome-side). R=dglazkov Review URL: http://codereview.chromium.org/40330 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11351 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webthemeengine_impl_win.cc | 103 +++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 webkit/glue/webthemeengine_impl_win.cc (limited to 'webkit/glue/webthemeengine_impl_win.cc') diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc new file mode 100644 index 0000000..f06921c --- /dev/null +++ b/webkit/glue/webthemeengine_impl_win.cc @@ -0,0 +1,103 @@ +// Copyright (c) 2009 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_win.h" + +#include "WebRect.h" + +#include "base/gfx/native_theme.h" + +using WebKit::WebCanvas; +using WebKit::WebColor; +using WebKit::WebRect; + +namespace webkit_glue { + +static RECT WebRectToRECT(const WebRect& rect) { + RECT result; + result.left = rect.x; + result.top = rect.y; + result.right = rect.x + rect.width; + result.bottom = rect.y + rect.height; + return result; +} + +void WebThemeEngineImpl::paintButton( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + HDC hdc = canvas->beginPlatformPaint(); + + RECT native_rect = WebRectToRECT(rect); + gfx::NativeTheme::instance()->PaintButton( + hdc, part, state, classic_state, &native_rect); + + canvas->endPlatformPaint(); +} + +void WebThemeEngineImpl::paintMenuList( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + HDC hdc = canvas->beginPlatformPaint(); + + RECT native_rect = WebRectToRECT(rect); + gfx::NativeTheme::instance()->PaintMenuList( + hdc, part, state, classic_state, &native_rect); + + canvas->endPlatformPaint(); +} + +void WebThemeEngineImpl::paintScrollbarArrow( + WebCanvas* canvas, int state, int classic_state, + const WebRect& rect) { + HDC hdc = canvas->beginPlatformPaint(); + + RECT native_rect = WebRectToRECT(rect); + gfx::NativeTheme::instance()->PaintScrollbarArrow( + hdc, state, classic_state, &native_rect); + + canvas->endPlatformPaint(); +} + +void WebThemeEngineImpl::paintScrollbarThumb( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect) { + HDC hdc = canvas->beginPlatformPaint(); + + RECT native_rect = WebRectToRECT(rect); + gfx::NativeTheme::instance()->PaintScrollbarThumb( + hdc, part, state, classic_state, &native_rect); + + canvas->endPlatformPaint(); +} + +void WebThemeEngineImpl::paintScrollbarTrack( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect, const WebRect& align_rect) { + HDC hdc = canvas->beginPlatformPaint(); + + RECT native_rect = WebRectToRECT(rect); + RECT native_align_rect = WebRectToRECT(align_rect); + gfx::NativeTheme::instance()->PaintScrollbarTrack( + hdc, part, state, classic_state, &native_rect, &native_align_rect, + canvas); + + canvas->endPlatformPaint(); +} + +void WebThemeEngineImpl::paintTextField( + WebCanvas* canvas, int part, int state, int classic_state, + const WebRect& rect, WebColor color, bool fill_content_area, + bool draw_edges) { + HDC hdc = canvas->beginPlatformPaint(); + + RECT native_rect = WebRectToRECT(rect); + + gfx::NativeTheme::instance()->PaintTextField( + hdc, part, state, classic_state, &native_rect, color, fill_content_area, + draw_edges); + + canvas->endPlatformPaint(); +} + +} // namespace webkit_glue -- cgit v1.1