Bug 59701 - imagemap Y coordinates mangled
Summary: imagemap Y coordinates mangled
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Compiled Sources All
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 47404 55531 60567 60905 64410 73126 85901 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-06-12 23:24 UTC by groot
Modified: 2021-01-02 05:29 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description groot 2003-06-12 23:24:28 UTC
Version:            (using KDE KDE 3.1.2)
Installed from:    Compiled From Sources
Compiler:          gcc 2.95.3 
OS:          FreeBSD

The site http://www.stshenouda.com/coptlang/coptalfa.htm has a very large imagemap. It probably extends below the bottom of the browser window. After scrolling the imagemap,  say so you can see the letter "pi" in the first column, 5th row (i use my wheelmouse for this, if that makes any difference), and pointing to the "pi", the status bar in konqui gives coordinates 56,431. However, when I _click_ on the "pi", the Y coordinate is mangled, and the coordinates passed to the image map handler are 56,191.

This is reproducible on another machine with 3.1.2 from FreeBSD ports, too.
Comment 1 Tim Woodall 2003-07-08 22:20:22 UTC
I've got this problem as well.  The Y coordinate being returned to the server is the coordinate that the mouse would be over if the page hadn't been scrolled BUT you had clicked on the image. e.g. On my page which is a 5x5 tile of image I can get a negative Y coordinate because the tile that I click on would be below the bottom of the screen if the page hadn't been scrolled.   
Comment 2 Thiago Macieira 2003-07-09 02:09:20 UTC
*** Bug 60567 has been marked as a duplicate of this bug. ***
Comment 3 Thiago Macieira 2003-07-09 02:10:06 UTC
*** Bug 47404 has been marked as a duplicate of this bug. ***
Comment 4 Thiago Macieira 2003-07-09 02:10:17 UTC
*** Bug 60905 has been marked as a duplicate of this bug. ***
Comment 5 John Firebaugh 2003-07-29 06:43:47 UTC
*** Bug 55531 has been marked as a duplicate of this bug. ***
Comment 6 Olaf Bonorden 2003-08-11 13:18:55 UTC
Same problem here, link shown in status line is ok. 
Comment 7 Thiago Macieira 2003-09-17 16:15:54 UTC
*** Bug 64410 has been marked as a duplicate of this bug. ***
Comment 8 groot 2003-12-31 12:36:46 UTC
Not FreeBSD specific. Still present in CVS HEAD from dec. 28th.

As Olaf points out, the link shown in the status line is correct, but when you click the link the coordinates get mangled.
Comment 9 Dirk Mueller 2004-01-21 15:07:59 UTC
*** Bug 73126 has been marked as a duplicate of this bug. ***
Comment 10 Carsten Schlipf 2004-01-21 15:32:53 UTC
Also happens with horizontal scrolling:

 (1) Load http://selfhtml.teamone.de/html/grafiken/anzeige/img_usemap.htm 
 (2) Move the mouse over "Bamberg". The mouse pointer should become a hand. 
 (3) Make the window as narrow as possible 
 (4) Scroll the window to the right, so that "Bamberg" is visible again. 
 (5) Move the mouse over "Bamberg". The mouse pointer does not become a hand and the link is not working any more. 
Comment 11 Dirk Mueller 2004-01-26 06:57:38 UTC
Subject: kdelibs/khtml

CVS commit by mueller: 

