| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/cursors/webcursor.h" | 5 #include "webkit/common/cursors/webcursor.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return LoadCursor(IDR_LINK_CURSOR, 6, 1); | 206 return LoadCursor(IDR_LINK_CURSOR, 6, 1); |
| 207 case WebCursorInfo::TypeIBeam: | 207 case WebCursorInfo::TypeIBeam: |
| 208 return [NSCursor IBeamCursor]; | 208 return [NSCursor IBeamCursor]; |
| 209 case WebCursorInfo::TypeWait: | 209 case WebCursorInfo::TypeWait: |
| 210 return GetCoreCursorWithFallback(kBusyButClickableCursor, | 210 return GetCoreCursorWithFallback(kBusyButClickableCursor, |
| 211 IDR_WAIT_CURSOR, 7, 7); | 211 IDR_WAIT_CURSOR, 7, 7); |
| 212 case WebCursorInfo::TypeHelp: | 212 case WebCursorInfo::TypeHelp: |
| 213 return GetCoreCursorWithFallback(kHelpCursor, | 213 return GetCoreCursorWithFallback(kHelpCursor, |
| 214 IDR_HELP_CURSOR, 8, 8); | 214 IDR_HELP_CURSOR, 8, 8); |
| 215 case WebCursorInfo::TypeEastResize: | 215 case WebCursorInfo::TypeEastResize: |
| 216 case WebCursorInfo::TypeEastPanning: | |
| 217 return GetCoreCursorWithFallback(kResizeEastCursor, | 216 return GetCoreCursorWithFallback(kResizeEastCursor, |
| 218 IDR_EAST_RESIZE_CURSOR, 14, 7); | 217 IDR_EAST_RESIZE_CURSOR, 14, 7); |
| 219 case WebCursorInfo::TypeNorthResize: | 218 case WebCursorInfo::TypeNorthResize: |
| 220 case WebCursorInfo::TypeNorthPanning: | |
| 221 return GetCoreCursorWithFallback(kResizeNorthCursor, | 219 return GetCoreCursorWithFallback(kResizeNorthCursor, |
| 222 IDR_NORTH_RESIZE_CURSOR, 7, 1); | 220 IDR_NORTH_RESIZE_CURSOR, 7, 1); |
| 223 case WebCursorInfo::TypeNorthEastResize: | 221 case WebCursorInfo::TypeNorthEastResize: |
| 224 case WebCursorInfo::TypeNorthEastPanning: | |
| 225 return GetCoreCursorWithFallback(kResizeNortheastCursor, | 222 return GetCoreCursorWithFallback(kResizeNortheastCursor, |
| 226 IDR_NORTHEAST_RESIZE_CURSOR, 14, 1); | 223 IDR_NORTHEAST_RESIZE_CURSOR, 14, 1); |
| 227 case WebCursorInfo::TypeNorthWestResize: | 224 case WebCursorInfo::TypeNorthWestResize: |
| 228 case WebCursorInfo::TypeNorthWestPanning: | |
| 229 return GetCoreCursorWithFallback(kResizeNorthwestCursor, | 225 return GetCoreCursorWithFallback(kResizeNorthwestCursor, |
| 230 IDR_NORTHWEST_RESIZE_CURSOR, 0, 0); | 226 IDR_NORTHWEST_RESIZE_CURSOR, 0, 0); |
| 231 case WebCursorInfo::TypeSouthResize: | 227 case WebCursorInfo::TypeSouthResize: |
| 232 case WebCursorInfo::TypeSouthPanning: | |
| 233 return GetCoreCursorWithFallback(kResizeSouthCursor, | 228 return GetCoreCursorWithFallback(kResizeSouthCursor, |
| 234 IDR_SOUTH_RESIZE_CURSOR, 7, 14); | 229 IDR_SOUTH_RESIZE_CURSOR, 7, 14); |
| 235 case WebCursorInfo::TypeSouthEastResize: | 230 case WebCursorInfo::TypeSouthEastResize: |
| 236 case WebCursorInfo::TypeSouthEastPanning: | |
| 237 return GetCoreCursorWithFallback(kResizeSoutheastCursor, | 231 return GetCoreCursorWithFallback(kResizeSoutheastCursor, |
| 238 IDR_SOUTHEAST_RESIZE_CURSOR, 14, 14); | 232 IDR_SOUTHEAST_RESIZE_CURSOR, 14, 14); |
| 239 case WebCursorInfo::TypeSouthWestResize: | 233 case WebCursorInfo::TypeSouthWestResize: |
| 240 case WebCursorInfo::TypeSouthWestPanning: | |
| 241 return GetCoreCursorWithFallback(kResizeSouthwestCursor, | 234 return GetCoreCursorWithFallback(kResizeSouthwestCursor, |
| 242 IDR_SOUTHWEST_RESIZE_CURSOR, 1, 14); | 235 IDR_SOUTHWEST_RESIZE_CURSOR, 1, 14); |
| 243 case WebCursorInfo::TypeWestResize: | 236 case WebCursorInfo::TypeWestResize: |
| 244 case WebCursorInfo::TypeWestPanning: | |
| 245 return GetCoreCursorWithFallback(kResizeWestCursor, | 237 return GetCoreCursorWithFallback(kResizeWestCursor, |
| 246 IDR_WEST_RESIZE_CURSOR, 1, 7); | 238 IDR_WEST_RESIZE_CURSOR, 1, 7); |
| 247 case WebCursorInfo::TypeNorthSouthResize: | 239 case WebCursorInfo::TypeNorthSouthResize: |
| 248 return GetCoreCursorWithFallback(kResizeNorthSouthCursor, | 240 return GetCoreCursorWithFallback(kResizeNorthSouthCursor, |
| 249 IDR_NORTHSOUTH_RESIZE_CURSOR, 7, 7); | 241 IDR_NORTHSOUTH_RESIZE_CURSOR, 7, 7); |
| 250 case WebCursorInfo::TypeEastWestResize: | 242 case WebCursorInfo::TypeEastWestResize: |
| 251 return GetCoreCursorWithFallback(kResizeEastWestCursor, | 243 return GetCoreCursorWithFallback(kResizeEastWestCursor, |
| 252 IDR_EASTWEST_RESIZE_CURSOR, 7, 7); | 244 IDR_EASTWEST_RESIZE_CURSOR, 7, 7); |
| 253 case WebCursorInfo::TypeNorthEastSouthWestResize: | 245 case WebCursorInfo::TypeNorthEastSouthWestResize: |
| 254 return GetCoreCursorWithFallback(kResizeNortheastSouthwestCursor, | 246 return GetCoreCursorWithFallback(kResizeNortheastSouthwestCursor, |
| 255 IDR_NORTHEASTSOUTHWEST_RESIZE_CURSOR, | 247 IDR_NORTHEASTSOUTHWEST_RESIZE_CURSOR, |
| 256 7, 7); | 248 7, 7); |
| 257 case WebCursorInfo::TypeNorthWestSouthEastResize: | 249 case WebCursorInfo::TypeNorthWestSouthEastResize: |
| 258 return GetCoreCursorWithFallback(kResizeNorthwestSoutheastCursor, | 250 return GetCoreCursorWithFallback(kResizeNorthwestSoutheastCursor, |
| 259 IDR_NORTHWESTSOUTHEAST_RESIZE_CURSOR, | 251 IDR_NORTHWESTSOUTHEAST_RESIZE_CURSOR, |
| 260 7, 7); | 252 7, 7); |
| 261 case WebCursorInfo::TypeColumnResize: | 253 case WebCursorInfo::TypeColumnResize: |
| 262 return [NSCursor resizeLeftRightCursor]; | 254 return [NSCursor resizeLeftRightCursor]; |
| 263 case WebCursorInfo::TypeRowResize: | 255 case WebCursorInfo::TypeRowResize: |
| 264 return [NSCursor resizeUpDownCursor]; | 256 return [NSCursor resizeUpDownCursor]; |
| 265 case WebCursorInfo::TypeMiddlePanning: | |
| 266 case WebCursorInfo::TypeMove: | 257 case WebCursorInfo::TypeMove: |
| 267 return GetCoreCursorWithFallback(kMoveCursor, | 258 return GetCoreCursorWithFallback(kMoveCursor, |
| 268 IDR_MOVE_CURSOR, 7, 7); | 259 IDR_MOVE_CURSOR, 7, 7); |
| 269 case WebCursorInfo::TypeVerticalText: | 260 case WebCursorInfo::TypeVerticalText: |
| 270 // IBeamCursorForVerticalLayout is >= 10.7. | 261 // IBeamCursorForVerticalLayout is >= 10.7. |
| 271 if ([NSCursor respondsToSelector:@selector(IBeamCursorForVerticalLayout)]) | 262 if ([NSCursor respondsToSelector:@selector(IBeamCursorForVerticalLayout)]) |
| 272 return [NSCursor IBeamCursorForVerticalLayout]; | 263 return [NSCursor IBeamCursorForVerticalLayout]; |
| 273 else | 264 else |
| 274 return LoadCursor(IDR_VERTICALTEXT_CURSOR, 7, 7); | 265 return LoadCursor(IDR_VERTICALTEXT_CURSOR, 7, 7); |
| 275 case WebCursorInfo::TypeCell: | 266 case WebCursorInfo::TypeCell: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return true; | 377 return true; |
| 387 } | 378 } |
| 388 | 379 |
| 389 void WebCursor::CleanupPlatformData() { | 380 void WebCursor::CleanupPlatformData() { |
| 390 return; | 381 return; |
| 391 } | 382 } |
| 392 | 383 |
| 393 void WebCursor::CopyPlatformData(const WebCursor& other) { | 384 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 394 return; | 385 return; |
| 395 } | 386 } |
| OLD | NEW |