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 "content/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 blink::WebCursorInfo; | 11 using blink::WebCursorInfo; |
12 | 12 |
13 static const int kMaxCursorDimension = 1024; | 13 static const int kMaxCursorDimension = 1024; |
14 | 14 |
| 15 namespace content { |
| 16 |
15 WebCursor::WebCursor() | 17 WebCursor::WebCursor() |
16 : type_(WebCursorInfo::TypePointer), | 18 : type_(WebCursorInfo::TypePointer), |
17 custom_scale_(1) { | 19 custom_scale_(1) { |
18 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
19 external_cursor_ = NULL; | 21 external_cursor_ = NULL; |
20 #endif | 22 #endif |
21 InitPlatformData(); | 23 InitPlatformData(); |
22 } | 24 } |
23 | 25 |
24 WebCursor::WebCursor(const CursorInfo& cursor_info) | 26 WebCursor::WebCursor(const CursorInfo& cursor_info) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 void WebCursor::ClampHotspot() { | 254 void WebCursor::ClampHotspot() { |
253 if (!IsCustom()) | 255 if (!IsCustom()) |
254 return; | 256 return; |
255 | 257 |
256 // Clamp the hotspot to the custom image's dimensions. | 258 // Clamp the hotspot to the custom image's dimensions. |
257 hotspot_.set_x(std::max(0, | 259 hotspot_.set_x(std::max(0, |
258 std::min(custom_size_.width() - 1, hotspot_.x()))); | 260 std::min(custom_size_.width() - 1, hotspot_.x()))); |
259 hotspot_.set_y(std::max(0, | 261 hotspot_.set_y(std::max(0, |
260 std::min(custom_size_.height() - 1, hotspot_.y()))); | 262 std::min(custom_size_.height() - 1, hotspot_.y()))); |
261 } | 263 } |
| 264 |
| 265 } // namespace content |
OLD | NEW |