Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 921833003: Expose APIs for text track settings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed Philip's comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 81a1ea16741c9d82071413453291172395cc77cc..8a3825528ae5cc510078d68c858139c186f78fab 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -77,6 +77,7 @@
#include "core/dom/shadow/ShadowRoot.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/layout/LayoutView.h"
@@ -1015,8 +1016,10 @@ void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil
}
}
-static inline bool isValidCueStyleProperty(CSSPropertyID id)
+static inline bool isValidCueStyleProperty(CSSPropertyID id, bool textTrackIgnoreAuthorStyle)
{
+ if (textTrackIgnoreAuthorStyle)
+ return false;
switch (id) {
case CSSPropertyBackground:
case CSSPropertyBackgroundAttachment:
@@ -1246,8 +1249,9 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
continue;
}
- if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStyleProperty(property))
+ if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStyleProperty(property, shouldIgnoreTextTrackAuthorStyle()))
philipj_slow 2015/03/25 16:29:20 When structured like this there's no reason to pas
srivats 2015/03/26 01:36:02 Done.
continue;
+
if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFirstLetterStyleProperty(property))
continue;
@@ -1487,6 +1491,23 @@ bool StyleResolver::mediaQueryAffectedByViewportChange() const
return false;
}
+bool StyleResolver::shouldIgnoreTextTrackAuthorStyle()
+{
+ Settings* settings = document().settings();
+ if (!settings)
+ return false;
+ // Ignore author specified settings for text tracks when any of the user settings are present.
+ if (!settings->textTrackBackgroundColor().isEmpty()
+ || !settings->textTrackFontFamily().isEmpty()
+ || !settings->textTrackFontStyle().isEmpty()
+ || !settings->textTrackFontVariant().isEmpty()
+ || !settings->textTrackTextColor().isEmpty()
+ || !settings->textTrackTextShadow().isEmpty()
+ || !settings->textTrackTextSize().isEmpty())
+ return true;
+ return false;
+}
+
DEFINE_TRACE(StyleResolver)
{
#if ENABLE(OILPAN)

Powered by Google App Engine
This is Rietveld 408576698