Title: [113110] trunk
Revision
113110
Author
[email protected]
Date
2012-04-03 17:04:21 -0700 (Tue, 03 Apr 2012)

Log Message

Makes sure m_showingByDefault is set to false when TextTrack.mode is set from JS.
https://bugs.webkit.org/show_bug.cgi?id=79791

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/track/track-mode.html

* html/track/TextTrack.cpp:
(WebCore::TextTrack::setMode): setMode should always setShowingByDefault to false.

LayoutTests:

* media/track/track-mode-expected.txt: Added.
* media/track/track-mode.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (113109 => 113110)


--- trunk/LayoutTests/ChangeLog	2012-04-03 23:38:38 UTC (rev 113109)
+++ trunk/LayoutTests/ChangeLog	2012-04-04 00:04:21 UTC (rev 113110)
@@ -1,3 +1,13 @@
+2012-04-03  Anna Cavender  <[email protected]>
+
+        Makes sure m_showingByDefault is set to false when TextTrack.mode is set from JS.
+        https://bugs.webkit.org/show_bug.cgi?id=79791
+
+        Reviewed by Eric Carlson.
+
+        * media/track/track-mode-expected.txt: Added.
+        * media/track/track-mode.html: Added.
+
 2012-04-03  Abhishek Arya  <[email protected]>
 
         Crash in SelectorChecker::checkOneSelector.

Added: trunk/LayoutTests/media/track/track-mode-expected.txt (0 => 113110)


--- trunk/LayoutTests/media/track/track-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-mode-expected.txt	2012-04-04 00:04:21 UTC (rev 113110)
@@ -0,0 +1,30 @@
+Tests that the TextTrack mode attribute is appropriately set.
+
+
+++ Test default attribute value
+EXPECTED (textTrack.mode == '2') OK
+EXPECTED (video.textTracks[0].mode == '2') OK
+
+*** Set to bogus value, should return default
+TEST(textTrack.mode = '37') THROWS(DOMException.INVALID_ACCESS_ERR) OK
+EXPECTED (textTrack.mode == '2') OK
+EXPECTED (video.textTracks[0].mode == '2') OK
+
+*** Set to known values
+++ 'TextTrack.DISABLED'
+RUN(textTrack.mode = '0')
+EXPECTED (textTrack.mode == '0') OK
+EXPECTED (video.textTracks[0].mode == '0') OK
+
+++ 'TextTrack.HIDDEN'
+RUN(textTrack.mode = '1')
+EXPECTED (textTrack.mode == '1') OK
+EXPECTED (video.textTracks[0].mode == '1') OK
+
+++ 'TextTrack.SHOWING'
+RUN(textTrack.mode = '2')
+EXPECTED (textTrack.mode == '2') OK
+EXPECTED (video.textTracks[0].mode == '2') OK
+
+END OF TEST
+

Added: trunk/LayoutTests/media/track/track-mode.html (0 => 113110)


--- trunk/LayoutTests/media/track/track-mode.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-mode.html	2012-04-04 00:04:21 UTC (rev 113110)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+    <head>
+
+        <script src=""
+        <script src=""
+        <script>
+
+            var textTrack;
+            function setMode(value)
+            {
+                run("textTrack.mode = '" + value + "'");
+                testExpected("textTrack.mode", value);
+                testExpected("video.textTracks[0].mode", value);
+                consoleWrite("");
+            }
+
+            function start()
+            {
+                findMediaElement();
+                consoleWrite("");
+
+                textTrack = document.getElementById('track_1').track;
+
+                consoleWrite("<b>++ Test default attribute value</b>");
+                testExpected("textTrack.mode", TextTrack.SHOWING);
+                testExpected("video.textTracks[0].mode", TextTrack.SHOWING);
+                consoleWrite("");
+
+                consoleWrite("<b>*** Set to bogus value, should return default</b>");
+                var value = 37;
+                testException("textTrack.mode = '" + value + "'", "DOMException.INVALID_ACCESS_ERR");
+                testExpected("textTrack.mode", TextTrack.SHOWING);
+                testExpected("video.textTracks[0].mode", TextTrack.SHOWING);
+                consoleWrite("");
+
+                consoleWrite("<b>*** Set to known values</b>");
+                consoleWrite("<b>++ 'TextTrack.DISABLED'</b>");
+                setMode(TextTrack.DISABLED);
+
+                consoleWrite("<b>++ 'TextTrack.HIDDEN'</b>");
+                setMode(TextTrack.HIDDEN);
+
+                consoleWrite("<b>++ 'TextTrack.SHOWING'</b>");
+                setMode(TextTrack.SHOWING);
+
+                endTest();
+            }
+
+        </script>
+    </head>
+    <body>
+        <p>Tests that the TextTrack mode attribute is appropriately set.</p>
+        <video>
+            <track id=track_1 src="" _onload_="start()" default>
+        </video>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (113109 => 113110)


--- trunk/Source/WebCore/ChangeLog	2012-04-03 23:38:38 UTC (rev 113109)
+++ trunk/Source/WebCore/ChangeLog	2012-04-04 00:04:21 UTC (rev 113110)
@@ -1,3 +1,15 @@
+2012-04-03  Anna Cavender  <[email protected]>
+
+        Makes sure m_showingByDefault is set to false when TextTrack.mode is set from JS.
+        https://bugs.webkit.org/show_bug.cgi?id=79791
+
+        Reviewed by Eric Carlson.
+
+        Test: media/track/track-mode.html
+
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::setMode): setMode should always setShowingByDefault to false.
+
 2012-04-03  Jia Pu  <[email protected]>
 
         Rename SpellingCorrectionController to AlternativeTextController.

Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (113109 => 113110)


--- trunk/Source/WebCore/html/track/TextTrack.cpp	2012-04-03 23:38:38 UTC (rev 113109)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp	2012-04-04 00:04:21 UTC (rev 113110)
@@ -139,12 +139,10 @@
     if (m_mode == static_cast<Mode>(mode))
         return;
 
-    // If the new value is 2
     //  ... Note: If the mode had been showing by default, this will change it to showing, 
     // even though the value of mode would appear not to change.
     m_mode = static_cast<Mode>(mode);
-    if (m_mode == TextTrack::SHOWING)
-        setShowingByDefault(false);
+    setShowingByDefault(false);
 
     if (m_client)
         m_client->textTrackModeChanged(this);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to