Title: [146140] trunk/Source/WebCore
Revision
146140
Author
jer.no...@apple.com
Date
2013-03-18 15:51:31 -0700 (Mon, 18 Mar 2013)

Log Message

Text track cues do not update sizes when entering or exiting full screen.
https://bugs.webkit.org/show_bug.cgi?id=112472

Reviewed by Eric Carlson.

The style properties of the TextCueBoxes were not being updated after the size of the video bounds changed.
Because getDisplayTree() will not do it when the cue itself has not changed, explicitly call videoSizeDidChange()
from updateSizes().

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateSizes): call videoSizeDidChange() on every active cue.
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::hasDisplayTree): returns whether or not the cue has created a display tree without side effects.
(WebCore::TextTrackCue::videoSizeDidChange): Overridable empty method.
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGeneric::videoSizeDidChange): Update the CSS height attribute of the cue box using the new video size.
* html/track/TextTrackCueGeneric.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146139 => 146140)


--- trunk/Source/WebCore/ChangeLog	2013-03-18 22:49:41 UTC (rev 146139)
+++ trunk/Source/WebCore/ChangeLog	2013-03-18 22:51:31 UTC (rev 146140)
@@ -1,3 +1,23 @@
+2013-03-15  Jer Noble  <jer.no...@apple.com>
+
+        Text track cues do not update sizes when entering or exiting full screen.
+        https://bugs.webkit.org/show_bug.cgi?id=112472
+
+        Reviewed by Eric Carlson.
+
+        The style properties of the TextCueBoxes were not being updated after the size of the video bounds changed.
+        Because getDisplayTree() will not do it when the cue itself has not changed, explicitly call videoSizeDidChange()
+        from updateSizes().
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::updateSizes): call videoSizeDidChange() on every active cue.
+        * html/track/TextTrackCue.h:
+        (WebCore::TextTrackCue::hasDisplayTree): returns whether or not the cue has created a display tree without side effects.
+        (WebCore::TextTrackCue::videoSizeDidChange): Overridable empty method.
+        * html/track/TextTrackCueGeneric.cpp:
+        (WebCore::TextTrackCueGeneric::videoSizeDidChange): Update the CSS height attribute of the cue box using the new video size.
+        * html/track/TextTrackCueGeneric.h:
+
 2013-03-18  Mike West  <mk...@chromium.org>
 
         CSP 1.1: Add 'effective-directive' to violation reports.

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (146139 => 146140)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-03-18 22:49:41 UTC (rev 146139)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-03-18 22:51:31 UTC (rev 146140)
@@ -1339,6 +1339,12 @@
         m_fontSize = fontSize;
         setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px", important);
     }
+
+    CueList activeCues = mediaElement->currentlyActiveCues();
+    for (size_t i = 0; i < activeCues.size(); ++i) {
+        TextTrackCue* cue = activeCues[i].data();
+        cue->videoSizeDidChange(m_videoDisplaySize.size());
+    }
 }
 
 void MediaControlTextTrackContainerElement::paintTextTrackRepresentation(GraphicsContext* context, const IntRect& contextRect)

Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (146139 => 146140)


--- trunk/Source/WebCore/html/track/TextTrackCue.h	2013-03-18 22:49:41 UTC (rev 146139)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h	2013-03-18 22:51:31 UTC (rev 146140)
@@ -138,6 +138,7 @@
     bool isActive();
     void setIsActive(bool);
 
+    bool hasDisplayTree() const { return m_displayTree; }
     PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize);
     PassRefPtr<HTMLDivElement> element() const { return m_cueBackgroundBox; }
 
@@ -171,6 +172,8 @@
     };
     CueAlignment getAlignment() const { return m_cueAlignment; }
 
+    virtual void videoSizeDidChange(const IntSize&) { }
+
     virtual bool operator==(const TextTrackCue&) const;
     virtual bool operator!=(const TextTrackCue& cue) const
     {

Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (146139 => 146140)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp	2013-03-18 22:49:41 UTC (rev 146139)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp	2013-03-18 22:51:31 UTC (rev 146140)
@@ -135,6 +135,20 @@
     TextTrackCue::setPosition(position, ec);
 }
 
+void TextTrackCueGeneric::videoSizeDidChange(const IntSize& videoSize)
+{
+    if (!hasDisplayTree())
+        return;
+
+    if (baseFontSizeRelativeToVideoHeight()) {
+        double fontSize = videoSize.height() * baseFontSizeRelativeToVideoHeight() / 100;
+        if (fontSizeMultiplier())
+            fontSize *= fontSizeMultiplier() / 100;
+        displayTreeInternal()->setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px");
+    }
+
+}
+
 bool TextTrackCueGeneric::operator==(const TextTrackCue& cue) const
 {
     if (cue.cueType() != TextTrackCue::Generic)

Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.h (146139 => 146140)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2013-03-18 22:49:41 UTC (rev 146139)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2013-03-18 22:51:31 UTC (rev 146140)
@@ -68,6 +68,8 @@
     Color backgroundColor() const { return m_backgroundColor; }
     void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
 
+    virtual void videoSizeDidChange(const IntSize&);
+
     virtual bool operator==(const TextTrackCue&) const OVERRIDE;
     virtual bool operator!=(const TextTrackCue& cue) const OVERRIDE
     {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to