Bug 138606 - [test case] Image maps do not work if corners of clickable areas are not given in the standard way
Summary: [test case] Image maps do not work if corners of clickable areas are not give...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 3.5
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 92663 163433 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-10 00:31 UTC by Tal Levy
Modified: 2008-07-09 21:21 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
First part of a test case (1.17 KB, image/png)
2008-06-14 01:34 UTC, Frank Reininghaus
Details
Test case (using the previously attached image) (1.35 KB, text/html)
2008-06-14 01:41 UTC, Frank Reininghaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tal Levy 2006-12-10 00:31:23 UTC
Version:           3.5.5 (using KDE 3.5.5, Arch Linux)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.18-ARCH

The rightmost button on this page: http://www.israrail.org.il/israrail/doa_iis.dll/menu.menu leads to a page (which for some reason has no obvious permalink) on which the orange buttons at the left are unclickable.  The buttons are clickable in firefox.
Comment 1 Janet 2007-02-10 14:43:44 UTC
Well, it does work with konqueror 3.5.6 so this can be closed.
Comment 2 Janet 2007-02-10 14:46:08 UTC
Oops I'm sorry - no, doesn't work.
Comment 3 Philip Rodrigues 2007-02-10 22:44:00 UTC
I get the same. The links that doesn't work are an image map. Could you try to produce a minimal testcase from that page showing the problem?
Comment 4 Janet 2007-02-11 13:38:52 UTC
Maybe you want to play around with this small page that only contains an imagemap with one link (that works): http://spacepenguin.de/unsorted/imagemap_konq/test.html - maybe you can see a difference in the way the imagemaps are created, I didn't so far (it doesn't matter if the map is in the page head or not and it also doesn't matter if the image is mentioned first or after the map).

Another funny thing on that site: the mouseover buttons in the menu.menu from the link above are not shown on mouseover, they appear broken (also konq only, ok in firefox and opera).
Comment 5 Tal Levy 2007-02-12 17:39:18 UTC
The mouseover problem is covered in bug #138605.
Comment 6 Frank Reininghaus 2008-06-14 01:34:54 UTC
Created attachment 25317 [details]
First part of a test case
Comment 7 Frank Reininghaus 2008-06-14 01:41:30 UTC
Created attachment 25318 [details]
Test case (using the previously attached image)

Confirmed on 3.5.9 and SVN trunk rev. 820315, attached a simple test case.

The problem is that the coordinates of the clickable rectangular areas are not
given in the standard way. Usually, one would do it like this:
<area shape="rect" alt="KDE" coords="x1,y1,x2,y2" href="http://www.kde.org/">
where (x1,y1) is the top left corner and (x2,y2) the bottom right corner of the
area. Firefox accepts any other combination of opposite corners (like here:
first bottom left, then top right), but Konqueror doesn't.
Comment 8 Maksim Orlovich 2008-06-14 06:32:36 UTC
Thanks for the reduction. Looks easy enough to fix.
Comment 9 Frank Reininghaus 2008-06-14 11:36:30 UTC
Hi Maksim,
the patch below fixes the problem for me. 
Cheers, Frank

Index: khtml/html/html_imageimpl.cpp
===================================================================
--- khtml/html/html_imageimpl.cpp	(revision 820315)
+++ khtml/html/html_imageimpl.cpp	(working copy)
@@ -581,7 +581,9 @@
         int y0 = m_coords[1].minWidth(height_);
         int x1 = m_coords[2].minWidth(width_);
         int y1 = m_coords[3].minWidth(height_);
-        region = QRegion(x0,y0,x1-x0,y1-y0);
+        // use qMin () and qAbs () to make sure that this works for any pair
+        // of opposite corners (x0,y0) and (x1,y1)
+        region = QRegion(qMin(x0,x1),qMin(y0,y1),qAbs(x1-x0),qAbs(y1-y0));
     }
     else if (shape==Default)
         region = QRegion(0,0,width_,height_);
Comment 10 Maksim Orlovich 2008-06-25 22:36:22 UTC
Applied in http://lists.kde.org/?l=kde-commits&m=121442597331064&w=2
Thanks again for the analysis and the patch.
Comment 11 Frank Reininghaus 2008-07-09 20:52:24 UTC
*** Bug 163433 has been marked as a duplicate of this bug. ***
Comment 12 Frank Reininghaus 2008-07-09 21:21:46 UTC
*** Bug 92663 has been marked as a duplicate of this bug. ***