summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcursor_win.cc
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 21:49:30 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 21:49:30 +0000
commit7c51b0ee951bf8ed70d0ed6506567991c611d070 (patch)
tree0d559aad012f55a540a990143bd1d9264e240319 /webkit/glue/webcursor_win.cc
parent03ce3cd72a2bb330c774f47cea4ad346d5c26cad (diff)
downloadchromium_src-7c51b0ee951bf8ed70d0ed6506567991c611d070.zip
chromium_src-7c51b0ee951bf8ed70d0ed6506567991c611d070.tar.gz
chromium_src-7c51b0ee951bf8ed70d0ed6506567991c611d070.tar.bz2
Start using WebCursorInfo from the WebKit API. WebCursorInfo is a
lightweight struct containing a description of a cursor that the embedder should render. WebCursor still exists. Instead of WebCursor initializing from a PlatformCursor, it now initializes from a WebCursorInfo. TEST=none BUG=10039 R=jam Review URL: http://codereview.chromium.org/155172 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webcursor_win.cc')
-rw-r--r--webkit/glue/webcursor_win.cc133
1 files changed, 64 insertions, 69 deletions
diff --git a/webkit/glue/webcursor_win.cc b/webkit/glue/webcursor_win.cc
index 02cb52e..c1d7556 100644
--- a/webkit/glue/webcursor_win.cc
+++ b/webkit/glue/webcursor_win.cc
@@ -2,103 +2,99 @@
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
-#include "config.h"
-#include "NativeImageSkia.h"
-#include "PlatformCursor.h"
-
-#undef LOG
#include "base/gfx/gdi_util.h"
#include "base/logging.h"
#include "base/pickle.h"
#include "grit/webkit_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "webkit/api/public/WebCursorInfo.h"
#include "webkit/glue/webcursor.h"
-using WebCore::PlatformCursor;
+using WebKit::WebCursorInfo;
-static LPCWSTR ToCursorID(PlatformCursor::Type type) {
+static LPCWSTR ToCursorID(WebCursorInfo::Type type) {
switch (type) {
- case PlatformCursor::TypePointer:
+ case WebCursorInfo::TypePointer:
return IDC_ARROW;
- case PlatformCursor::TypeCross:
+ case WebCursorInfo::TypeCross:
return IDC_CROSS;
- case PlatformCursor::TypeHand:
+ case WebCursorInfo::TypeHand:
return IDC_HAND;
- case PlatformCursor::TypeIBeam:
+ case WebCursorInfo::TypeIBeam:
return IDC_IBEAM;
- case PlatformCursor::TypeWait:
+ case WebCursorInfo::TypeWait:
return IDC_WAIT;
- case PlatformCursor::TypeHelp:
+ case WebCursorInfo::TypeHelp:
return IDC_HELP;
- case PlatformCursor::TypeEastResize:
+ case WebCursorInfo::TypeEastResize:
return IDC_SIZEWE;
- case PlatformCursor::TypeNorthResize:
+ case WebCursorInfo::TypeNorthResize:
return IDC_SIZENS;
- case PlatformCursor::TypeNorthEastResize:
+ case WebCursorInfo::TypeNorthEastResize:
return IDC_SIZENESW;
- case PlatformCursor::TypeNorthWestResize:
+ case WebCursorInfo::TypeNorthWestResize:
return IDC_SIZENWSE;
- case PlatformCursor::TypeSouthResize:
+ case WebCursorInfo::TypeSouthResize:
return IDC_SIZENS;
- case PlatformCursor::TypeSouthEastResize:
+ case WebCursorInfo::TypeSouthEastResize:
return IDC_SIZENWSE;
- case PlatformCursor::TypeSouthWestResize:
+ case WebCursorInfo::TypeSouthWestResize:
return IDC_SIZENESW;
- case PlatformCursor::TypeWestResize:
+ case WebCursorInfo::TypeWestResize:
return IDC_SIZEWE;
- case PlatformCursor::TypeNorthSouthResize:
+ case WebCursorInfo::TypeNorthSouthResize:
return IDC_SIZENS;
- case PlatformCursor::TypeEastWestResize:
+ case WebCursorInfo::TypeEastWestResize:
return IDC_SIZEWE;
- case PlatformCursor::TypeNorthEastSouthWestResize:
+ case WebCursorInfo::TypeNorthEastSouthWestResize:
return IDC_SIZENESW;
- case PlatformCursor::TypeNorthWestSouthEastResize:
+ case WebCursorInfo::TypeNorthWestSouthEastResize:
return IDC_SIZENWSE;
- case PlatformCursor::TypeColumnResize:
+ case WebCursorInfo::TypeColumnResize:
return MAKEINTRESOURCE(IDC_COLRESIZE);
- case PlatformCursor::TypeRowResize:
+ case WebCursorInfo::TypeRowResize:
return MAKEINTRESOURCE(IDC_ROWRESIZE);
- case PlatformCursor::TypeMiddlePanning:
+ case WebCursorInfo::TypeMiddlePanning:
return MAKEINTRESOURCE(IDC_PAN_MIDDLE);
- case PlatformCursor::TypeEastPanning:
+ case WebCursorInfo::TypeEastPanning:
return MAKEINTRESOURCE(IDC_PAN_EAST);
- case PlatformCursor::TypeNorthPanning:
+ case WebCursorInfo::TypeNorthPanning:
return MAKEINTRESOURCE(IDC_PAN_NORTH);
- case PlatformCursor::TypeNorthEastPanning:
+ case WebCursorInfo::TypeNorthEastPanning:
return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST);
- case PlatformCursor::TypeNorthWestPanning:
+ case WebCursorInfo::TypeNorthWestPanning:
return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST);
- case PlatformCursor::TypeSouthPanning:
+ case WebCursorInfo::TypeSouthPanning:
return MAKEINTRESOURCE(IDC_PAN_SOUTH);
- case PlatformCursor::TypeSouthEastPanning:
+ case WebCursorInfo::TypeSouthEastPanning:
return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST);
- case PlatformCursor::TypeSouthWestPanning:
+ case WebCursorInfo::TypeSouthWestPanning:
return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST);
- case PlatformCursor::TypeWestPanning:
+ case WebCursorInfo::TypeWestPanning:
return MAKEINTRESOURCE(IDC_PAN_WEST);
- case PlatformCursor::TypeMove:
+ case WebCursorInfo::TypeMove:
return IDC_SIZEALL;
- case PlatformCursor::TypeVerticalText:
+ case WebCursorInfo::TypeVerticalText:
return MAKEINTRESOURCE(IDC_VERTICALTEXT);
- case PlatformCursor::TypeCell:
+ case WebCursorInfo::TypeCell:
return MAKEINTRESOURCE(IDC_CELL);
- case PlatformCursor::TypeContextMenu:
+ case WebCursorInfo::TypeContextMenu:
return MAKEINTRESOURCE(IDC_ARROW);
- case PlatformCursor::TypeAlias:
+ case WebCursorInfo::TypeAlias:
return MAKEINTRESOURCE(IDC_ALIAS);
- case PlatformCursor::TypeProgress:
+ case WebCursorInfo::TypeProgress:
return IDC_APPSTARTING;
- case PlatformCursor::TypeNoDrop:
+ case WebCursorInfo::TypeNoDrop:
return IDC_NO;
- case PlatformCursor::TypeCopy:
+ case WebCursorInfo::TypeCopy:
return MAKEINTRESOURCE(IDC_COPYCUR);
- case PlatformCursor::TypeNone:
+ case WebCursorInfo::TypeNone:
return IDC_ARROW;
- case PlatformCursor::TypeNotAllowed:
+ case WebCursorInfo::TypeNotAllowed:
return IDC_NO;
- case PlatformCursor::TypeZoomIn:
+ case WebCursorInfo::TypeZoomIn:
return MAKEINTRESOURCE(IDC_ZOOMIN);
- case PlatformCursor::TypeZoomOut:
+ case WebCursorInfo::TypeZoomOut:
return MAKEINTRESOURCE(IDC_ZOOMOUT);
}
NOTREACHED();
@@ -109,36 +105,36 @@ static bool IsSystemCursorID(LPCWSTR cursor_id) {
return cursor_id >= IDC_ARROW; // See WinUser.h
}
-static PlatformCursor::Type ToPlatformCursorType(HCURSOR cursor) {
+static WebCursorInfo::Type ToCursorType(HCURSOR cursor) {
static struct {
HCURSOR cursor;
- PlatformCursor::Type type;
+ WebCursorInfo::Type type;
} kStandardCursors[] = {
- { LoadCursor(NULL, IDC_ARROW), PlatformCursor::TypePointer },
- { LoadCursor(NULL, IDC_IBEAM), PlatformCursor::TypeIBeam },
- { LoadCursor(NULL, IDC_WAIT), PlatformCursor::TypeWait },
- { LoadCursor(NULL, IDC_CROSS), PlatformCursor::TypeCross },
- { LoadCursor(NULL, IDC_SIZENWSE), PlatformCursor::TypeNorthWestResize },
- { LoadCursor(NULL, IDC_SIZENESW), PlatformCursor::TypeNorthEastResize },
- { LoadCursor(NULL, IDC_SIZEWE), PlatformCursor::TypeEastWestResize },
- { LoadCursor(NULL, IDC_SIZENS), PlatformCursor::TypeNorthSouthResize },
- { LoadCursor(NULL, IDC_SIZEALL), PlatformCursor::TypeMove },
- { LoadCursor(NULL, IDC_NO), PlatformCursor::TypeNotAllowed },
- { LoadCursor(NULL, IDC_HAND), PlatformCursor::TypeHand },
- { LoadCursor(NULL, IDC_APPSTARTING), PlatformCursor::TypeProgress },
- { LoadCursor(NULL, IDC_HELP), PlatformCursor::TypeHelp },
+ { LoadCursor(NULL, IDC_ARROW), WebCursorInfo::TypePointer },
+ { LoadCursor(NULL, IDC_IBEAM), WebCursorInfo::TypeIBeam },
+ { LoadCursor(NULL, IDC_WAIT), WebCursorInfo::TypeWait },
+ { LoadCursor(NULL, IDC_CROSS), WebCursorInfo::TypeCross },
+ { LoadCursor(NULL, IDC_SIZENWSE), WebCursorInfo::TypeNorthWestResize },
+ { LoadCursor(NULL, IDC_SIZENESW), WebCursorInfo::TypeNorthEastResize },
+ { LoadCursor(NULL, IDC_SIZEWE), WebCursorInfo::TypeEastWestResize },
+ { LoadCursor(NULL, IDC_SIZENS), WebCursorInfo::TypeNorthSouthResize },
+ { LoadCursor(NULL, IDC_SIZEALL), WebCursorInfo::TypeMove },
+ { LoadCursor(NULL, IDC_NO), WebCursorInfo::TypeNotAllowed },
+ { LoadCursor(NULL, IDC_HAND), WebCursorInfo::TypeHand },
+ { LoadCursor(NULL, IDC_APPSTARTING), WebCursorInfo::TypeProgress },
+ { LoadCursor(NULL, IDC_HELP), WebCursorInfo::TypeHelp },
};
for (int i = 0; i < arraysize(kStandardCursors); i++) {
if (cursor == kStandardCursors[i].cursor)
return kStandardCursors[i].type;
}
- return PlatformCursor::TypeCustom;
+ return WebCursorInfo::TypeCustom;
}
HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){
if (!IsCustom()) {
const wchar_t* cursor_id =
- ToCursorID(static_cast<PlatformCursor::Type>(type_));
+ ToCursorID(static_cast<WebCursorInfo::Type>(type_));
if (IsSystemCursorID(cursor_id))
module_handle = NULL;
@@ -190,13 +186,12 @@ HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){
}
void WebCursor::InitFromExternalCursor(HCURSOR cursor) {
- WebCore::PlatformCursor::Type cursor_type = ToPlatformCursorType(cursor);
+ WebCursorInfo::Type cursor_type = ToCursorType(cursor);
- *this = WebCursor(cursor_type);
+ InitFromCursorInfo(WebCursorInfo(cursor_type));
- if (cursor_type == WebCore::PlatformCursor::TypeCustom) {
+ if (cursor_type == WebCursorInfo::TypeCustom)
external_cursor_ = cursor;
- }
}
void WebCursor::InitPlatformData() {