Chromium Code Reviews

Unified Diff: Source/core/html/track/TextTrackContainer.cpp

Issue 962923002: Ideas for text track container follow-up Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase and ramble Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « Source/core/html/track/TextTrackContainer.h ('k') | Source/core/layout/LayoutTextTrackContainer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/TextTrackContainer.cpp
diff --git a/Source/core/html/track/TextTrackContainer.cpp b/Source/core/html/track/TextTrackContainer.cpp
index 9e6d6f116049f51f770143df81cda9dd73d053d6..5bc8903cebe80482f19b96599987e24a129b4e9f 100644
--- a/Source/core/html/track/TextTrackContainer.cpp
+++ b/Source/core/html/track/TextTrackContainer.cpp
@@ -55,9 +55,9 @@ LayoutObject* TextTrackContainer::createRenderer(const LayoutStyle&)
return new LayoutTextTrackContainer(this);
}
-void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
+void TextTrackContainer::updateDisplay(HTMLVideoElement& video)
{
- if (!mediaElement.closedCaptionsVisible()) {
+ if (!video.closedCaptionsVisible()) {
removeChildren();
return;
}
@@ -65,11 +65,8 @@ void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
// 1. If the media element is an audio element, or is another playback
// mechanism with no rendering area, abort these steps. There is nothing to
// render.
- if (isHTMLAudioElement(mediaElement))
- return;
// 2. Let video be the media element or other playback mechanism.
- HTMLVideoElement& video = toHTMLVideoElement(mediaElement);
// 3. Let output be an empty list of absolutely positioned CSS block boxes.
@@ -118,25 +115,18 @@ void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
// 11. Return output.
}
-void TextTrackContainer::updateSizes(HTMLMediaElement& mediaElement)
+void TextTrackContainer::updateSizes(const LayoutSize& videoSize)
{
- if (!document().isActive())
- return;
-
- if (!mediaElement.renderer() || !mediaElement.renderer()->isVideo())
- return;
-
// FIXME: The video size is used to calculate the font size (a workaround
// for lack of per-spec vh/vw support) but the whole media element is used
// for cue rendering. This is inconsistent. See also the somewhat related
// spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105
- IntSize videoSize = toLayoutVideo(mediaElement.renderer())->videoBox().size();
if (m_videoSize == videoSize)
return;
m_videoSize = videoSize;
- float smallestDimension = std::min(m_videoSize.height(), m_videoSize.width());
+ float smallestDimension = std::min(m_videoSize.height().toFloat(), m_videoSize.width().toFloat());
float fontSize = smallestDimension * 0.05f;
if (fontSize != m_fontSize) {
« no previous file with comments | « Source/core/html/track/TextTrackContainer.h ('k') | Source/core/layout/LayoutTextTrackContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine