diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-15 17:18:41 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-15 17:18:41 +0000 |
commit | 152fd7f7abd3ee8770b9cab2b53d99da435d4f45 (patch) | |
tree | 14d3465fd3fe62d2faf17ab0e154dd609a8ce1a4 /webkit/renderer | |
parent | dca8b23d3228cccdd298e2ab6a511b6c110849b1 (diff) | |
download | chromium_src-152fd7f7abd3ee8770b9cab2b53d99da435d4f45.zip chromium_src-152fd7f7abd3ee8770b9cab2b53d99da435d4f45.tar.gz chromium_src-152fd7f7abd3ee8770b9cab2b53d99da435d4f45.tar.bz2 |
move webkit/glue/cursor_utils* to webkit/renderer/
R=jamesr@chromium.org
BUG=239107
Review URL: https://chromiumcodereview.appspot.com/17120003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/renderer')
-rw-r--r-- | webkit/renderer/cursor_utils.cc | 43 | ||||
-rw-r--r-- | webkit/renderer/cursor_utils.h | 29 |
2 files changed, 72 insertions, 0 deletions
diff --git a/webkit/renderer/cursor_utils.cc b/webkit/renderer/cursor_utils.cc new file mode 100644 index 0000000..87f305b --- /dev/null +++ b/webkit/renderer/cursor_utils.cc @@ -0,0 +1,43 @@ +// Copyright 2013 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/renderer/cursor_utils.h" + +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" + +using WebKit::WebCursorInfo; + +namespace webkit_glue { + +bool GetWebKitCursorInfo(const WebCursor& cursor, + WebCursorInfo* webkit_cursor_info) { + WebCursor::CursorInfo cursor_info; + cursor.GetCursorInfo(&cursor_info); + + webkit_cursor_info->type = cursor_info.type; + webkit_cursor_info->hotSpot = cursor_info.hotspot; + webkit_cursor_info->customImage = cursor_info.custom_image; + webkit_cursor_info->imageScaleFactor = cursor_info.image_scale_factor; +#if defined(OS_WIN) + webkit_cursor_info->externalHandle = cursor_info.external_handle; +#endif + return true; +} + +void InitializeCursorFromWebKitCursorInfo( + WebCursor* cursor, + const WebCursorInfo& webkit_cursor_info) { + WebCursor::CursorInfo web_cursor_info; + web_cursor_info.type = webkit_cursor_info.type; + web_cursor_info.image_scale_factor = webkit_cursor_info.imageScaleFactor; + web_cursor_info.hotspot = webkit_cursor_info.hotSpot; + web_cursor_info.custom_image = webkit_cursor_info.customImage.getSkBitmap(); +#if defined(OS_WIN) + web_cursor_info.external_handle = webkit_cursor_info.externalHandle; +#endif + cursor->InitFromCursorInfo(web_cursor_info); +} + +} // namespce webkit_glue + diff --git a/webkit/renderer/cursor_utils.h b/webkit/renderer/cursor_utils.h new file mode 100644 index 0000000..3e261cb --- /dev/null +++ b/webkit/renderer/cursor_utils.h @@ -0,0 +1,29 @@ +// Copyright 2013 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. + +#ifndef WEBKIT_RENDERER_CURSOR_UTILS_H_ +#define WEBKIT_RENDERER_CURSOR_UTILS_H_ + +#include "webkit/common/cursors/webcursor.h" +#include "webkit/renderer/webkit_renderer_export.h" + +namespace WebKit { +struct WebCursorInfo; +}; + +namespace webkit_glue { + +// Adapts our cursor info to WebKit::WebCursorInfo. +WEBKIT_RENDERER_EXPORT bool GetWebKitCursorInfo( + const WebCursor& cursor, + WebKit::WebCursorInfo* webkit_cursor_info); + +// Adapts WebKit::CursorInfo to our cursor. +WEBKIT_RENDERER_EXPORT void InitializeCursorFromWebKitCursorInfo( + WebCursor* cursor, + const WebKit::WebCursorInfo& webkit_cursor_info); + +} // namespace webkit_glue + +#endif // WEBKIT_RENDERER_CURSOR_UTILS_H_ |