summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcursor_mac.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 21:29:36 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 21:29:36 +0000
commit11e04ce0c6a47c3fc6561816c01656875292622d (patch)
treeda0826ec7e19ce06c42e1d65cd4b5166627ae8aa /webkit/glue/webcursor_mac.mm
parent4f6e87b9b51b050d45eb2f1175f80de94dd5892b (diff)
downloadchromium_src-11e04ce0c6a47c3fc6561816c01656875292622d.zip
chromium_src-11e04ce0c6a47c3fc6561816c01656875292622d.tar.gz
chromium_src-11e04ce0c6a47c3fc6561816c01656875292622d.tar.bz2
Implement the grab/grabbing cursors (for Mac/GTK).
BUG=73356 TEST=comment 12 on the bug has a test page; ensure the last two cursors (grab and grabbing) show open and closed hand cursors (respectively) and don't crash Review URL: http://codereview.chromium.org/6591105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webcursor_mac.mm')
-rw-r--r--webkit/glue/webcursor_mac.mm19
1 files changed, 15 insertions, 4 deletions
diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm
index 680521d..da80efa 100644
--- a/webkit/glue/webcursor_mac.mm
+++ b/webkit/glue/webcursor_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -153,6 +153,10 @@ NSCursor* WebCursor::GetCursor() const {
return LoadCursor("zoomInCursor", 7, 7);
case WebCursorInfo::TypeZoomOut:
return LoadCursor("zoomOutCursor", 7, 7);
+ case WebCursorInfo::TypeGrab:
+ return [NSCursor openHandCursor];
+ case WebCursorInfo::TypeGrabbing:
+ return [NSCursor closedHandCursor];
case WebCursorInfo::TypeCustom:
return CreateCustomCursor(custom_data_, custom_size_, hotspot_);
}
@@ -192,7 +196,11 @@ void WebCursor::InitFromThemeCursor(ThemeCursor cursor) {
cursor_info.type = WebCursorInfo::TypeWait;
break;
case kThemeClosedHandCursor:
+ cursor_info.type = WebCursorInfo::TypeGrabbing;
+ break;
case kThemeOpenHandCursor:
+ cursor_info.type = WebCursorInfo::TypeGrab;
+ break;
case kThemePointingHandCursor:
case kThemeCountingUpHandCursor:
case kThemeCountingDownHandCursor:
@@ -297,10 +305,13 @@ void WebCursor::InitFromNSCursor(NSCursor* cursor) {
cursor_info.type = WebCursorInfo::TypeSouthResize;
} else if ([cursor isEqual:[NSCursor resizeUpDownCursor]]) {
cursor_info.type = WebCursorInfo::TypeNorthSouthResize;
+ } else if ([cursor isEqual:[NSCursor openHandCursor]]) {
+ cursor_info.type = WebCursorInfo::TypeGrab;
+ } else if ([cursor isEqual:[NSCursor closedHandCursor]]) {
+ cursor_info.type = WebCursorInfo::TypeGrabbing;
} else {
- // Also handles the [NSCursor closedHandCursor], [NSCursor openHandCursor],
- // and [NSCursor disappearingItemCursor] cases. Quick-and-dirty image
- // conversion; TODO(avi): do better.
+ // Also handles the [NSCursor disappearingItemCursor] case. Quick-and-dirty
+ // image conversion; TODO(avi): do better.
CGImageRef cg_image = nil;
NSImage* image = [cursor image];
for (id rep in [image representations]) {