event.clientX/clientY should be in layout viewport coordinates
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 18:24:15 +0000 (18:24 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 18:24:15 +0000 (18:24 +0000)
commita76c61a8146b9fa9777c3beebb23224f9d4c4a02
tree57e97149877b33ef64e56ca5ff4a9abe4a577823
parentbbfd9376c218e1e116ab6e414ef779e37f088c82
event.clientX/clientY should be in layout viewport coordinates
https://bugs.webkit.org/show_bug.cgi?id=172018

Reviewed by Zalan Bujtas.
Source/WebCore:

Fix clientX and clientY on mouse events to be relative to the layout viewport, to match
getBoundingClientRect(), getClientRects() and fixed-position objects.

Also minor cleanup of MouseRelatedEvent to use initializers.

Test: fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html

* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent):
(WebCore::MouseRelatedEvent::init):
(WebCore::MouseRelatedEvent::initCoordinates):
(WebCore::contentsScrollOffset): Deleted.
* dom/MouseRelatedEvent.h:

LayoutTests:

* fast/events/clientXY-in-zoom-and-scroll.html:
* fast/visual-viewport/client-coordinates-relative-to-layout-viewport-expected.txt: Added.
* fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html: Added.
* platform/ios/TestExpectations:
* platform/mac/fast/events/clientXY-in-zoom-and-scroll-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html
LayoutTests/fast/visual-viewport/client-coordinates-relative-to-layout-viewport-expected.txt [new file with mode: 0644]
LayoutTests/fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac/fast/events/clientXY-in-zoom-and-scroll-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/MouseRelatedEvent.cpp
Source/WebCore/dom/MouseRelatedEvent.h