Bug 15779

Summary: Custom CSS .cur cursor anchor point is ignored
Product: WebKit Reporter: Sasha Aickin <xander76>
Component: CSSAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, bugzilla33, dan, emacemac7, eric, jab_creations, joris, ossy, sbvendor, shin.sugi, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 420+   
Hardware: All   
OS: All   
Attachments:
Description Flags
test page that demonstrates the bug
none
new testcase
none
proposed fix sullivan: review+

Description Sasha Aickin 2007-10-31 14:28:38 PDT
Create a page that uses a CSS custom cursor with a rule such as:

cursor: url(http://maps.live.com/cursors/grab.cur);

Rather than being anchored at the upper left finger of the cursor, as it is on IE, the cursor is anchored approximately 8 pixels up and to the left from the image.  This causes weird jumping effects when custom cursors like this are used.

Test page to follow.

Tested in build 522.15.5.
Comment 1 Sasha Aickin 2007-10-31 14:30:04 PDT
Created attachment 16969 [details]
test page that demonstrates the bug

Added a test page that demos the bug.
Comment 2 David Kilzer (:ddkilzer) 2007-10-31 23:07:05 PDT
Verified with a recent Safari for Windows on XP Pro.

Even stranger is that the custom "grab" cursor specified in the CSS doesn't appear at all with Safari 3 Public Beta v. 3.0.3 (522.12.1) with a local debug build of WebKit r27306 on Mac OS X 10.4.10 (8R218).
Comment 3 David Kilzer (:ddkilzer) 2007-10-31 23:08:00 PDT
$ curl --head http://maps.live.com/cursors/grab.cur
HTTP/1.1 200 OK
Content-Length: 4286
Content-Type: application/octet-stream
Last-Modified: Sun, 23 Sep 2007 23:26:12 GMT
Accept-Ranges: bytes
ETag: "fb2b1d2139fec71:907"
Server: Microsoft-IIS/6.0
P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
Date: Thu, 01 Nov 2007 06:07:19 GMT

Comment 4 David Kilzer (:ddkilzer) 2007-10-31 23:12:27 PDT
(In reply to comment #2)
> Even stranger is that the custom "grab" cursor specified in the CSS doesn't
> appear at all with Safari 3 Public Beta v. 3.0.3 (522.12.1) with a local debug
> build of WebKit r27306 on Mac OS X 10.4.10 (8R218).

Filed Bug 15783 for this issue on OS X.

Comment 5 Alexey Proskuryakov 2007-11-01 01:03:49 PDT
See also: <rdar://problem/4556355>. I suppose fixes are needed in both CG and WebKit.
Comment 6 Dan Fabulich 2008-04-08 11:05:50 PDT
Probably related to bug 8989.  That extra byte of difference between a .cur and a .ico includes the anchor point of the cursor.
Comment 7 Alexey Proskuryakov 2008-11-25 07:13:02 PST
*** Bug 22453 has been marked as a duplicate of this bug. ***
Comment 8 Alexey Proskuryakov 2009-04-06 10:33:43 PDT
*** Bug 18810 has been marked as a duplicate of this bug. ***
Comment 9 Scott Bell 2009-12-09 10:55:55 PST
This bug makes it impossible to have non-pointer cursors
(such as a hand, or spreadsheet cell cursor) work well in
WebKit. Google Maps is a popular application which behaves
poorly in WebKit due to this bug. 

Our application makes use of two custom cursors, one for
resizing and one to simulate the CSS3 `cell' cursors on 
unsupported browsers (such as WebKit). Both of these have
a hotspot at 6,6, which is far off from the 0,0 value that
WebKit uses, which causes the UI to behave unacceptably.
Comment 10 Scott Bell 2009-12-09 11:04:26 PST
(In reply to comment #9)
> Our application makes use of two custom cursors, one for
> resizing and one to simulate the CSS3 `cell' cursors on 
> unsupported browsers (such as WebKit). Both of these have
> a hotspot at 6,6, which is far off from the 0,0 value that
> WebKit uses, which causes the UI to behave unacceptably.

Correction: we use a custom .CUR file for `cell' to ensure
consistency across browsers, not because WebKit doesn't
support it (it does).
Comment 11 Alexey Proskuryakov 2009-12-09 11:14:06 PST
This is a compatibility bug, but I think it can be worked around.  You can specify the hotspot position in CSS, see <http://www.w3.org/TR/css3-ui/#cursor>.
Comment 12 Scott Bell 2009-12-09 11:55:05 PST
(In reply to comment #11)
> This is a compatibility bug, but I think it can be worked around.  You can
> specify the hotspot position in CSS, see
> <http://www.w3.org/TR/css3-ui/#cursor>.

This workaround does seem to work for the latest WebKit,
unfortunately Safari renders the fallback cursor instead at
the moment. Thanks!
Comment 13 Alexey Proskuryakov 2009-12-09 13:18:27 PST
The document needs to be in strict parsing mode for that to work in Safari 4 - that was fixed in bug 27390.
Comment 14 Alexey Proskuryakov 2010-05-19 09:49:53 PDT
<rdar://problem/8002964>
Comment 15 Alexey Proskuryakov 2010-05-27 23:02:45 PDT
*** Bug 39824 has been marked as a duplicate of this bug. ***
Comment 16 bugzilla33 2010-05-28 02:24:08 PDT
URL: http://pc44.one.pl/goorol/bugs/safari/cursor.html
Comment 17 bugzilla33 2010-05-28 02:24:50 PDT
Created attachment 57306 [details]
new testcase
Comment 18 Alexey Proskuryakov 2010-06-07 20:57:08 PDT
Created attachment 58107 [details]
proposed fix
Comment 19 Alexey Proskuryakov 2010-06-08 10:31:36 PDT
Committed <http://trac.webkit.org/changeset/60849>.

Please note that this will only work in nightly builds with Safari 5 for Windows for now. Fixing this on Mac OS X is tracked by Apple internally as <rdar://problem/4556355>.
Comment 20 WebKit Review Bot 2010-06-08 10:42:22 PDT
http://trac.webkit.org/changeset/60849 might have broken Qt Linux Release minimal
Comment 21 Eric Seidel (no email) 2010-06-08 10:55:48 PDT
Qt is very sad after this change.
Comment 22 Csaba Osztrogonác 2010-06-08 11:20:37 PDT
(In reply to comment #21)
> Qt is very sad after this change.
Fixed by http://trac.webkit.org/changeset/60854.
Comment 23 Alexey Proskuryakov 2010-11-28 09:49:20 PST
> Fixing this on Mac OS X is tracked by Apple internally as <rdar://problem/4556355>.

Fixed in Mac OS X 10.6.5 - should work with WebKit nightlies now.
Comment 24 Shane Stephens 2011-06-13 18:02:58 PDT
*** Bug 20826 has been marked as a duplicate of this bug. ***