Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: webkit/glue/webcursor_mac.mm

Issue 7273056: [Mac] Create transparent cursor when given empty custom data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webcursor_mac.mm
diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm
index 8c72da206af47101416ae2c25435e43203485bcd..ca9ee0d0b52e70103f1b007cdd787cfdc5e20662 100644
--- a/webkit/glue/webcursor_mac.mm
+++ b/webkit/glue/webcursor_mac.mm
@@ -40,7 +40,9 @@ CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data,
base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color(
CGColorSpaceCreateDeviceRGB());
// This is safe since we're not going to draw into the context we're creating.
- void* data = const_cast<char*>(&custom_data[0]);
+ void* data = NULL;
+ if (!custom_data.empty())
+ data = const_cast<char*>(&custom_data[0]);
// The settings here match SetCustomData() below; keep in sync.
base::mac::ScopedCFTypeRef<CGContextRef> context(
CGBitmapContextCreate(data,
Avi (use Gerrit) 2011/06/29 00:22:47 You can do that, pass in a null data for a 0x0 ima
Scott Hess - ex-Googler 2011/06/29 01:06:13 Docs say that passing NULL means that Quartz alloc
@@ -57,10 +59,6 @@ CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data,
NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
const gfx::Size& custom_size,
const gfx::Point& hotspot) {
- // CG throws a cocoa exception if we try to create an empty image, which
- // results in an infinite loop. This CHECK ensures that we crash instead.
- CHECK(!custom_data.empty());
-
base::mac::ScopedCFTypeRef<CGImageRef> cg_image(
CreateCGImageFromCustomData(custom_data, custom_size));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698