New issue
Advanced search Search tips

Issue 618770 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

clientX/Y incorrect at dragend in iframe

Project Member Reported by wgrose@google.com, Jun 9 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36

Steps to reproduce the problem:
1. Have a dual screen monitor 
2. Have a half width chrome window in your right monitor (this may not be necessary)
3. open http://jsfiddle.net/CgzV3/10/
4. Drag the "Drag me" to the drop me
5. Let go and see the clientX/Y on the dragend event, they are enormous.

What is the expected behavior?
Get the real clientX/Y of the mouse at drageng

What went wrong?
The values are way off the charts. For example:
           clientX/Y
dragstart  53/19
drag	   100/101	
dragend	   1155/446

drag emits the last clientX/Y of the mouse on the last drag event, then you let go and the dragend event gives super high values.

Did this work before? N/A 

Chrome version: 51.0.2704.84  Channel: stable
OS Version: 51
Flash Version: Shockwave Flash 21.0 r0

Mentioned in http://stackoverflow.com/questions/20482233/x-and-y-values-in-html5-drag-events-are-inconsistent-across-browsers
 
Components: -Blink Blink>DataTransfer
Summary: clientX/Y incorrect at dragend on dualscreen (was: clientX/Y incorrect at drageng on dualscreen)
Project Member

Comment 2 by sheriffbot@chromium.org, Jun 10 2016

Labels: Hotlist-Google

Comment 3 by dcheng@chromium.org, Jun 12 2016

Cc: osh...@chromium.org
I can confirm this bug, when using dual monitor. Happening when using chrome at the left side monitor. 

For now I save the last clientX and clientY in the dragUpdate and use these in dragEnd instead. 

However, in the drag event sometimes I get clientX and clientY being 0 while they shouldn't. First causing to always have X + Y = 0 in the dragEnd. So I had to check on that aswell in the drag event. 

Google chrome version 51.0.2704.103
Windows 10
Owner: pwnall@chromium.org
Status: Assigned (was: Unconfirmed)
Summary: clientX/Y incorrect at dragend in iframe (was: clientX/Y incorrect at dragend on dualscreen)
I was able to reproduce this on a single screen. clientX / clientY are off because jsbin uses an iframe to render the document.

I put together a test in a CL: http://crrev.com/2469863003

Code fix hopefully coming soon too.
Trace of what's happening.

WebViewImpl::dragTargetEnterOrOver ->
* creates DragData (:3626)
    * clientPosition <- pointInRootFrame 
    * screenPosition <- screenPoint
-> DragController::drag{Entered,Updated}
-> DragController::dragEnteredOrUpdated
-> DragController::tryDocumentDrag
-> DragController::tryDHTMLDrag
    * creates event via DragController::createMouseEvent (:120)
    * position <- clientPosition
    * globalPosition <- globalPosition
-> EventHandler::updateDragAndDrop -- PlatformMouseEvent is const
    * AutoscrollController::updateDragAndDrop -- eventPosition is const
    * EventHandler.cpp-static targetIsFrame -- yes for iframe
    * may recursively call EventHandler::updateDragAndDrop
    * MouseEventManager::dispatchDragSrcEvent with drag for source
	* uses dragState().m_dragSrc.get()
-> MouseEventManager::dispatchDragEvent

WebViewImpl::dragSourceEndedAt ->
* constructs PlatformMouseEvent (:3492)
    * position <- pointInRootFrame
    * globalPosition <- screenPoint
-> EventHandler::dragSourceEndedAt -- PlatformMouseEvent is const
-> MouseEventManager::dragSourceEndedAt
-> MouseEventManager::dispatchDragSrcEvent 
-> MouseEventManager::dispatchDragEvent

Project Member

Comment 7 by bugdroid1@chromium.org, Nov 3 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/32e50971f32bcd21be8540758efe9aac0ffafcd9

commit 32e50971f32bcd21be8540758efe9aac0ffafcd9
Author: pwnall <pwnall@chromium.org>
Date: Thu Nov 03 19:22:25 2016

Delegate dragend to the correct frame's EventHandler.

Currently, most drag-and-drop events are correctly delegated to the
EventHandler of the frame that contains the events' target elements, in
EventHandler::updateDragAndDrop. However,
EventHandler::dragSourceEndedAt does not implement this delegation.  The
issue is visible to the Web in a subtle way -- the frame of the
EventHandler is used to populate the DragEvent's view, which is used to
compute the clientX and clientY attributes, which are user-visible.

This CL implements the delegation used by
MouseEventManager::dispatchDragSrcEvent, into
MouseEventManager::dispatchDragSrcEvent.

BUG= 618770 

Review-Url: https://codereview.chromium.org/2469863003
Cr-Commit-Position: refs/heads/master@{#429669}

[add] https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-iframe.html
[add] https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates.html
[add] https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates.css
[add] https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates.js
[modify] https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9/third_party/WebKit/Source/core/input/MouseEventManager.cpp

Project Member

Comment 8 by bugdroid1@chromium.org, Nov 4 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4377f6270a5f3a53d2bb56f5a276c243aa36f7e8

commit 4377f6270a5f3a53d2bb56f5a276c243aa36f7e8
Author: tapted <tapted@chromium.org>
Date: Fri Nov 04 05:13:56 2016

Revert of Delegate dragend to the correct frame's EventHandler. (patchset #4 id:120001 of https://codereview.chromium.org/2469863003/ )

Reason for revert:
Suspected for drag-over-iframe-invalid-source-crash.html  failure on WebKit Linux Precise Leak
Starts
https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Linux%20Precise%20Leak/builds/1428
Error like
({"numberOfLiveActiveDOMObjects":[2,3],"numberOfLiveDocuments":[1,2],"numberOfLiveNodes":[4,23],"numberOfLiveResources":[0,1]})

Original issue's description:
> Delegate dragend to the correct frame's EventHandler.
>
> Currently, most drag-and-drop events are correctly delegated to the
> EventHandler of the frame that contains the events' target elements, in
> EventHandler::updateDragAndDrop. However,
> EventHandler::dragSourceEndedAt does not implement this delegation.  The
> issue is visible to the Web in a subtle way -- the frame of the
> EventHandler is used to populate the DragEvent's view, which is used to
> compute the clientX and clientY attributes, which are user-visible.
>
> This CL implements the delegation used by
> MouseEventManager::dispatchDragSrcEvent, into
> MouseEventManager::dispatchDragSrcEvent.
>
> BUG= 618770 
>
> Committed: https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9
> Cr-Commit-Position: refs/heads/master@{#429669}

TBR=dcheng@chromium.org,pwnall@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 618770 

Review-Url: https://codereview.chromium.org/2472323002
Cr-Commit-Position: refs/heads/master@{#429789}

[delete] https://crrev.com/3ab9dabc6e54050b0dcadf010b917713eb3a9219/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-iframe.html
[delete] https://crrev.com/3ab9dabc6e54050b0dcadf010b917713eb3a9219/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates.html
[delete] https://crrev.com/3ab9dabc6e54050b0dcadf010b917713eb3a9219/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates.css
[delete] https://crrev.com/3ab9dabc6e54050b0dcadf010b917713eb3a9219/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates.js
[modify] https://crrev.com/4377f6270a5f3a53d2bb56f5a276c243aa36f7e8/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/4377f6270a5f3a53d2bb56f5a276c243aa36f7e8/third_party/WebKit/Source/core/input/MouseEventManager.cpp

Project Member

Comment 9 by bugdroid1@chromium.org, Nov 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fb74d203dc9797b1e12592cac7c86f1d2b923eab

commit fb74d203dc9797b1e12592cac7c86f1d2b923eab
Author: pwnall <pwnall@chromium.org>
Date: Tue Nov 08 00:06:49 2016

Delegate dragend to the correct frame's EventHandler.

This is a re-land of https://crrev.com/32e50971f32bcd21be8540758efe9aac0ffafcd9
whose description is below.

Currently, most drag-and-drop events are correctly delegated to the
EventHandler of the frame that contains the events' target elements, in
EventHandler::updateDragAndDrop. However,
EventHandler::dragSourceEndedAt does not implement this delegation.  The
issue is visible to the Web in a subtle way -- the frame of the
EventHandler is used to populate the DragEvent's view, which is used to
compute the clientX and clientY attributes, which are user-visible.

This CL implements the delegation used by
MouseEventManager::dispatchDragSrcEvent, into
MouseEventManager::dispatchDragSrcEvent.

BUG= 618770 

Review-Url: https://codereview.chromium.org/2471843005
Cr-Commit-Position: refs/heads/master@{#430432}

[add] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-iframe.html
[add] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-nested-iframes.html
[add] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates.html
[add] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates-nested-iframe.css
[add] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates.css
[add] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/LayoutTests/fast/dnd/resources/event-mouse-coordinates.js
[modify] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/fb74d203dc9797b1e12592cac7c86f1d2b923eab/third_party/WebKit/Source/core/input/MouseEventManager.cpp

Status: Fixed (was: Assigned)

Sign in to add a comment