Title: [152975] trunk/Source/WebCore
Revision
152975
Author
[email protected]
Date
2013-07-22 09:26:43 -0700 (Mon, 22 Jul 2013)

Log Message

[iOS] captions sometimes positioned incorrectly after fullscreen state change
https://bugs.webkit.org/show_bug.cgi?id=118912

Reviewed by Jer Noble.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Call clearTextTrackRepresentation.
(WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Call updateDisplay so
    cues are re-rendered with the updated size.
(WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): Cleanup the
    text track representation.
(WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): New, force cues to be updated.
(WebCore::MediaControlTextTrackContainerElement::exitedFullscreen): Ditto.
* html/shadow/MediaControlElements.h:

* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::enteredFullscreen): Call MediaControlTextTrackContainerElement::enteredFullscreen.
(WebCore::MediaControls::exitedFullscreen): Call MediaControlTextTrackContainerElement::exitedFullscreen.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152974 => 152975)


--- trunk/Source/WebCore/ChangeLog	2013-07-22 16:23:51 UTC (rev 152974)
+++ trunk/Source/WebCore/ChangeLog	2013-07-22 16:26:43 UTC (rev 152975)
@@ -1,3 +1,24 @@
+2013-07-22  Eric Carlson  <[email protected]>
+
+        [iOS] captions sometimes positioned incorrectly after fullscreen state change
+        https://bugs.webkit.org/show_bug.cgi?id=118912
+
+        Reviewed by Jer Noble.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Call clearTextTrackRepresentation.
+        (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Call updateDisplay so
+            cues are re-rendered with the updated size.
+        (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): Cleanup the
+            text track representation.
+        (WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): New, force cues to be updated.
+        (WebCore::MediaControlTextTrackContainerElement::exitedFullscreen): Ditto.
+        * html/shadow/MediaControlElements.h:
+
+        * html/shadow/MediaControls.cpp:
+        (WebCore::MediaControls::enteredFullscreen): Call MediaControlTextTrackContainerElement::enteredFullscreen.
+        (WebCore::MediaControls::exitedFullscreen): Call MediaControlTextTrackContainerElement::exitedFullscreen.
+
 2013-07-22  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt][WK1] Support direct painting without GraphicsSurface

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (152974 => 152975)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-07-22 16:23:51 UTC (rev 152974)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-07-22 16:26:43 UTC (rev 152975)
@@ -1307,10 +1307,7 @@
         }
     } else {
         hide();
-        m_textTrackRepresentation = nullptr;
-        mediaElement->setTextTrackRepresentation(0);
-        removeInlineStyleProperty(CSSPropertyWidth);
-        removeInlineStyleProperty(CSSPropertyHeight);
+        clearTextTrackRepresentation();
     }
 }
 
@@ -1336,10 +1333,33 @@
     for (size_t i = 0; i < activeCues.size(); ++i) {
         TextTrackCue* cue = activeCues[i].data();
         cue->setFontSize(m_fontSize, m_videoDisplaySize.size(), m_fontSizeIsImportant);
-        
     }
+    updateDisplay();
 }
 
+void MediaControlTextTrackContainerElement::clearTextTrackRepresentation()
+{
+    if (HTMLMediaElement* mediaElement = toParentMediaElement(this))
+        mediaElement->setTextTrackRepresentation(0);
+    m_textTrackRepresentation = nullptr;
+    removeInlineStyleProperty(CSSPropertyPosition);
+    removeInlineStyleProperty(CSSPropertyWidth);
+    removeInlineStyleProperty(CSSPropertyHeight);
+    removeInlineStyleProperty(CSSPropertyLeft);
+    removeInlineStyleProperty(CSSPropertyTop);
+}
+
+void MediaControlTextTrackContainerElement::enteredFullscreen()
+{
+    updateSizes(true);
+}
+
+void MediaControlTextTrackContainerElement::exitedFullscreen()
+{
+    clearTextTrackRepresentation();
+    updateSizes(true);
+}
+
 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate)
 {
     HTMLMediaElement* mediaElement = toParentMediaElement(this);

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (152974 => 152975)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.h	2013-07-22 16:23:51 UTC (rev 152974)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h	2013-07-22 16:26:43 UTC (rev 152975)
@@ -445,6 +445,8 @@
 
     void updateDisplay();
     void updateSizes(bool forceUpdate = false);
+    void enteredFullscreen();
+    void exitedFullscreen();
     static const AtomicString& textTrackContainerElementShadowPseudoId();
 
 private:
@@ -457,6 +459,7 @@
 
     virtual PassRefPtr<Image> createTextTrackRepresentationImage() OVERRIDE;
     virtual void textTrackRepresentationBoundsChanged(const IntRect&) OVERRIDE;
+    void clearTextTrackRepresentation();
     OwnPtr<TextTrackRepresentation> m_textTrackRepresentation;
 
     Timer<MediaControlTextTrackContainerElement> m_updateTimer;

Modified: trunk/Source/WebCore/html/shadow/MediaControls.cpp (152974 => 152975)


--- trunk/Source/WebCore/html/shadow/MediaControls.cpp	2013-07-22 16:23:51 UTC (rev 152974)
+++ trunk/Source/WebCore/html/shadow/MediaControls.cpp	2013-07-22 16:26:43 UTC (rev 152975)
@@ -276,6 +276,10 @@
         page->chrome().setCursorHiddenUntilMouseMoves(true);
 
     startHideFullscreenControlsTimer();
+#if ENABLE(VIDEO_TRACK)
+    if (m_textDisplayContainer)
+        m_textDisplayContainer->enteredFullscreen();
+#endif
 }
 
 void MediaControls::exitedFullscreen()
@@ -283,6 +287,10 @@
     m_isFullscreen = false;
     m_fullScreenButton->setIsFullscreen(false);
     stopHideFullscreenControlsTimer();
+#if ENABLE(VIDEO_TRACK)
+    if (m_textDisplayContainer)
+        m_textDisplayContainer->exitedFullscreen();
+#endif
 }
 
 void MediaControls::defaultEventHandler(Event* event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to