- Revision
- 103486
- Author
- eric.carl...@apple.com
- Date
- 2011-12-21 18:45:23 -0800 (Wed, 21 Dec 2011)
Log Message
Fix text track cue font size and colors
https://bugs.webkit.org/show_bug.cgi?id=75051
Reviewed by Darin Adler.
Source/WebCore:
No new tests, updated media/track/track-cue-rendering.html for the changes.
* css/mediaControls.css:
(video::-webkit-media-text-track-container): Match WebVTT spec.
(video::-webkit-media-text-track-display): Ditto.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateSizes): Change font size from 4% of the
video height to 5% as per the spec. Don't enforce a minimum size.
LayoutTests:
* media/track/track-cue-rendering-expected.txt:
* media/track/track-cue-rendering.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (103485 => 103486)
--- trunk/LayoutTests/ChangeLog 2011-12-22 02:36:11 UTC (rev 103485)
+++ trunk/LayoutTests/ChangeLog 2011-12-22 02:45:23 UTC (rev 103486)
@@ -1,3 +1,13 @@
+2011-12-21 Eric Carlson <eric.carl...@apple.com>
+
+ Fix text track cue font size and colors
+ https://bugs.webkit.org/show_bug.cgi?id=75051
+
+ Reviewed by Darin Adler.
+
+ * media/track/track-cue-rendering-expected.txt:
+ * media/track/track-cue-rendering.html:
+
2011-12-21 Filip Pizlo <fpi...@apple.com>
Unreviewed, updating expectations file for fast/js/global-constructors.
Modified: trunk/LayoutTests/media/track/track-cue-rendering-expected.txt (103485 => 103486)
--- trunk/LayoutTests/media/track/track-cue-rendering-expected.txt 2011-12-22 02:36:11 UTC (rev 103485)
+++ trunk/LayoutTests/media/track/track-cue-rendering-expected.txt 2011-12-22 02:45:23 UTC (rev 103486)
@@ -27,21 +27,25 @@
EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'sit') OK
EXPECTED (textTrackDisplayElement(video).innerText == 'sit') OK
-Test that the cue display font size is resized as the video element resizes.
+Test the cue display colors and font.
RUN(video.width = 320)
RUN(video.height = 240)
-EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '16px') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '12px') OK
RUN(video.width = 640)
RUN(video.height = 480)
-EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '19px') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '24px') OK
RUN(video.width = 1280)
RUN(video.height = 960)
-EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '38px') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '48px') OK
RUN(video.width = 2560)
RUN(video.height = 1440)
-EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '58px') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '72px') OK
+
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontFamily == 'sans-serif') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).color == 'rgba(255, 255, 255, 0)') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video)).backgroundColor == 'rgba(0, 0, 0, 0.796875)') OK
END OF TEST
Modified: trunk/LayoutTests/media/track/track-cue-rendering.html (103485 => 103486)
--- trunk/LayoutTests/media/track/track-cue-rendering.html 2011-12-22 02:36:11 UTC (rev 103485)
+++ trunk/LayoutTests/media/track/track-cue-rendering.html 2011-12-22 02:45:23 UTC (rev 103486)
@@ -13,31 +13,26 @@
var seekedCount = 0;
var info = [ "Lorem", "ipsum", "dolor", "sit" ];
- function testFontSizes()
+ function testFontSize(width, height)
{
- consoleWrite("<br>Test that the cue display font size is resized as the video element resizes.");
- run("video.width = 320");
- run("video.height = 240");
+ run("video.width = " + width);
+ run("video.height = " + height);
document.body.offsetTop;
- testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", "16px");
-
+ testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", parseInt(height * 0.05) + "px");
consoleWrite("");
- run("video.width = 640");
- run("video.height = 480");
- document.body.offsetTop;
- testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", "19px");
+ }
- consoleWrite("");
- run("video.width = 1280");
- run("video.height = 960");
- document.body.offsetTop;
- testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", "38px");
+ function testCueStyle()
+ {
+ consoleWrite("<br>Test the cue display colors and font.");
+ testFontSize(320, 240);
+ testFontSize(640, 480);
+ testFontSize(1280, 960);
+ testFontSize(2560, 1440);
- consoleWrite("");
- run("video.width = 2560");
- run("video.height = 1440");
- document.body.offsetTop;
- testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", "58px");
+ testExpected("getComputedStyle(textTrackDisplayElement(video)).fontFamily", "sans-serif");
+ testExpected("getComputedStyle(textTrackDisplayElement(video)).color", "rgba(255, 255, 255, 0)");
+ testExpected("getComputedStyle(textTrackDisplayElement(video)).backgroundColor", "rgba(0, 0, 0, 0.796875)");
endTest();
}
@@ -50,7 +45,7 @@
testExpected("textTrackDisplayElement(video).innerText", info[seekedCount]);
if (++seekedCount == info.length)
- testFontSizes();
+ testCueStyle();
else {
consoleWrite("");
run("video.currentTime = " + (video.currentTime + 1));
Modified: trunk/Source/WebCore/ChangeLog (103485 => 103486)
--- trunk/Source/WebCore/ChangeLog 2011-12-22 02:36:11 UTC (rev 103485)
+++ trunk/Source/WebCore/ChangeLog 2011-12-22 02:45:23 UTC (rev 103486)
@@ -1,3 +1,20 @@
+2011-12-21 Eric Carlson <eric.carl...@apple.com>
+
+ Fix text track cue font size and colors
+ https://bugs.webkit.org/show_bug.cgi?id=75051
+
+ Reviewed by Darin Adler.
+
+ No new tests, updated media/track/track-cue-rendering.html for the changes.
+
+ * css/mediaControls.css:
+ (video::-webkit-media-text-track-container): Match WebVTT spec.
+ (video::-webkit-media-text-track-display): Ditto.
+
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore::MediaControlTextTrackContainerElement::updateSizes): Change font size from 4% of the
+ video height to 5% as per the spec. Don't enforce a minimum size.
+
2011-12-21 Andreas Kling <kl...@webkit.org>
Unreviewed, rolling out r103473.
Modified: trunk/Source/WebCore/css/mediaControls.css (103485 => 103486)
--- trunk/Source/WebCore/css/mediaControls.css 2011-12-22 02:36:11 UTC (rev 103485)
+++ trunk/Source/WebCore/css/mediaControls.css 2011-12-22 02:45:23 UTC (rev 103486)
@@ -195,6 +195,7 @@
font-size: 22px;
font-family: sans-serif;
text-align: center;
+ color: rgba(255, 255, 255, 0);
letter-spacing: normal;
word-spacing: normal;
@@ -207,7 +208,7 @@
video::-webkit-media-text-track-display {
display: inline;
- background-color: rgba(0, 0, 0, 0.5);
+ background-color: rgba(0, 0, 0, 0.8);
color: yellow;
padding: 0px 2px;
}
Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (103485 => 103486)
--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2011-12-22 02:36:11 UTC (rev 103485)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2011-12-22 02:45:23 UTC (rev 103486)
@@ -1171,8 +1171,8 @@
}
static const float mimimumFontSize = 16;
-static const float videoHeightFontSizeDivisor = 25;
-static const float trackBottomMultiplier = 0.9;
+static const float videoHeightFontSizePercentage = .05;
+static const float trackBottomMultiplier = .9;
void MediaControlTextTrackContainerElement::updateSizes()
{
@@ -1185,9 +1185,7 @@
return;
m_videoDisplaySize = videoBox;
- float fontSize = m_videoDisplaySize.size().height() / videoHeightFontSizeDivisor;
- if (fontSize < mimimumFontSize)
- fontSize = mimimumFontSize;
+ float fontSize = m_videoDisplaySize.size().height() * videoHeightFontSizePercentage;
if (fontSize != m_fontSize) {
m_fontSize = fontSize;
ensureInlineStyleDecl()->setProperty(CSSPropertyFontSize, String::number(fontSize) + "px");