OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/glue/webcursor.h" | 5 #include "webkit/glue/webcursor.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // See comment above |GetInvisibleCustomCursor()|. | 146 // See comment above |GetInvisibleCustomCursor()|. |
147 #if !GTK_CHECK_VERSION(2, 16, 0) | 147 #if !GTK_CHECK_VERSION(2, 16, 0) |
148 return GDK_CURSOR_IS_PIXMAP; | 148 return GDK_CURSOR_IS_PIXMAP; |
149 #else | 149 #else |
150 return GDK_BLANK_CURSOR; | 150 return GDK_BLANK_CURSOR; |
151 #endif | 151 #endif |
152 case WebCursorInfo::TypeNotAllowed: | 152 case WebCursorInfo::TypeNotAllowed: |
153 NOTIMPLEMENTED(); return GDK_LAST_CURSOR; | 153 NOTIMPLEMENTED(); return GDK_LAST_CURSOR; |
154 case WebCursorInfo::TypeZoomIn: | 154 case WebCursorInfo::TypeZoomIn: |
155 case WebCursorInfo::TypeZoomOut: | 155 case WebCursorInfo::TypeZoomOut: |
| 156 case WebCursorInfo::TypeGrab: |
| 157 case WebCursorInfo::TypeGrabbing: |
156 case WebCursorInfo::TypeCustom: | 158 case WebCursorInfo::TypeCustom: |
157 return GDK_CURSOR_IS_PIXMAP; | 159 return GDK_CURSOR_IS_PIXMAP; |
158 } | 160 } |
159 NOTREACHED(); | 161 NOTREACHED(); |
160 return GDK_LAST_CURSOR; | 162 return GDK_LAST_CURSOR; |
161 } | 163 } |
162 | 164 |
163 gfx::NativeCursor WebCursor::GetNativeCursor() { | 165 gfx::NativeCursor WebCursor::GetNativeCursor() { |
164 int type = GetCursorType(); | 166 int type = GetCursorType(); |
165 if (type == GDK_CURSOR_IS_PIXMAP) | 167 if (type == GDK_CURSOR_IS_PIXMAP) |
166 return GetCustomCursor(); | 168 return GetCustomCursor(); |
167 return gfx::GetCursor(type); | 169 return gfx::GetCursor(type); |
168 } | 170 } |
169 | 171 |
170 GdkCursor* WebCursor::GetCustomCursor() { | 172 GdkCursor* WebCursor::GetCustomCursor() { |
171 switch (type_) { | 173 switch (type_) { |
172 // See comment above |GetInvisibleCustomCursor()|. | 174 // See comment above |GetInvisibleCustomCursor()|. |
173 #if !GTK_CHECK_VERSION(2, 16, 0) | 175 #if !GTK_CHECK_VERSION(2, 16, 0) |
174 case WebCursorInfo::TypeNone: | 176 case WebCursorInfo::TypeNone: |
175 return GetInvisibleCustomCursor(); | 177 return GetInvisibleCustomCursor(); |
176 #endif | 178 #endif |
177 case WebCursorInfo::TypeZoomIn: | 179 case WebCursorInfo::TypeZoomIn: |
178 return GetInlineCustomCursor(CustomCursorZoomIn); | 180 return GetInlineCustomCursor(CustomCursorZoomIn); |
179 case WebCursorInfo::TypeZoomOut: | 181 case WebCursorInfo::TypeZoomOut: |
180 return GetInlineCustomCursor(CustomCursorZoomOut); | 182 return GetInlineCustomCursor(CustomCursorZoomOut); |
| 183 case WebCursorInfo::TypeGrab: |
| 184 return GetInlineCustomCursor(CustomCursorGrab); |
| 185 case WebCursorInfo::TypeGrabbing: |
| 186 return GetInlineCustomCursor(CustomCursorGrabbing); |
181 } | 187 } |
182 | 188 |
183 if (type_ != WebCursorInfo::TypeCustom) { | 189 if (type_ != WebCursorInfo::TypeCustom) { |
184 NOTREACHED(); | 190 NOTREACHED(); |
185 return NULL; | 191 return NULL; |
186 } | 192 } |
187 | 193 |
188 SkBitmap bitmap; | 194 SkBitmap bitmap; |
189 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 195 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
190 custom_size_.width(), custom_size_.height()); | 196 custom_size_.width(), custom_size_.height()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 unref_ = NULL; | 234 unref_ = NULL; |
229 } | 235 } |
230 return; | 236 return; |
231 } | 237 } |
232 | 238 |
233 void WebCursor::CopyPlatformData(const WebCursor& other) { | 239 void WebCursor::CopyPlatformData(const WebCursor& other) { |
234 if (other.unref_) | 240 if (other.unref_) |
235 unref_ = gdk_cursor_ref(other.unref_); | 241 unref_ = gdk_cursor_ref(other.unref_); |
236 return; | 242 return; |
237 } | 243 } |
OLD | NEW |