Index: Source/core/html/track/vtt/VTTCue.cpp |
diff --git a/Source/core/html/track/vtt/VTTCue.cpp b/Source/core/html/track/vtt/VTTCue.cpp |
index 462c88d5c6d7bc472900d3049fb06252a5ec9cf3..49612a5f29dff41588760c93cfcc40f813d966a3 100644 |
--- a/Source/core/html/track/vtt/VTTCue.cpp |
+++ b/Source/core/html/track/vtt/VTTCue.cpp |
@@ -38,6 +38,7 @@ |
#include "core/dom/DocumentFragment.h" |
#include "core/dom/NodeTraversal.h" |
#include "core/events/Event.h" |
+#include "core/frame/Settings.h" |
#include "core/frame/UseCounter.h" |
#include "core/html/HTMLDivElement.h" |
#include "core/html/track/TextTrack.h" |
@@ -136,6 +137,14 @@ static bool isInvalidPercentage(double value, ExceptionState& exceptionState) |
return false; |
} |
+// Sets inline CSS properties on passed in element if value is not an empty string |
+static void setInlineStylePropertyIfNotEmpty(PassRefPtrWillBeRawPtr<HTMLDivElement> element, |
philipj_slow
2015/03/17 02:22:31
Just Element& as the argument type is OK.
srivats
2015/03/18 01:58:13
Done.
|
+ CSSPropertyID propertyID, const String& value) |
+{ |
+ if (!value.isEmpty()) |
+ element->setInlineStyleProperty(propertyID, value, true); |
+} |
+ |
VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) |
: HTMLDivElement(document) |
, m_cue(cue) |
@@ -836,6 +845,9 @@ PassRefPtrWillBeRawPtr<VTTCueBox> VTTCue::getDisplayTree() |
// normally would in CSS, it is instead forcibly wrapped at the box's edge.) |
displayTree->applyCSSProperties(displayParameters); |
+ // Apply user override settings for text tracks |
+ applyUserOverrideCSSProperties(); |
+ |
m_displayTreeShouldChange = false; |
// 10.15. Let cue's text track cue display state have the CSS boxes in |
@@ -1128,4 +1140,27 @@ DEFINE_TRACE(VTTCue) |
TextTrackCue::trace(visitor); |
} |
+void VTTCue::applyUserOverrideCSSProperties() |
+{ |
+ Settings* settings = m_cueBackgroundBox->document().settings(); |
philipj_slow
2015/03/17 02:22:31
You can use just document(), see VTTCue::document(
srivats
2015/03/18 01:58:13
Done.
|
+ if (settings) { |
philipj_slow
2015/03/17 02:22:31
if (!settings) return;
srivats
2015/03/18 01:58:13
Done.
|
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyBackgroundColor, settings->textTrackBackgroundColor()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyBackgroundColor, settings->textTrackBackgroundColor()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyFontFamily, settings->textTrackFontFamily()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyFontStyle, settings->textTrackFontStyle()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyFontVariant, settings->textTrackFontVariant()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyColor, settings->textTrackTextColor()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyTextShadow, settings->textTrackTextShadow()); |
+ setInlineStylePropertyIfNotEmpty(m_cueBackgroundBox, |
+ CSSPropertyFontSize, settings->textTrackTextSize()); |
+ } |
+} |
+ |
} // namespace blink |