Title: [131781] trunk
Revision
131781
Author
[email protected]
Date
2012-10-18 11:20:28 -0700 (Thu, 18 Oct 2012)

Log Message

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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131780 => 131781)


--- trunk/LayoutTests/ChangeLog	2012-10-18 18:18:35 UTC (rev 131780)
+++ trunk/LayoutTests/ChangeLog	2012-10-18 18:20:28 UTC (rev 131781)
@@ -1,3 +1,16 @@
+2012-10-18  Jer Noble  <[email protected]>
+
+        Fullscreen movie controls behave incorrectly when clicked (and dragged)
+        https://bugs.webkit.org/show_bug.cgi?id=99610
+
+        Reviewed by Eric Carlson.
+
+        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:
+
 2012-10-18  Brandon Jones  <[email protected]>
 
         Implement OES_element_index_uint / WEBKIT_OES_element_index_uint

Modified: trunk/LayoutTests/fullscreen/video-controls-drag-expected.txt (131780 => 131781)


--- trunk/LayoutTests/fullscreen/video-controls-drag-expected.txt	2012-10-18 18:18:35 UTC (rev 131780)
+++ trunk/LayoutTests/fullscreen/video-controls-drag-expected.txt	2012-10-18 18:20:28 UTC (rev 131781)
@@ -1,7 +1,11 @@
 This tests that the video element's controls are draggable in full screen. Press any key to continue.
 
 EVENT(webkitfullscreenchange)
+First drag.
 EXPECTED (endBox.left - startBox.left == '15') OK
 EXPECTED (endBox.top - startBox.top == '15') OK
+Second drag.
+EXPECTED (endBox.left - startBox.left == '5') OK
+EXPECTED (endBox.top - startBox.top == '5') OK
 END OF TEST
 

Modified: trunk/LayoutTests/fullscreen/video-controls-drag.html (131780 => 131781)


--- trunk/LayoutTests/fullscreen/video-controls-drag.html	2012-10-18 18:18:35 UTC (rev 131780)
+++ trunk/LayoutTests/fullscreen/video-controls-drag.html	2012-10-18 18:20:28 UTC (rev 131781)
@@ -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

Modified: trunk/Source/WebCore/ChangeLog (131780 => 131781)


--- trunk/Source/WebCore/ChangeLog	2012-10-18 18:18:35 UTC (rev 131780)
+++ trunk/Source/WebCore/ChangeLog	2012-10-18 18:20:28 UTC (rev 131781)
@@ -1,3 +1,21 @@
+2012-10-18  Jer Noble  <[email protected]>
+
+        Fullscreen movie controls behave incorrectly when clicked (and dragged)
+        https://bugs.webkit.org/show_bug.cgi?id=99610
+
+        Reviewed by Eric Carlson.
+
+        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:
+
 2012-10-18  Brandon Jones  <[email protected]>
 
         Implement OES_element_index_uint / WEBKIT_OES_element_index_uint

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (131780 => 131781)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2012-10-18 18:18:35 UTC (rev 131780)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2012-10-18 18:20:28 UTC (rev 131781)
@@ -156,7 +156,7 @@
     if (!frame)
         return;
 
-    m_dragStartEventLocation = eventLocation;
+    m_lastDragEventLocation = eventLocation;
 
     frame->eventHandler()->setCapturingMouseEventsNode(this);
 
@@ -168,8 +168,10 @@
     if (!m_isBeingDragged)
         return;
 
-    LayoutSize distanceDragged = eventLocation - m_dragStartEventLocation;
-    setPosition(LayoutPoint(distanceDragged.width(), distanceDragged.height()));
+    LayoutSize distanceDragged = eventLocation - m_lastDragEventLocation;
+    m_cumulativeDragOffset.move(distanceDragged);
+    m_lastDragEventLocation = eventLocation;
+    setPosition(m_cumulativeDragOffset);
 }
 
 void MediaControlPanelElement::endDrag()
@@ -237,6 +239,9 @@
 
     ExceptionCode ignored;
     classList()->remove("dragged", ignored);
+
+    m_cumulativeDragOffset.setX(0);
+    m_cumulativeDragOffset.setY(0);
 }
 
 void MediaControlPanelElement::makeOpaque()

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (131780 => 131781)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.h	2012-10-18 18:18:35 UTC (rev 131780)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h	2012-10-18 18:20:28 UTC (rev 131781)
@@ -139,7 +139,8 @@
     bool m_isBeingDragged;
     bool m_isDisplayed;
     bool m_opaque;
-    LayoutPoint m_dragStartEventLocation;
+    LayoutPoint m_lastDragEventLocation;
+    LayoutPoint m_cumulativeDragOffset;
 
     Timer<MediaControlPanelElement> m_transitionTimer;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to