| 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/glue/webcursor.h" | 5 #include "webkit/glue/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/Source/Platform/chromium/public/WebImage.h" | 9 #include "third_party/WebKit/public/platform/WebImage.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 11 | 11 |
| 12 using WebKit::WebCursorInfo; | 12 using WebKit::WebCursorInfo; |
| 13 using WebKit::WebImage; | 13 using WebKit::WebImage; |
| 14 | 14 |
| 15 static const int kMaxCursorDimension = 1024; | 15 static const int kMaxCursorDimension = 1024; |
| 16 | 16 |
| 17 WebCursor::WebCursor() | 17 WebCursor::WebCursor() |
| 18 : type_(WebCursorInfo::TypePointer), | 18 : type_(WebCursorInfo::TypePointer), |
| 19 custom_scale_(1) { | 19 custom_scale_(1) { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 void WebCursor::ClampHotspot() { | 258 void WebCursor::ClampHotspot() { |
| 259 if (!IsCustom()) | 259 if (!IsCustom()) |
| 260 return; | 260 return; |
| 261 | 261 |
| 262 // Clamp the hotspot to the custom image's dimensions. | 262 // Clamp the hotspot to the custom image's dimensions. |
| 263 hotspot_.set_x(std::max(0, | 263 hotspot_.set_x(std::max(0, |
| 264 std::min(custom_size_.width() - 1, hotspot_.x()))); | 264 std::min(custom_size_.width() - 1, hotspot_.x()))); |
| 265 hotspot_.set_y(std::max(0, | 265 hotspot_.set_y(std::max(0, |
| 266 std::min(custom_size_.height() - 1, hotspot_.y()))); | 266 std::min(custom_size_.height() - 1, hotspot_.y()))); |
| 267 } | 267 } |
| OLD | NEW |