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 "content/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 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 bool WebCursor::Serialize(Pickle* pickle) const { | 135 bool WebCursor::Serialize(Pickle* pickle) const { |
136 if (!pickle->WriteInt(type_) || | 136 if (!pickle->WriteInt(type_) || |
137 !pickle->WriteInt(hotspot_.x()) || | 137 !pickle->WriteInt(hotspot_.x()) || |
138 !pickle->WriteInt(hotspot_.y()) || | 138 !pickle->WriteInt(hotspot_.y()) || |
139 !pickle->WriteInt(custom_size_.width()) || | 139 !pickle->WriteInt(custom_size_.width()) || |
140 !pickle->WriteInt(custom_size_.height()) || | 140 !pickle->WriteInt(custom_size_.height()) || |
141 !pickle->WriteFloat(custom_scale_)) | 141 !pickle->WriteFloat(custom_scale_)) |
142 return false; | 142 return false; |
143 | 143 |
144 const char* data = NULL; | 144 const char* data = NULL; |
145 if (!custom_data_.empty()) | 145 if (custom_data_.empty()) |
146 data = &custom_data_[0]; | 146 return false; |
Charlie Reis
2015/02/17 21:26:59
This is probably the wrong thing to do. It's prob
Sunil Ratnu
2015/02/18 09:04:45
Removed this change as we do not need to abort ear
| |
147 | |
148 data = &custom_data_[0]; | |
147 if (!pickle->WriteData(data, custom_data_.size())) | 149 if (!pickle->WriteData(data, custom_data_.size())) |
148 return false; | 150 return false; |
149 | 151 |
150 return SerializePlatformData(pickle); | 152 return SerializePlatformData(pickle); |
151 } | 153 } |
152 | 154 |
153 bool WebCursor::IsCustom() const { | 155 bool WebCursor::IsCustom() const { |
154 return type_ == WebCursorInfo::TypeCustom; | 156 return type_ == WebCursorInfo::TypeCustom; |
155 } | 157 } |
156 | 158 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 return; | 255 return; |
254 | 256 |
255 // Clamp the hotspot to the custom image's dimensions. | 257 // Clamp the hotspot to the custom image's dimensions. |
256 hotspot_.set_x(std::max(0, | 258 hotspot_.set_x(std::max(0, |
257 std::min(custom_size_.width() - 1, hotspot_.x()))); | 259 std::min(custom_size_.width() - 1, hotspot_.x()))); |
258 hotspot_.set_y(std::max(0, | 260 hotspot_.set_y(std::max(0, |
259 std::min(custom_size_.height() - 1, hotspot_.y()))); | 261 std::min(custom_size_.height() - 1, hotspot_.y()))); |
260 } | 262 } |
261 | 263 |
262 } // namespace content | 264 } // namespace content |
OLD | NEW |