2009-08-12 Alpha Lam <hclam@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2009 01:00:41 +0000 (01:00 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2009 01:00:41 +0000 (01:00 +0000)
        Reviewed by Simon Fraser.

        Fix regression for dragging the media controller thumb.
        https://bugs.webkit.org/show_bug.cgi?id=28211

        Add a layout test to make sure dragging the timebar thumb of media
        controls causes seeks.

        * media/controls-drag-timebar-expected.txt: Added.
        * media/controls-drag-timebar.html: Added.

2009-08-12  Alpha Lam  <hclam@chromium.org>

        Reviewed by Simon Fraser.

        Fix regression for dragging the media controller thumb.
        https://bugs.webkit.org/show_bug.cgi?id=28211

        Modified the conditions for rejecting events on the media controller
        to only rejecting mouse events not from the left button.

        Test: media/controls-drag-timebar.html

        * rendering/MediaControlElements.cpp:
        (WebCore::MediaControlTimelineElement::defaultEventHandler):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/controls-drag-timebar-expected.txt [new file with mode: 0644]
LayoutTests/media/controls-drag-timebar.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/MediaControlElements.cpp

index f8c0df8..2ddce38 100644 (file)
@@ -1,3 +1,16 @@
+2009-08-12  Alpha Lam  <hclam@chromium.org>
+
+        Reviewed by Simon Fraser.
+
+        Fix regression for dragging the media controller thumb.
+        https://bugs.webkit.org/show_bug.cgi?id=28211
+
+        Add a layout test to make sure dragging the timebar thumb of media
+        controls causes seeks.
+
+        * media/controls-drag-timebar-expected.txt: Added.
+        * media/controls-drag-timebar.html: Added.
+
 2009-08-12  Dumitru Daniliuc  <dumi@chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/media/controls-drag-timebar-expected.txt b/LayoutTests/media/controls-drag-timebar-expected.txt
new file mode 100644 (file)
index 0000000..08ea19a
--- /dev/null
@@ -0,0 +1,13 @@
+Test that drag the timebar thumb causes seeks.
+
+RUN(video.autoplay = true)
+RUN(video.src = 'content/test.mp4')
+EVENT(playing)
+EVENT(seeked)
+Time: 1.7
+EVENT(seeked)
+Time: 2.2
+EVENT(seeked)
+Time: 2.7
+END OF TEST
+
diff --git a/LayoutTests/media/controls-drag-timebar.html b/LayoutTests/media/controls-drag-timebar.html
new file mode 100644 (file)
index 0000000..bb2b321
--- /dev/null
@@ -0,0 +1,66 @@
+<html>
+    <head>
+        <title>drag timebar test</title>
+        <script src=video-test.js></script>
+        <script>
+            var x, y, time, count;
+            var seek = 0;
+
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+
+            function test()
+            {
+                if (window.eventSender) {
+                    x = video.offsetLeft + (video.offsetWidth / 3);
+                    y = video.offsetTop + video.offsetHeight - 10;
+                    time = video.currentTime.toFixed(1);
+                    count = 0;
+
+                    eventSender.dragMode = false;
+                    eventSender.mouseMoveTo(x, y);
+                    eventSender.mouseDown();
+                }
+                window.setTimeout("move()", 100);
+            }
+
+            function move()
+            {
+                if (window.eventSender) {
+                    x += 20;
+                    eventSender.mouseMoveTo(x, y);
+                }
+                if (++count >= 3)
+                    eventSender.mouseUp();
+                window.setTimeout("move()", 100);
+            }
+
+            function playing()
+            {
+                window.setTimeout("test()", 100);
+            }
+
+            function seeked()
+            {
+                consoleWrite("Time: " + video.currentTime.toFixed(1));
+                if (++seek == 3)
+                    endTest();
+            }
+
+            function start()
+            {
+                findMediaElement();
+                waitForEvent('playing', playing);
+                waitForEvent('seeked', seeked);
+                run("video.autoplay = true");
+                run("video.src = 'content/test.mp4'");
+            }    
+        </script>
+    </head>
+
+    <body onload="start()">
+    <p>Test that drag the timebar thumb causes seeks.</p>
+    <video controls></video>
+    </body>
+</html>
+
index 5cc1ae5..ca60700 100644 (file)
@@ -1,3 +1,18 @@
+2009-08-12  Alpha Lam  <hclam@chromium.org>
+
+        Reviewed by Simon Fraser.
+
+        Fix regression for dragging the media controller thumb.
+        https://bugs.webkit.org/show_bug.cgi?id=28211
+
+        Modified the conditions for rejecting events on the media controller
+        to only rejecting mouse events not from the left button.
+
+        Test: media/controls-drag-timebar.html
+
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaControlTimelineElement::defaultEventHandler):
+
 2009-08-12  Dumitru Daniliuc  <dumi@chromium.org>
 
         Reviewed by Eric Seidel.
index 352f270..b17400f 100644 (file)
@@ -482,8 +482,8 @@ MediaControlTimelineElement::MediaControlTimelineElement(Document* document, HTM
 
 void MediaControlTimelineElement::defaultEventHandler(Event* event)
 {
-    // Left button is 0. Accepts only if mouse event is from left button.
-    if (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button())
+    // Left button is 0. Rejects mouse events not from left button.
+    if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
         return;
 
     if (event->type() == eventNames().mousedownEvent)