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

Side by Side 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 nits 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "core/css/resolver/ViewportStyleResolver.h" 70 #include "core/css/resolver/ViewportStyleResolver.h"
71 #include "core/dom/CSSSelectorWatch.h" 71 #include "core/dom/CSSSelectorWatch.h"
72 #include "core/dom/FirstLetterPseudoElement.h" 72 #include "core/dom/FirstLetterPseudoElement.h"
73 #include "core/dom/NodeLayoutStyle.h" 73 #include "core/dom/NodeLayoutStyle.h"
74 #include "core/dom/StyleEngine.h" 74 #include "core/dom/StyleEngine.h"
75 #include "core/dom/Text.h" 75 #include "core/dom/Text.h"
76 #include "core/dom/shadow/ElementShadow.h" 76 #include "core/dom/shadow/ElementShadow.h"
77 #include "core/dom/shadow/ShadowRoot.h" 77 #include "core/dom/shadow/ShadowRoot.h"
78 #include "core/frame/FrameView.h" 78 #include "core/frame/FrameView.h"
79 #include "core/frame/LocalFrame.h" 79 #include "core/frame/LocalFrame.h"
80 #include "core/frame/Settings.h"
80 #include "core/html/HTMLIFrameElement.h" 81 #include "core/html/HTMLIFrameElement.h"
81 #include "core/inspector/InspectorInstrumentation.h" 82 #include "core/inspector/InspectorInstrumentation.h"
82 #include "core/layout/LayoutView.h" 83 #include "core/layout/LayoutView.h"
83 #include "core/layout/style/KeyframeList.h" 84 #include "core/layout/style/KeyframeList.h"
84 #include "core/svg/SVGDocumentExtensions.h" 85 #include "core/svg/SVGDocumentExtensions.h"
85 #include "core/svg/SVGElement.h" 86 #include "core/svg/SVGElement.h"
86 #include "platform/RuntimeEnabledFeatures.h" 87 #include "platform/RuntimeEnabledFeatures.h"
87 #include "wtf/StdLibExtras.h" 88 #include "wtf/StdLibExtras.h"
88 89
89 namespace { 90 namespace {
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 // Properties that we currently support outside of spec. 1182 // Properties that we currently support outside of spec.
1182 case CSSPropertyWebkitLineBoxContain: 1183 case CSSPropertyWebkitLineBoxContain:
1183 case CSSPropertyVisibility: 1184 case CSSPropertyVisibility:
1184 return true; 1185 return true;
1185 1186
1186 default: 1187 default:
1187 return false; 1188 return false;
1188 } 1189 }
1189 } 1190 }
1190 1191
1192 static bool shouldIgnoreTextTrackAuthorStyle(Document& document)
1193 {
1194 Settings* settings = document.settings();
1195 if (!settings)
1196 return false;
1197 // Ignore author specified settings for text tracks when any of the user set tings are present.
1198 if (!settings->textTrackBackgroundColor().isEmpty()
1199 || !settings->textTrackFontFamily().isEmpty()
1200 || !settings->textTrackFontStyle().isEmpty()
1201 || !settings->textTrackFontVariant().isEmpty()
1202 || !settings->textTrackTextColor().isEmpty()
1203 || !settings->textTrackTextShadow().isEmpty()
1204 || !settings->textTrackTextSize().isEmpty())
1205 return true;
1206 return false;
1207 }
1208
1191 // This method expands the 'all' shorthand property to longhand properties 1209 // This method expands the 'all' shorthand property to longhand properties
1192 // and applies the expanded longhand properties. 1210 // and applies the expanded longhand properties.
1193 template <CSSPropertyPriority priority> 1211 template <CSSPropertyPriority priority>
1194 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal ue, bool inheritedOnly) 1212 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal ue, bool inheritedOnly)
1195 { 1213 {
1196 bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedVal ue(); 1214 bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedVal ue();
1197 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); 1215 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first();
1198 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); 1216 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last();
1199 1217
1200 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { 1218 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 StylePropertySet::PropertyReference current = properties->propertyAt(i); 1257 StylePropertySet::PropertyReference current = properties->propertyAt(i);
1240 if (isImportant != current.isImportant()) 1258 if (isImportant != current.isImportant())
1241 continue; 1259 continue;
1242 1260
1243 CSSPropertyID property = current.id(); 1261 CSSPropertyID property = current.id();
1244 if (property == CSSPropertyAll) { 1262 if (property == CSSPropertyAll) {
1245 applyAllProperty<priority>(state, current.value(), inheritedOnly); 1263 applyAllProperty<priority>(state, current.value(), inheritedOnly);
1246 continue; 1264 continue;
1247 } 1265 }
1248 1266
1249 if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStylePro perty(property)) 1267 if (propertyWhitelistType == PropertyWhitelistCue && (!isValidCueStylePr operty(property) || shouldIgnoreTextTrackAuthorStyle(document())))
1250 continue; 1268 continue;
1269
1251 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir stLetterStyleProperty(property)) 1270 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir stLetterStyleProperty(property))
1252 continue; 1271 continue;
1253 1272
1254 if (inheritedOnly && !current.isInherited()) { 1273 if (inheritedOnly && !current.isInherited()) {
1255 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1274 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1256 // as they might override the value inherited here. For this reason we don't allow declarations with 1275 // as they might override the value inherited here. For this reason we don't allow declarations with
1257 // explicitly inherited properties to be cached. 1276 // explicitly inherited properties to be cached.
1258 ASSERT(!current.value()->isInheritedValue()); 1277 ASSERT(!current.value()->isInheritedValue());
1259 continue; 1278 continue;
1260 } 1279 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 visitor->trace(m_watchedSelectorsRules); 1519 visitor->trace(m_watchedSelectorsRules);
1501 visitor->trace(m_treeBoundaryCrossingRules); 1520 visitor->trace(m_treeBoundaryCrossingRules);
1502 visitor->trace(m_styleResourceLoader); 1521 visitor->trace(m_styleResourceLoader);
1503 visitor->trace(m_styleSharingLists); 1522 visitor->trace(m_styleSharingLists);
1504 visitor->trace(m_pendingStyleSheets); 1523 visitor->trace(m_pendingStyleSheets);
1505 visitor->trace(m_document); 1524 visitor->trace(m_document);
1506 #endif 1525 #endif
1507 } 1526 }
1508 1527
1509 } // namespace blink 1528 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/media/track/track-css-user-settings-override-internal-settings-expected.txt ('k') | Source/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698