| 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 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "third_party/WebKit/public/platform/WebImage.h" | 9 #include "third_party/WebKit/public/platform/WebImage.h" |
| 10 | 10 |
| 11 using WebKit::WebCursorInfo; | 11 using blink::WebCursorInfo; |
| 12 | 12 |
| 13 static const int kMaxCursorDimension = 1024; | 13 static const int kMaxCursorDimension = 1024; |
| 14 | 14 |
| 15 WebCursor::WebCursor() | 15 WebCursor::WebCursor() |
| 16 : type_(WebCursorInfo::TypePointer), | 16 : type_(WebCursorInfo::TypePointer), |
| 17 custom_scale_(1) { | 17 custom_scale_(1) { |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 external_cursor_ = NULL; | 19 external_cursor_ = NULL; |
| 20 #endif | 20 #endif |
| 21 InitPlatformData(); | 21 InitPlatformData(); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void WebCursor::ClampHotspot() { | 252 void WebCursor::ClampHotspot() { |
| 253 if (!IsCustom()) | 253 if (!IsCustom()) |
| 254 return; | 254 return; |
| 255 | 255 |
| 256 // Clamp the hotspot to the custom image's dimensions. | 256 // Clamp the hotspot to the custom image's dimensions. |
| 257 hotspot_.set_x(std::max(0, | 257 hotspot_.set_x(std::max(0, |
| 258 std::min(custom_size_.width() - 1, hotspot_.x()))); | 258 std::min(custom_size_.width() - 1, hotspot_.x()))); |
| 259 hotspot_.set_y(std::max(0, | 259 hotspot_.set_y(std::max(0, |
| 260 std::min(custom_size_.height() - 1, hotspot_.y()))); | 260 std::min(custom_size_.height() - 1, hotspot_.y()))); |
| 261 } | 261 } |
| OLD | NEW |