Patch for bug #138606 in KHTML (image maps)

Frank Reininghaus frank78ac at googlemail.com
Sat Jun 21 19:22:10 BST 2008


Dear KHTML developers,

in the course of one of the last Bugsquad bug days, I looked at 

http://bugs.kde.org/show_bug.cgi?id=138606

The problem is that image maps work only if the corners of clickable 
rectangular areas are given in the standard way, i.e., first top left, then 
bottom right. Apparently, there are some sites that use a different pair of 
opposite corners, and this is accepted by other browsers (e.g., Firefox).

I've attached a small patch that fixes the problem for me in SVN trunk rev. 
822827 (already attached to the bug report, see comment #9). I've used qMin() 
and qAbs(), defined in QtCore/QtGlobal. It's not necessary to #include this 
file as it is already included indirectly.

Regards,
Frank

-------------- next part --------------
Index: khtml/html/html_imageimpl.cpp
===================================================================
--- khtml/html/html_imageimpl.cpp	(revision 822827)
+++ 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_);


More information about the kfm-devel mailing list