* html/html_inlineimpl.cpp (defaultEventHandler): use content, not
viewport coordinates for server side image maps (#59701).

* rendering/bidi.cpp (computeVerticalPositionsForLine): update
overflowWidth, otherwise a lot of things go wrong (#59701).

CCMAIL: 59701-done@bugs.kde.org


  M +6 -0      ChangeLog   1.190
  M +10 -3     html/html_inlineimpl.cpp   1.131
  M +4 -1      rendering/bidi.cpp   1.179


--- kdelibs/khtml/ChangeLog  #1.189:1.190
@@ -1,4 +1,10 @@
 2004-01-26  Dirk Mueller  <mueller@kde.org>
 
+        * html/html_inlineimpl.cpp (defaultEventHandler): use content, not
+        viewport coordinates for server side image maps (#59701).
+
+        * rendering/bidi.cpp (computeVerticalPositionsForLine): update
+        overflowWidth, otherwise a lot of things go wrong (#59701).
+
         * misc/loader.cpp (data): correctly emit notifyFinished(), otherwise our
         state machine goes out of sync.

--- kdelibs/khtml/html/html_inlineimpl.cpp  #1.130:1.131
@@ -99,8 +99,15 @@ void HTMLAnchorElementImpl::defaultEvent
                 if(r && e)
                 {
-                    int absx, absy;
+                    KHTMLView* v = getDocument()->view();
+                    int x = e->clientX();
+                    int y = e->clientY();
+                    int absx = 0;
+                    int absy = 0;
+                    if ( v ) {
+                        x += v->contentsX();
+                        y += v->contentsY();
+                    }
                     r->absolutePosition(absx, absy);
-                    int x(e->clientX() - absx), y(e->clientY() - absy);
-                    url += QString("?%1,%2").arg( x ).arg( y );
+                    url += QString("?%1,%2").arg( x - absx ).arg( y - absy );
                 }
                 else {

--- kdelibs/khtml/rendering/bidi.cpp  #1.178:1.179
@@ -1138,4 +1138,7 @@ void RenderBlock::computeVerticalPositio
         else
             x += r->box->width() + spaceAdd;
+        if ( x > m_overflowWidth )
+            m_overflowWidth = x;
+
         r = sruns->next();
     }


Comment 12 Carsten Schlipf 2004-03-09 09:03:00 UTC
Could it be, that this bug is appearing again with Konqueror 3.2.0?

I was not able to reproduce it with RC1, but with the final 3.2 it's there again.
Comment 13 Olaf Mertens 2004-05-14 16:43:57 UTC
This bug is still in KDE 3.2.2.

An image form submit (<submit type="image" name="bla">) sends the wrong coordinates when the html page is scrolled.
Comment 14 Dario Abatianni 2004-06-29 19:32:51 UTC
This bug is still present in KDE 3.2.3 (SuSE RPMs on i386).
Comment 15 Darrell Esau 2004-06-29 21:44:30 UTC
I can confirm that this bug is still present in the Fedora Core 2 KDE 3.2.3 RPMS as well.
Comment 16 Carsten Schlipf 2004-06-30 20:35:23 UTC
I can not confirm this bug with KDE 3.2.3, which I have compiled by myself on RedHat 9. While I was able to reproduce this with earlier versions, I cannot reproduce it since 3.2.1/ (see my posting above on how to reproduce it).
Comment 17 Leo Savernik 2004-07-21 12:27:24 UTC
Cannot reproduce it either with KDE 3.2.3 nor KDE CVS >= 2004-07-20.
Comment 18 groot 2004-07-21 12:47:56 UTC
Testing original link with recent CVS (3.3b2) shows it works; Bamberg link (horizontal scrolling) also works. 
Comment 19 Dario Abatianni 2004-08-21 15:02:31 UTC
Just checked with KDE 3.3 release from SuSE 9.0 rpms. Still broken x and y coordinates.

Try this test case: http://eisfuchs.info/eisfuchs/imagetest.html

Resize konqueror and scroll a little to the right and down, then pick a spot on the map and click on it. After reload you will see the coordinates and the spot you clicked on, but it's in the wrong position.
Comment 20 Lauri Watts 2004-08-21 15:26:04 UTC
Regression in 3.3 Final? 

I can reproduce this with the following test:
http://eisfuchs.info/eisfuchs/imagetest.html
Make the window only so bit that the map only shows down to Frankfurt
Scroll to the bottom
Click on Stuttgart
Notice the green dot is off by the distance of the scroll, and is showing up near Bielefeld instead.
Make the window big enough to see the whole map, click on Stuttgart again, and the green dot is correctly placed right where you clicked.

Equally reproducible on this map with horizontal scroll.
Comment 21 Leo Savernik 2004-08-26 23:01:49 UTC
Seems really to have regressed.
Comment 22 Allan Sandfeld 2005-03-01 15:25:01 UTC
The testcase in comment #20 is not using the patched code, but rather a form. Seems something else needs to be patched, but it not a regression.
Comment 23 Allan Sandfeld 2005-03-01 15:36:13 UTC
CVS commit by carewolf: 

Fix "image" INPUT forms to also use content rather than viewport position
BUG:59701


  M +29 -25    ChangeLog   1.393
  M +5 -0      html/html_formimpl.cpp   1.424



Comment 24 Dario Abatianni 2005-03-05 18:55:03 UTC
This bug is still in KDE 3.4rc1. Was the fix too late for the rc?

Thanks for looking into this bug, it's a really nasty one, it seems :)
Comment 25 Allan Sandfeld 2005-03-07 21:53:34 UTC
CVS commit by carewolf: 

Backport of fix for #59701
CCBUG: 59701


  M +5 -0      html_formimpl.cpp   1.421.2.1


--- kdelibs/khtml/html/html_formimpl.cpp  #1.421:1.421.2.1
@@ -1605,4 +1605,9 @@ void HTMLInputElementImpl::defaultEventH
                 xPos = me->clientX()-offsetX;
                 yPos = me->clientY()-offsetY;
+                KHTMLView* v = getDocument()->view();
+                if ( v ) {
+                    xPos += v->contentsX();
+                    yPos += v->contentsY();
+                }
             }
         }


Comment 26 Matt Rogers 2005-03-09 00:24:14 UTC
*** Bug 85901 has been marked as a duplicate of this bug. ***
Comment 27 Dario Abatianni 2005-04-24 17:25:58 UTC
Seems to be fixed in KDE 3.4.0-28 - SuSE 9.3 RPMs!

Thank you, guys! Great work!