Diff
Modified: trunk/LayoutTests/ChangeLog (172350 => 172351)
--- trunk/LayoutTests/ChangeLog 2014-08-08 19:33:46 UTC (rev 172350)
+++ trunk/LayoutTests/ChangeLog 2014-08-08 19:53:52 UTC (rev 172351)
@@ -1,3 +1,14 @@
+2014-08-07 Roger Fong <[email protected]>
+
+ Adjustments to CueBox CSS Width calculations.
+ https://bugs.webkit.org/show_bug.cgi?id=135759
+ <rdar://problem/17954473>.
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ Unskip tests media/track/track-cue-rendering-horizontal.html and media/track/track-cue-rendering-rtl.html.
+
2014-08-07 Commit Queue <[email protected]>
Unreviewed, rolling out r172291.
Modified: trunk/LayoutTests/TestExpectations (172350 => 172351)
--- trunk/LayoutTests/TestExpectations 2014-08-08 19:33:46 UTC (rev 172350)
+++ trunk/LayoutTests/TestExpectations 2014-08-08 19:53:52 UTC (rev 172351)
@@ -142,6 +142,3 @@
webkit.org/b/135390 fast/css/fontloader-multiple-families.html [ Skip ]
webkit.org/b/135390 http/tests/webfont/fontloader-loading-attribute.html [ Skip ]
-# Tests failed after http://trac.webkit.org/r172224 landed:
-webkit.org/b/135720 media/track/track-cue-rendering-horizontal.html [ Failure ]
-webkit.org/b/135720 media/track/track-cue-rendering-rtl.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (172350 => 172351)
--- trunk/Source/WebCore/ChangeLog 2014-08-08 19:33:46 UTC (rev 172350)
+++ trunk/Source/WebCore/ChangeLog 2014-08-08 19:53:52 UTC (rev 172351)
@@ -1,3 +1,28 @@
+2014-08-08 Roger Fong <[email protected]>
+
+ Adjustments to CueBox CSS Width calculations.
+ https://bugs.webkit.org/show_bug.cgi?id=135759
+ <rdar://problem/17954473>.
+
+ Reviewed by Eric Carlson.
+
+ This is a followup patch that addresses some of the test failures caused by r172224.
+ These tests were skipped in r172253.
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize):
+ Tell the cue boxes that they need to be updated when the font size specified in the user prefs changes.
+
+ Cap width to 100%, calculate max-width in percentages instead of pixels.
+ * html/track/TextTrackCueGeneric.cpp:
+ (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
+ * html/track/VTTCue.cpp:
+ (WebCore::VTTCueBox::applyCSSProperties):
+
+ (WebCore::VTTCue::setFontSize):
+ Remove some unnecessary code that doesn't actually work.
+ Make sure to tell cuebox that it needs to be updated.
+ * html/track/VTTCue.h: Change float constant to double.
+
2014-08-08 Simon Fraser <[email protected]>
Clean up image subsampling code, make it less iOS-specific
Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (172350 => 172351)
--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2014-08-08 19:33:46 UTC (rev 172350)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2014-08-08 19:53:52 UTC (rev 172351)
@@ -78,26 +78,24 @@
setInlineStyleProperty(CSSPropertyLeft, static_cast<float>(cue->position()), CSSPrimitiveValue::CSS_PERCENTAGE);
setInlineStyleProperty(CSSPropertyTop, static_cast<float>(cue->line()), CSSPrimitiveValue::CSS_PERCENTAGE);
- float authorFontSize = std::max(DEFAULTCAPTIONFONTSIZE, static_cast<float>(videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100));
+ double authorFontSize = std::max(DEFAULTCAPTIONFONTSIZE, videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100.0);
if (cue->fontSizeMultiplier())
authorFontSize *= cue->fontSizeMultiplier() / 100;
- float multiplier = std::max(1.0f, m_fontSizeFromCaptionUserPrefs / authorFontSize);
+ double multiplier = std::max(1.0, m_fontSizeFromCaptionUserPrefs / authorFontSize);
if (cue->getWritingDirection() == VTTCue::Horizontal)
- setInlineStyleProperty(CSSPropertyWidth, size * multiplier, CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyWidth, std::min(size * multiplier, 100.0), CSSPrimitiveValue::CSS_PERCENTAGE);
else
- setInlineStyleProperty(CSSPropertyHeight, size * multiplier, CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyHeight, std::min(size * multiplier, 100.0), CSSPrimitiveValue::CSS_PERCENTAGE);
}
std::pair<float, float> position = m_cue.getCSSPosition();
if (cue->getWritingDirection() == VTTCue::Horizontal) {
setInlineStyleProperty(CSSPropertyMinWidth, "-webkit-min-content");
- double maxWidth = videoSize.width() * (100.0 - position.first) / 100.0;
- setInlineStyleProperty(CSSPropertyMaxWidth, maxWidth, CSSPrimitiveValue::CSS_PX);
+ setInlineStyleProperty(CSSPropertyMaxWidth, 100.0 - position.first, CSSPrimitiveValue::CSS_PERCENTAGE);
} else {
setInlineStyleProperty(CSSPropertyMinHeight, "-webkit-min-content");
- double maxHeight = videoSize.height() * (100.0 - position.second) / 100.0;
- setInlineStyleProperty(CSSPropertyMaxHeight, maxHeight, CSSPrimitiveValue::CSS_PX);
+ setInlineStyleProperty(CSSPropertyMaxHeight, 100.0 - position.second, CSSPrimitiveValue::CSS_PERCENTAGE);
}
if (cue->foregroundColor().isValid())
Modified: trunk/Source/WebCore/html/track/VTTCue.cpp (172350 => 172351)
--- trunk/Source/WebCore/html/track/VTTCue.cpp 2014-08-08 19:33:46 UTC (rev 172350)
+++ trunk/Source/WebCore/html/track/VTTCue.cpp 2014-08-08 19:53:52 UTC (rev 172351)
@@ -138,7 +138,7 @@
return &m_cue;
}
-void VTTCueBox::applyCSSProperties(const IntSize& videoSize)
+void VTTCueBox::applyCSSProperties(const IntSize&)
{
// FIXME: Apply all the initial CSS positioning properties. http://wkb.ug/79916
#if ENABLE(WEBVTT_REGIONS)
@@ -170,20 +170,18 @@
// the 'left' property must be set to left
setInlineStyleProperty(CSSPropertyLeft, static_cast<double>(position.first), CSSPrimitiveValue::CSS_PERCENTAGE);
- float multiplier = std::max(1.0f, m_fontSizeFromCaptionUserPrefs / DEFAULTCAPTIONFONTSIZE);
+ double multiplier = std::max(1.0, m_fontSizeFromCaptionUserPrefs / DEFAULTCAPTIONFONTSIZE);
// the 'width' property must be set to width, and the 'height' property must be set to height
if (m_cue.vertical() == horizontalKeyword()) {
- setInlineStyleProperty(CSSPropertyWidth, static_cast<double>(m_cue.getCSSSize() * multiplier), CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyWidth, std::min(m_cue.getCSSSize() * multiplier, 100.0), CSSPrimitiveValue::CSS_PERCENTAGE);
setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
setInlineStyleProperty(CSSPropertyMinWidth, "-webkit-min-content");
- double maxWidth = videoSize.width() * (100.0 - position.first) / 100.0;
- setInlineStyleProperty(CSSPropertyMaxWidth, maxWidth, CSSPrimitiveValue::CSS_PX);
+ setInlineStyleProperty(CSSPropertyMaxWidth, 100.0 - position.first, CSSPrimitiveValue::CSS_PERCENTAGE);
} else {
setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto);
- setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue.getCSSSize() * multiplier), CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyHeight, std::min(m_cue.getCSSSize() * multiplier, 100.0), CSSPrimitiveValue::CSS_PERCENTAGE);
setInlineStyleProperty(CSSPropertyMinHeight, "-webkit-min-content");
- double maxHeight = videoSize.height() * (100.0 - position.second) / 100.0;
- setInlineStyleProperty(CSSPropertyMaxHeight, maxHeight, CSSPrimitiveValue::CSS_PX);
+ setInlineStyleProperty(CSSPropertyMaxHeight, 100.0 - position.second, CSSPrimitiveValue::CSS_PERCENTAGE);
}
// The 'text-align' property on the (root) List of WebVTT Node Objects must
@@ -1142,9 +1140,7 @@
LOG(Media, "TextTrackCue::setFontSize - setting cue font size to %i", fontSize);
- if (important)
- displayTreeInternal()->setFontSizeFromCaptionUserPrefs(0);
-
+ m_displayTreeShouldChange = true;
displayTreeInternal()->setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue::CSS_PX, important);
}
Modified: trunk/Source/WebCore/html/track/VTTCue.h (172350 => 172351)
--- trunk/Source/WebCore/html/track/VTTCue.h 2014-08-08 19:33:46 UTC (rev 172350)
+++ trunk/Source/WebCore/html/track/VTTCue.h 2014-08-08 19:53:52 UTC (rev 172351)
@@ -50,7 +50,7 @@
class WebVTTCueData;
// This default value must be the same as the one specified in mediaControlsApple.css for -webkit-media-controls-closed-captions-container
-const static float DEFAULTCAPTIONFONTSIZE = 10;
+const static double DEFAULTCAPTIONFONTSIZE = 10;
// ----------------------------