summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcursor.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 19:44:27 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 19:44:27 +0000
commitcdcc98e312f4cbad9c270a61097b861cfe6968b8 (patch)
tree2fedddd4a1c20c75783fde6e336a7baa5c394ec1 /webkit/glue/webcursor.cc
parent63f8aa498d2ea99c7e2580cc51df1c8072abdc29 (diff)
downloadchromium_src-cdcc98e312f4cbad9c270a61097b861cfe6968b8.zip
chromium_src-cdcc98e312f4cbad9c270a61097b861cfe6968b8.tar.gz
chromium_src-cdcc98e312f4cbad9c270a61097b861cfe6968b8.tar.bz2
Ensure that custom cursors set by windowless flash plugins get marshaled correctly back
to the renderer and eventually to the browser. We rely on the HCURSOR getting marshaled across on windows. However this regressed when code to validate the custom cursor info was added in the WebCursor deserialization routines. Fixes bug http://code.google.com/p/chromium/issues/list?cursor=39436 BUG=39436 TEST=Covered by new custom cursor deserialization unit test. Review URL: http://codereview.chromium.org/5686001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webcursor.cc')
-rw-r--r--webkit/glue/webcursor.cc39
1 files changed, 20 insertions, 19 deletions
diff --git a/webkit/glue/webcursor.cc b/webkit/glue/webcursor.cc
index 8f76ef9..66f9290 100644
--- a/webkit/glue/webcursor.cc
+++ b/webkit/glue/webcursor.cc
@@ -89,26 +89,27 @@ bool WebCursor::Deserialize(const Pickle* pickle, void** iter) {
size_y > kMaxCursorDimension)
return false;
- if (type == WebCursorInfo::TypeCustom && (size_x == 0 || size_y == 0))
- return false;
-
- // The * 4 is because the expected format is an array of RGBA pixel values.
- if (size_x * size_y * 4 > data_len)
- return false;
-
- type_ = type;
- hotspot_.set_x(hotspot_x);
- hotspot_.set_y(hotspot_y);
- custom_size_.set_width(size_x);
- custom_size_.set_height(size_y);
- ClampHotspot();
-
- custom_data_.clear();
- if (data_len > 0) {
- custom_data_.resize(data_len);
- memcpy(&custom_data_[0], data, data_len);
+ if (type == WebCursorInfo::TypeCustom) {
+ type_ = type;
+ if (size_x > 0 && size_y > 0) {
+ // The * 4 is because the expected format is an array of RGBA pixel
+ // values.
+ if (size_x * size_y * 4 > data_len)
+ return false;
+
+ hotspot_.set_x(hotspot_x);
+ hotspot_.set_y(hotspot_y);
+ custom_size_.set_width(size_x);
+ custom_size_.set_height(size_y);
+ ClampHotspot();
+
+ custom_data_.clear();
+ if (data_len > 0) {
+ custom_data_.resize(data_len);
+ memcpy(&custom_data_[0], data, data_len);
+ }
+ }
}
-
return DeserializePlatformData(pickle, iter);
}