Title: [148131] trunk
Revision
148131
Author
commit-qu...@webkit.org
Date
2013-04-10 13:02:43 -0700 (Wed, 10 Apr 2013)

Log Message

Clicking on the volume slider of HTML5 elements is pausing sometimes
https://bugs.webkit.org/show_bug.cgi?id=112548

Patch by Xabier Rodriguez Calvar <calva...@igalia.com> on 2013-04-10
Reviewed by Eric Carlson.

Source/WebCore:

Test: media/click-volume-bar-not-pausing.html

* html/shadow/MediaControlElementTypes.cpp:
(WebCore::MediaControlVolumeSliderElement::defaultEventHandler):
Calling the setDefaultHandled() method on the event prevents it
from being incorrectly propagated from the volume button up to the
MediaDocument.

LayoutTests:

Added test.

* media/click-volume-bar-not-pausing-expected.txt: Added.
* media/click-volume-bar-not-pausing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148130 => 148131)


--- trunk/LayoutTests/ChangeLog	2013-04-10 20:01:14 UTC (rev 148130)
+++ trunk/LayoutTests/ChangeLog	2013-04-10 20:02:43 UTC (rev 148131)
@@ -1,3 +1,15 @@
+2013-04-10  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        Clicking on the volume slider of HTML5 elements is pausing sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=112548
+
+        Reviewed by Eric Carlson.
+
+        Added test.
+
+        * media/click-volume-bar-not-pausing-expected.txt: Added.
+        * media/click-volume-bar-not-pausing.html: Added.
+
 2013-04-10  Michael Saboff  <msab...@apple.com>
 
         DFG: Negative size for new Array() interpreted as large unsigned int

Added: trunk/LayoutTests/media/click-volume-bar-not-pausing-expected.txt (0 => 148131)


--- trunk/LayoutTests/media/click-volume-bar-not-pausing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/click-volume-bar-not-pausing-expected.txt	2013-04-10 20:02:43 UTC (rev 148131)
@@ -0,0 +1,11 @@
+Click on volume bar on a MediaDocument does not pause.
+
+
+EVENT(playing)
+EXPECTED (mediaElement.volume == '1') OK
+EXPECTED (mediaElement.paused == 'false') OK
+EVENT(volumechange)
+EXPECTED (mediaElement.volume != '1') OK
+EXPECTED (mediaElement.paused == 'false') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/click-volume-bar-not-pausing.html (0 => 148131)


--- trunk/LayoutTests/media/click-volume-bar-not-pausing.html	                        (rev 0)
+++ trunk/LayoutTests/media/click-volume-bar-not-pausing.html	2013-04-10 20:02:43 UTC (rev 148131)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+    <title>Click on volume bar on a MediaDocument does not pause.</title>
+
+    <head>
+        <script src=""
+        <script src=""
+        <script src=""
+        <script type="text/_javascript_">
+            var mediaElement;
+            var skipOnFirstEmptyLoad = 0;
+
+            function calculateElementCoordinates(id)
+            {
+                var elementCoordinates;
+
+                try {
+                    elementCoordinates = mediaControlsButtonCoordinates(mediaElement, id);
+                } catch (exception) {
+                    consoleWrite("ERROR: unable to get controls coordinates.");
+                    failTest();
+                }
+
+                var frameBoundingRect = document.querySelector("iframe").getBoundingClientRect();
+                elementCoordinates[0] += frameBoundingRect.left;
+                elementCoordinates[1] += frameBoundingRect.top;
+
+                return elementCoordinates;
+            }
+
+            function clickVolumeSlider()
+            {
+                if (!window.eventSender) {
+                    consoleWrite("ERROR: no event sender.");
+                    failTest();
+                }
+
+                var muteButtonCoordinates;
+                var volumeSliderCoordinates;
+
+                muteButtonCoordinates = calculateElementCoordinates("mute-button");
+                eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1]);
+
+                // Forcing relayout calculations to say that you are
+                // triggering the volume slider to show up for
+                // controls that work that way.
+                document.body.offsetTop;
+
+                volumeSliderCoordinates = calculateElementCoordinates("volume-slider");
+                eventSender.mouseMoveTo(volumeSliderCoordinates[0], volumeSliderCoordinates[1]);
+                eventSender.mouseDown();
+                eventSender.mouseUp();
+            }
+
+            function finishTest()
+            {
+                testExpected("mediaElement.volume", 1, "!=");
+                testExpected("mediaElement.paused", false);
+
+                endTest();
+            }
+
+            function frameLoaded()
+            {
+                if (++skipOnFirstEmptyLoad == 1)
+                    return;
+
+                var standaloneMediaDocument = document.getElementById("videoframe").contentDocument;
+                mediaElement = standaloneMediaDocument.querySelector("video");
+
+                waitForEventAndFail("error");
+                waitForEvent('playing', playing);
+
+                mediaElement.pause();
+                mediaElement.play();
+            }
+
+            function playing()
+            {
+                testExpected("mediaElement.volume", 1);
+                testExpected("mediaElement.paused", false);
+
+                waitForEvent('volumechange', finishTest);
+
+                clickVolumeSlider();
+            }
+        </script>
+    </head>
+    <body>
+        <p>Click on volume bar on a MediaDocument does not pause.</p>
+        <iframe id="videoframe" width=380 height=330 _onload_="frameLoaded()"></iframe>
+        <script type="text/_javascript_">
+            document.getElementById("videoframe").src = "" "content/test");
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (148130 => 148131)


--- trunk/Source/WebCore/ChangeLog	2013-04-10 20:01:14 UTC (rev 148130)
+++ trunk/Source/WebCore/ChangeLog	2013-04-10 20:02:43 UTC (rev 148131)
@@ -1,3 +1,18 @@
+2013-04-10  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        Clicking on the volume slider of HTML5 elements is pausing sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=112548
+
+        Reviewed by Eric Carlson.
+
+        Test: media/click-volume-bar-not-pausing.html
+
+        * html/shadow/MediaControlElementTypes.cpp:
+        (WebCore::MediaControlVolumeSliderElement::defaultEventHandler):
+        Calling the setDefaultHandled() method on the event prevents it
+        from being incorrectly propagated from the volume button up to the
+        MediaDocument.
+
 2013-04-10  Arvid Nilsson  <anils...@rim.com>
 
         [BlackBerry] Rename BlackBerry specific Texture class

Modified: trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp (148130 => 148131)


--- trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp	2013-04-10 20:01:14 UTC (rev 148130)
+++ trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp	2013-04-10 20:02:43 UTC (rev 148131)
@@ -272,6 +272,7 @@
         mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION);
     if (m_clearMutedOnUserInteraction)
         mediaController()->setMuted(false);
+    event->setDefaultHandled();
 }
 
 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to