Title: [93108] trunk
Revision
93108
Author
eric.carl...@apple.com
Date
2011-08-16 09:13:09 -0700 (Tue, 16 Aug 2011)

Log Message

2011-08-16  Eric Carlson  <eric.carl...@apple.com>

        [REGRESSION] Media controls should always be enabled when scripting is disabled
        https://bugs.webkit.org/show_bug.cgi?id=66303

        Reviewed by Dimitri Glazkov.

        Tests: media/video-controls-no-scripting-iframe.html
               media/video-controls-no-scripting.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::attributeChanged): Move the controls enabling/disabling code
            to configureMediaControls.
        (WebCore::HTMLMediaElement::prepareForLoad): Call configureMediaControls.
        (WebCore::HTMLMediaElement::configureMediaControls): New, move code duplicated in 
            attributeChanged and preDispatchEventHandler here.
        (WebCore::HTMLMediaElement::preDispatchEventHandler): Move the controls enabling/disabling code
            to configureMediaControls.
        * html/HTMLMediaElement.h:

2011-08-16  Eric Carlson  <eric.carl...@apple.com>

        [REGRESSION] Media controls should always be enabled when scripting is disabled
        https://bugs.webkit.org/show_bug.cgi?id=66303

        Reviewed by Dimitri Glazkov.

        * media/video-controls-no-scripting-expected.txt: Added.
        * media/video-controls-no-scripting-iframe.html: Added.
        * media/video-controls-no-scripting.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93107 => 93108)


--- trunk/LayoutTests/ChangeLog	2011-08-16 16:03:02 UTC (rev 93107)
+++ trunk/LayoutTests/ChangeLog	2011-08-16 16:13:09 UTC (rev 93108)
@@ -1,3 +1,14 @@
+2011-08-16  Eric Carlson  <eric.carl...@apple.com>
+
+        [REGRESSION] Media controls should always be enabled when scripting is disabled
+        https://bugs.webkit.org/show_bug.cgi?id=66303
+
+        Reviewed by Dimitri Glazkov.
+
+        * media/video-controls-no-scripting-expected.txt: Added.
+        * media/video-controls-no-scripting-iframe.html: Added.
+        * media/video-controls-no-scripting.html: Added.
+
 2011-08-16  Adam Roben  <aro...@apple.com>
 
         Stop skipping the web-apps tests I just landed results for on Lion

Added: trunk/LayoutTests/media/video-controls-no-scripting-expected.txt (0 => 93108)


--- trunk/LayoutTests/media/video-controls-no-scripting-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-controls-no-scripting-expected.txt	2011-08-16 16:13:09 UTC (rev 93108)
@@ -0,0 +1,9 @@
+
+Tests that the built-in controls are always enabled when _javascript_ is disabled.
+
+EXPECTED (internals.shadowRoot(video) != 'null') OK
+EXPECTED (controls.offsetTop + controls.offsetHeight <= '240') OK
+EXPECTED (getComputedStyle(controls).opacity == '1') OK
+
+END OF TEST
+

Added: trunk/LayoutTests/media/video-controls-no-scripting-iframe.html (0 => 93108)


--- trunk/LayoutTests/media/video-controls-no-scripting-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-controls-no-scripting-iframe.html	2011-08-16 16:13:09 UTC (rev 93108)
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+    <head>
+        <style> #error { display: none; } </style>
+        <script>
+            function showErrorMsg() 
+            {
+                document.getElementById('error').style.display = 'block';
+            }
+        </script>
+    </head>
+    
+    <body _onload_="showErrorMsg()">
+    
+        <video>
+            <source src="" type="video/mp4">
+            <source src="" type="video/ogg">
+        </video>
+    
+        <noscript><p>Scripting is DISABLED.</p></noscript>
+    
+        <p id=error>ERROR: _javascript_ must be disabled for this test.</p>
+    
+    </body>
+</html>

Added: trunk/LayoutTests/media/video-controls-no-scripting.html (0 => 93108)


--- trunk/LayoutTests/media/video-controls-no-scripting.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-controls-no-scripting.html	2011-08-16 16:13:09 UTC (rev 93108)
@@ -0,0 +1,35 @@
+<!doctype html>
+<html>
+    <head>
+        <script src="" type="text/_javascript_"></script>
+        <script>
+        function setup()
+        {
+            if (!window.layoutTestController) {
+                consoleWrite("This test only works in DRT.");
+                return;
+            }
+
+            video = document.getElementById("fr").contentDocument.querySelector("video");
+            testExpected("internals.shadowRoot(video)", null, "!=");
+            controls =  internals.shadowRoot(video).firstChild.firstChild;
+            testExpected("controls.offsetTop + controls.offsetHeight", video.offsetHeight, "<=");
+            testExpected("getComputedStyle(controls).opacity", 1);
+            
+            consoleWrite("");
+            endTest();
+        }
+        </script>
+    </head>
+
+    <body>
+
+        <iframe sandbox src="" id="fr" style="width: 400px; height: 320px; border: 1px solid black;"></iframe>
+
+        <p>Tests that the built-in controls are always enabled when _javascript_ is disabled.</p>
+        <pre id="console"></pre>
+        <script>
+            document.getElementById("fr")._onload_ = setup;
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (93107 => 93108)


--- trunk/Source/WebCore/ChangeLog	2011-08-16 16:03:02 UTC (rev 93107)
+++ trunk/Source/WebCore/ChangeLog	2011-08-16 16:13:09 UTC (rev 93108)
@@ -1,3 +1,23 @@
+2011-08-16  Eric Carlson  <eric.carl...@apple.com>
+
+        [REGRESSION] Media controls should always be enabled when scripting is disabled
+        https://bugs.webkit.org/show_bug.cgi?id=66303
+
+        Reviewed by Dimitri Glazkov.
+
+        Tests: media/video-controls-no-scripting-iframe.html
+               media/video-controls-no-scripting.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::attributeChanged): Move the controls enabling/disabling code
+            to configureMediaControls.
+        (WebCore::HTMLMediaElement::prepareForLoad): Call configureMediaControls.
+        (WebCore::HTMLMediaElement::configureMediaControls): New, move code duplicated in 
+            attributeChanged and preDispatchEventHandler here.
+        (WebCore::HTMLMediaElement::preDispatchEventHandler): Move the controls enabling/disabling code
+            to configureMediaControls.
+        * html/HTMLMediaElement.h:
+
 2011-08-16  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: hide non-conservative methods from the protocol documentation.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (93107 => 93108)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-08-16 16:03:02 UTC (rev 93107)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-08-16 16:13:09 UTC (rev 93108)
@@ -233,16 +233,7 @@
     }
     else if (attrName == controlsAttr) {
 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-        if (controls()) {
-            if (!hasMediaControls()) {
-                if (!createMediaControls())
-                    return;
-
-                mediaControls()->reset();
-            }
-            mediaControls()->show();
-        } else if (hasMediaControls())
-            mediaControls()->hide();
+        configureMediaControls();
 #else
         if (m_player)
             m_player->setControls(controls());
@@ -584,6 +575,8 @@
     // algorithm, but do it now because we won't start that until after the timer fires and the 
     // event may have already fired by then.
     setShouldDelayLoadEvent(true);
+
+    configureMediaControls();
 }
 
 void HTMLMediaElement::loadInternal()
@@ -2784,20 +2777,27 @@
     return true;
 }
 
+void HTMLMediaElement::configureMediaControls()
+{
+    if (!controls()) {
+        if (hasMediaControls())
+            mediaControls()->hide();
+        return;
+    }
+
+    if (!hasMediaControls()) {
+        if (!createMediaControls())
+            return;
+        mediaControls()->reset();
+    }
+    mediaControls()->show();
+}
+
 void* HTMLMediaElement::preDispatchEventHandler(Event* event)
 {
-    if (event && event->type() == eventNames().webkitfullscreenchangeEvent) {
-        if (controls()) {
-            if (!hasMediaControls()) {
-                if (!createMediaControls())
-                    return 0;
+    if (event && event->type() == eventNames().webkitfullscreenchangeEvent)
+        configureMediaControls();
 
-                mediaControls()->reset();
-            }
-            mediaControls()->show();
-        } else if (hasMediaControls())
-            mediaControls()->hide();
-    }
     return 0;
 }
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (93107 => 93108)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2011-08-16 16:03:02 UTC (rev 93107)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2011-08-16 16:13:09 UTC (rev 93108)
@@ -339,6 +339,7 @@
 
     bool hasMediaControls();
     bool createMediaControls();
+    void configureMediaControls();
 
     virtual void* preDispatchEventHandler(Event*);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to