Closed Bug 115198 Opened 23 years ago Closed 23 years ago

clientX and clientY coordinates are incorrect

Categories

(Core :: DOM: Events, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: bryner, Assigned: bryner)

References

Details

Attachments

(2 files)

Any time a frame on a web page has a view that has its own widget, any mouse events within that frame get incorrect clientX and clientY coordinates if the page is scrolled. Here's why: Widgets keep their stored bounds in an nsRect (see nsWindow.cpp). The position of this rect is only modified via calls to SetBounds() or Move(). As the user scrolls, we don't update the bounds, so they continue to reflect the position when the page was first reflowed. The code that computes clientX and clientY relies on these bounds reflecting the position relative to the visible viewport. This is automatic on Windows, because the OS is queried for the widget's current position. On mac, the bounds remain correct because the bounds for child windows are updated when nsWindow::Scroll is called.
Blocks: 112713
Attached file test case
To see the bug, load the test case and scroll the page down a bit. Now move the mouse from the page into the inner div and watch clientY jump.
Comment on attachment 61712 [details] [diff] [review] patch to update child window bounds when scrolling r/sr=blizzard Nice catch!
Attachment #61712 - Flags: superreview+
checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
imho, bug 33226 should be duped against this one.
verifying on build 2002-01-04-08-trunk linux RedHat and build 2002-01-04-03-trunk windows 98
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: