Title: [168479] trunk/Source/WebCore
Revision
168479
Author
bfulg...@apple.com
Date
2014-05-08 12:03:38 -0700 (Thu, 08 May 2014)

Log Message

Cue display events may not be registered during page load.
https://bugs.webkit.org/show_bug.cgi?id=132696
<rdar://problem/16652874>

Reviewed by Eric Carlson.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.handleTextTrackAdd): Don't register
for 'cuechange' events anymore.
(Controller.prototype.handleTextTrackRemove): Ditto.
(Controller.prototype.updateCaptionContainer): Reduce CSS
churn by not adding/removing 'Hidden' class every time a
new cue is processed. Only do this when transitioning
track display state.
(Controller.prototype.handleTextTrackCueChange): Deleted.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateTextTrackDisplay): Call
'updateTextTrackContainer' directory when processing cues,
rather than trampolining through the JS layer.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168478 => 168479)


--- trunk/Source/WebCore/ChangeLog	2014-05-08 18:33:18 UTC (rev 168478)
+++ trunk/Source/WebCore/ChangeLog	2014-05-08 19:03:38 UTC (rev 168479)
@@ -1,3 +1,25 @@
+2014-05-08  Brent Fulgham  <bfulg...@apple.com>
+
+        Cue display events may not be registered during page load.
+        https://bugs.webkit.org/show_bug.cgi?id=132696
+        <rdar://problem/16652874>
+
+        Reviewed by Eric Carlson.
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.handleTextTrackAdd): Don't register
+        for 'cuechange' events anymore.
+        (Controller.prototype.handleTextTrackRemove): Ditto.
+        (Controller.prototype.updateCaptionContainer): Reduce CSS
+        churn by not adding/removing 'Hidden' class every time a
+        new cue is processed. Only do this when transitioning
+        track display state.
+        (Controller.prototype.handleTextTrackCueChange): Deleted.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updateTextTrackDisplay): Call
+        'updateTextTrackContainer' directory when processing cues,
+        rather than trampolining through the JS layer.
+
 2014-05-08  Alexey Proskuryakov  <a...@apple.com>
 
         Make BlobDataFileReference manage its sandbox extension

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (168478 => 168479)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2014-05-08 18:33:18 UTC (rev 168478)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2014-05-08 19:03:38 UTC (rev 168479)
@@ -571,7 +571,6 @@
     handleTextTrackAdd: function(event)
     {
         var track = event.track;
-        this.listenFor(track, 'cuechange', this.handleTextTrackCueChange);
 
         if (this.trackHasThumbnails(track) && track.mode === 'disabled')
             track.mode = 'hidden';
@@ -583,18 +582,11 @@
 
     handleTextTrackRemove: function(event)
     {
-        var track = event.track;
-        this.stopListeningFor(track, 'cuechange', this.handleTextTrackCueChange);
         this.updateThumbnail();
         this.updateCaptionButton();
         this.updateCaptionContainer();
     },
 
-    handleTextTrackCueChange: function(event)
-    {
-        this.updateCaptionContainer();
-    },
-
     isFullScreen: function()
     {
         return document.webkitCurrentFullScreenElement === this.video;
@@ -1049,9 +1041,12 @@
         if (!this.host.textTrackContainer)
             return;
 
-        if (this.video.webkitHasClosedCaptions)
+        var hasClosedCaptions = this.video.webkitHasClosedCaptions;
+        var hasHiddenClass = this.host.textTrackContainer.classList.contains(this.ClassNames.hidden);
+
+        if (hasClosedCaptions && hasHiddenClass)
             this.host.textTrackContainer.classList.remove(this.ClassNames.hidden);
-        else
+        else if (!hasClosedCaptions && !hasHiddenClass)
             this.host.textTrackContainer.classList.add(this.ClassNames.hidden);
 
         this.updateBase();

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (168478 => 168479)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-05-08 18:33:18 UTC (rev 168478)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-05-08 19:03:38 UTC (rev 168479)
@@ -4939,6 +4939,8 @@
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     ensureUserAgentShadowRoot();
+    ASSERT(m_mediaControlsHost);
+    m_mediaControlsHost->updateTextTrackContainer();
     return;
 #endif
     if (!hasMediaControls() && !createMediaControls())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to