WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
271694
MouseEvent offsetX and offsetY should be relative to padding edge
https://bugs.webkit.org/show_bug.cgi?id=271694
Summary
MouseEvent offsetX and offsetY should be relative to padding edge
Jonathan Heathcote
Reported
2024-03-26 00:07:07 PDT
Created
attachment 470601
[details]
Demo showing mouse offset coordinates from MouseMove on an element with a thick border. Observed in Epiphany 45.3 on Arch Linux. MouseEvent events include offsetX and offsetY values which should be relative to the border box of the event target (see spec:
https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx
). In WebKit, however, offsetX/Y coordinates appear to be relative to the border box. The attached demo page shows the clientX/Y values when the mouse is moved over a div. When moving the mouse over the thick black border, negative values should be shown (see Firefox and Chromium for correct examples) however positive values are shown instead in WebKit. NB: this appears to be similar (but different) to
bug #218117
(MouseEvent.offsetX/Y returns wrong value for inline elements) since this issue relates to block elements and it seems coordinates come relative to the border box, not the padding box.
Attachments
Demo showing mouse offset coordinates from MouseMove on an element with a thick border.
(325 bytes, text/html)
2024-03-26 00:07 PDT
,
Jonathan Heathcote
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2024-03-26 08:51:33 PDT
Reproduces in Safari too
Radar WebKit Bug Importer
Comment 2
2024-04-02 00:08:13 PDT
<
rdar://problem/125763807
>
Ahmad Saleem
Comment 3
2024-04-03 03:49:51 PDT
Our implementation:
https://searchfox.org/wubkat/rev/2f857be7d42f00feb7b59870709310154181a774/Source/WebCore/dom/MouseRelatedEvent.cpp#183
Blink:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/events/mouse_event.cc;l=452;drc=2827c7359e94610318802bff2cd4e4d8256cd215
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug