Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (172759 => 172760)
--- branches/safari-600.1-branch/Source/WebCore/ChangeLog 2014-08-19 21:25:22 UTC (rev 172759)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog 2014-08-19 21:28:41 UTC (rev 172760)
@@ -1,3 +1,24 @@
+2014-08-19 Dana Burkart <dburk...@apple.com>
+
+ Merge r172481
+
+ 2014-08-11 Roger Fong <roger_f...@apple.com>
+
+ Adjust max-width of cues based on text alignment when cue size is expanded.
+ https://bugs.webkit.org/show_bug.cgi?id=135823.
+
+ Reviewed by Brent Fulgham.
+
+ All units are in percentages.
+ If we are left aligned the max cue width is the 100 minus the cue position.
+ If we are right aligned the max cue width is the cue position.
+ If we are centered the max cue width is just 100.
+
+ * html/track/TextTrackCueGeneric.cpp:
+ (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
+ * html/track/VTTCue.cpp:
+ (WebCore::VTTCueBox::applyCSSProperties):
+
2014-08-14 Lucas Forschler <lforsch...@apple.com>
Merge r172609
Modified: branches/safari-600.1-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp (172759 => 172760)
--- branches/safari-600.1-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2014-08-19 21:25:22 UTC (rev 172759)
+++ branches/safari-600.1-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2014-08-19 21:28:41 UTC (rev 172760)
@@ -102,13 +102,20 @@
}
}
- std::pair<float, float> position = m_cue.getCSSPosition();
+ double textPosition = m_cue.position();
+ double maxSize = 100.0;
+
+ if (alignment == CSSValueEnd || alignment == CSSValueRight)
+ maxSize = textPosition;
+ else if (alignment == CSSValueStart || alignment == CSSValueLeft)
+ maxSize = 100.0 - textPosition;
+
if (cue->getWritingDirection() == VTTCue::Horizontal) {
setInlineStyleProperty(CSSPropertyMinWidth, "-webkit-min-content");
- setInlineStyleProperty(CSSPropertyMaxWidth, 100.0 - position.first, CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyMaxWidth, maxSize, CSSPrimitiveValue::CSS_PERCENTAGE);
} else {
setInlineStyleProperty(CSSPropertyMinHeight, "-webkit-min-content");
- setInlineStyleProperty(CSSPropertyMaxHeight, 100.0 - position.second, CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyMaxHeight, maxSize, CSSPrimitiveValue::CSS_PERCENTAGE);
}
if (cue->foregroundColor().isValid())
Modified: branches/safari-600.1-branch/Source/WebCore/html/track/VTTCue.cpp (172759 => 172760)
--- branches/safari-600.1-branch/Source/WebCore/html/track/VTTCue.cpp 2014-08-19 21:25:22 UTC (rev 172759)
+++ branches/safari-600.1-branch/Source/WebCore/html/track/VTTCue.cpp 2014-08-19 21:28:41 UTC (rev 172760)
@@ -178,21 +178,28 @@
if (authorFontSize)
multiplier = m_fontSizeFromCaptionUserPrefs / authorFontSize;
+ double textPosition = m_cue.position();
+ double maxSize = 100.0;
+ CSSValueID alignment = m_cue.getCSSAlignment();
+ if (alignment == CSSValueEnd || alignment == CSSValueRight)
+ maxSize = textPosition;
+ else if (alignment == CSSValueStart || alignment == CSSValueLeft)
+ maxSize = 100.0 - textPosition;
+
double newCueSize = std::min(m_cue.getCSSSize() * multiplier, 100.0);
- CSSValueID alignment = m_cue.getCSSAlignment();
// the 'width' property must be set to width, and the 'height' property must be set to height
if (m_cue.vertical() == horizontalKeyword()) {
setInlineStyleProperty(CSSPropertyWidth, newCueSize, CSSPrimitiveValue::CSS_PERCENTAGE);
setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
setInlineStyleProperty(CSSPropertyMinWidth, "-webkit-min-content");
- setInlineStyleProperty(CSSPropertyMaxWidth, 100.0 - position.first, CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyMaxWidth, maxSize, CSSPrimitiveValue::CSS_PERCENTAGE);
if ((alignment == CSSValueMiddle || alignment == CSSValueCenter) && multiplier != 1.0)
setInlineStyleProperty(CSSPropertyLeft, static_cast<double>(position.first - (newCueSize - m_cue.getCSSSize()) / 2), CSSPrimitiveValue::CSS_PERCENTAGE);
} else {
setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto);
setInlineStyleProperty(CSSPropertyHeight, newCueSize, CSSPrimitiveValue::CSS_PERCENTAGE);
setInlineStyleProperty(CSSPropertyMinHeight, "-webkit-min-content");
- setInlineStyleProperty(CSSPropertyMaxHeight, 100.0 - position.second, CSSPrimitiveValue::CSS_PERCENTAGE);
+ setInlineStyleProperty(CSSPropertyMaxHeight, maxSize, CSSPrimitiveValue::CSS_PERCENTAGE);
if ((alignment == CSSValueMiddle || alignment == CSSValueCenter) && multiplier != 1.0)
setInlineStyleProperty(CSSPropertyTop, static_cast<double>(position.second - (newCueSize - m_cue.getCSSSize()) / 2), CSSPrimitiveValue::CSS_PERCENTAGE);
}