Closed Bug 68502 Opened 24 years ago Closed 17 years ago

Css cursor style ignored by image map.

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8.1alpha2

People

(Reporter: howgego, Assigned: dbaron)

References

Details

(Keywords: css2, testcase, Whiteboard: [HTML4-13.6.1])

Attachments

(2 files)

Css cursor style (for example cursor: crosshair;) is replaced by the system
defaults when the mouse passes over an image map.

This seems to apply regardless of whether the style is assigned to a div holding
the image map, or is inherited from the main html document. It seems to apply to
all cursor types. It applies to the whole map, not just specific areas. It also
occurred in NS 6.0. Cursors work correctly in other parts of the same document.
As a point of reference IE 5.5 does not have this problem.

No url - if you can not recreate this by simply aadding the style to an existing
bit of code, please email me for a sample.
please specify a specification to explain why our implementation is wrong.

what happens when you put a style into the img or imagemap?
I have no code lying around that uses imagemaps.  Please attach a testcase to
this bug using http://bugzilla.mozilla.org/createattachment.cgi?id=68502

That would expedite the handling of this bug significantly.
OK, I can reproduce this on linux build 2001-02-11-06.  We have the following:

<div> <img> <map><area></map></div> and the div has cursor:crosshair set.  The
image is not inheriting the cursor -- it has an arrow over the non-link part and
a hand over the link part.

setting "img { cursor: crosshair }" (with or without !important) makes the
cursor be a crosshair over the link part of the image but an arrow over the
non-link part.

If there is no imagemap attached to the image, the image correctly inherits the
cursor from the div it's in.

setting status to new, os to all, over to style system, adding keywords.

This is probably related to bug 63792, but is not a duplicate, since there the
correct cursor _is_ displayed eventually.
Assignee: asa → pierre
Status: UNCONFIRMED → NEW
Component: Browser-General → Style System
Ever confirmed: true
Keywords: css2, testcase
OS: Windows 98 → All
QA Contact: doronr → ian
Hardware: PC → All
Reassigned to Layout, this bug will be better off on Marc's list.

First thing first... nsImageFrame::GetCursor() should not reinitialize the cursor 
(ie. we shouldn't have "aCursor = NS_STYLE_CURSOR_AUTO"). The default cursors for 
"img" and "img[usemap]" are defined in
http://lxr.mozilla.org/seamonkey/source/layout/html/document/src/html.css#367 

In the current code the problem is that when an image has a map, both selectors 
apply.  When the cursor is inside the image map, GetStyleData() is called in 
nsImageFrame::GetCursor().  When it is not inside the image map, GetStyleData() 
is called in nsFrame::GetCursor().  Both calls return the same style.

Instead, the "img[usemap]" selector should only apply when the mouse is inside 
the image map, otherwise it should be the "img" selector.
Assignee: pierre → attinasi
Component: Style System → Layout
Target Milestone: --- → mozilla1.1
Whiteboard: [HTML4-13.6.1]
So.. perhaps we should put a cursor style on the <area> elements instead of on
the <img>?  See the XXX comments on nsImageFrame::GetCursor:

//XXX This will need to be rewritten once we have content for areas
//XXXbz We have content for areas now.... 

So we could get the nsIContent corresponding to the <area> the user is hovering,
resolve style on it, and get the cursor from there.

Thoughts?
Assignee: attinasi → jdunn
Component: Layout → Image: Layout
QA Contact: ian → tpreston
Target Milestone: mozilla1.1alpha → ---
This example shows clearly that the bug is directly caused by having a usemap
attribute on an img. Simply removing the usemap attribute will cause the
desired behaviour to occur.

I tested this file in build 1.8a
Comment on attachment 146666 [details]
Simple HTML file displaying the problem.

<HTML>
   <HEAD>
      <STYLE type="text/css">
	 img
	 {
	    cursor: crosshair;
	 }

	 img[usemap]
	 {
	    cursor: crosshair;
	 }
      </STYLE>
   </HEAD>
   <BODY>
      <MAP name="imageMap"/>
      Simple image with "usemap" attribute:<br>
      <IMG usemap="#imageMap" src="http://mozilla.org/images/mlogo.gif"/><br>
      Exact same image without "usemap" attribute:<br>
      <IMG src="http://mozilla.org/images/mlogo.gif"/><br>
   </BODY>
</HTML>
*** Bug 259368 has been marked as a duplicate of this bug. ***
QA Contact: tpreston → core.layout.images
*** Bug 296826 has been marked as a duplicate of this bug. ***
Assignee: jdunn → nobody
looks like this is a pretty old bug...

fix pls... 

:)
Assignee: nobody → dbaron
Fixed on trunk for Gecko 1.9alpha1, 2006-04-20, by checkin of bug 302536.

Fixed on MOZILLA_1_8_BRANCH for Mozilla 1.8.1 alpha2 (?), 2006-04-20, by checkin of bug 302536.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8.1alpha2
Flags: in-testsuite?
Product: Core → Core Graveyard
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: