Fullscreen movie controls behave incorrectly when clicked (and dragged)
https://bugs.webkit.org/show_bug.cgi?id=99610

Reviewed by Eric Carlson.

Source/WebCore:

Do not reset the relative drag position to 0,0 at the beginning of every drag.  Instead,
store the cumulative drag offset and accumulate during each additional drag.

No new tests; modified the fullscreen/video-controls-drag.html test.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::startDrag): Reset m_lastDragEventLocation.
(WebCore::MediaControlPanelElement::continueDrag): Accumulate drag distance in m_cumulativeDragOffset.
(WebCore::MediaControlPanelElement::resetPosition): Reset m_cumulativeDragOffset.
* html/shadow/MediaControlElements.h:

LayoutTests:

Add a second drag operation, testing that the location does not reset at the beginning of
each additional drag.

* fullscreen/video-controls-drag-expected.txt:
* fullscreen/video-controls-drag.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fullscreen/video-controls-drag.html b/LayoutTests/fullscreen/video-controls-drag.html
index cae2a56..0f0df62 100644
--- a/LayoutTests/fullscreen/video-controls-drag.html
+++ b/LayoutTests/fullscreen/video-controls-drag.html
@@ -20,6 +20,8 @@
                 panel = mediaControlsElement(internals.shadowRoot(video).firstChild, '-webkit-media-controls-panel');
                 startBox = internals.boundingBox(panel);
 
+                consoleWrite("First drag.");
+
                 eventSender.mouseMoveTo(startBox.left + 5, startBox.top + 5);
                 eventSender.mouseDown();
 
@@ -30,6 +32,18 @@
 
                 testExpected("endBox.left - startBox.left", 15);
                 testExpected("endBox.top - startBox.top", 15);
+
+                consoleWrite("Second drag.");
+
+                eventSender.mouseDown();
+                eventSender.mouseMoveTo(startBox.left + 10, startBox.top + 10);
+                eventSender.mouseUp();
+
+                endBox = internals.boundingBox(panel);
+
+                testExpected("endBox.left - startBox.left", 5);
+                testExpected("endBox.top - startBox.top", 5);
+
                 endTest();
             }
             else