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

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 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 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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 { 1009 {
1009 for (const auto& interpolationEntry : activeInterpolations) { 1010 for (const auto& interpolationEntry : activeInterpolations) {
1010 CSSPropertyID property = interpolationEntry.key; 1011 CSSPropertyID property = interpolationEntry.key;
1011 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) 1012 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property))
1012 continue; 1013 continue;
1013 const StyleInterpolation* interpolation = toStyleInterpolation(interpola tionEntry.value.get()); 1014 const StyleInterpolation* interpolation = toStyleInterpolation(interpola tionEntry.value.get());
1014 interpolation->apply(state); 1015 interpolation->apply(state);
1015 } 1016 }
1016 } 1017 }
1017 1018
1018 static inline bool isValidCueStyleProperty(CSSPropertyID id) 1019 static inline bool isValidCueStyleProperty(CSSPropertyID id, bool textTrackIgnor eAuthorStyle)
1019 { 1020 {
1021 if (textTrackIgnoreAuthorStyle)
1022 return false;
1020 switch (id) { 1023 switch (id) {
1021 case CSSPropertyBackground: 1024 case CSSPropertyBackground:
1022 case CSSPropertyBackgroundAttachment: 1025 case CSSPropertyBackgroundAttachment:
1023 case CSSPropertyBackgroundClip: 1026 case CSSPropertyBackgroundClip:
1024 case CSSPropertyBackgroundColor: 1027 case CSSPropertyBackgroundColor:
1025 case CSSPropertyBackgroundImage: 1028 case CSSPropertyBackgroundImage:
1026 case CSSPropertyBackgroundOrigin: 1029 case CSSPropertyBackgroundOrigin:
1027 case CSSPropertyBackgroundPosition: 1030 case CSSPropertyBackgroundPosition:
1028 case CSSPropertyBackgroundPositionX: 1031 case CSSPropertyBackgroundPositionX:
1029 case CSSPropertyBackgroundPositionY: 1032 case CSSPropertyBackgroundPositionY:
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 StylePropertySet::PropertyReference current = properties->propertyAt(i); 1242 StylePropertySet::PropertyReference current = properties->propertyAt(i);
1240 if (isImportant != current.isImportant()) 1243 if (isImportant != current.isImportant())
1241 continue; 1244 continue;
1242 1245
1243 CSSPropertyID property = current.id(); 1246 CSSPropertyID property = current.id();
1244 if (property == CSSPropertyAll) { 1247 if (property == CSSPropertyAll) {
1245 applyAllProperty<priority>(state, current.value(), inheritedOnly); 1248 applyAllProperty<priority>(state, current.value(), inheritedOnly);
1246 continue; 1249 continue;
1247 } 1250 }
1248 1251
1249 if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStylePro perty(property)) 1252 if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStylePro perty(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.
1250 continue; 1253 continue;
1254
1251 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir stLetterStyleProperty(property)) 1255 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir stLetterStyleProperty(property))
1252 continue; 1256 continue;
1253 1257
1254 if (inheritedOnly && !current.isInherited()) { 1258 if (inheritedOnly && !current.isInherited()) {
1255 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1259 // 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 1260 // as they might override the value inherited here. For this reason we don't allow declarations with
1257 // explicitly inherited properties to be cached. 1261 // explicitly inherited properties to be cached.
1258 ASSERT(!current.value()->isInheritedValue()); 1262 ASSERT(!current.value()->isInheritedValue());
1259 continue; 1263 continue;
1260 } 1264 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 1484
1481 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1485 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1482 { 1486 {
1483 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1487 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1484 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression() ) != m_viewportDependentMediaQueryResults[i]->result()) 1488 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression() ) != m_viewportDependentMediaQueryResults[i]->result())
1485 return true; 1489 return true;
1486 } 1490 }
1487 return false; 1491 return false;
1488 } 1492 }
1489 1493
1494 bool StyleResolver::shouldIgnoreTextTrackAuthorStyle()
1495 {
1496 Settings* settings = document().settings();
1497 if (!settings)
1498 return false;
1499 // Ignore author specified settings for text tracks when any of the user set tings are present.
1500 if (!settings->textTrackBackgroundColor().isEmpty()
1501 || !settings->textTrackFontFamily().isEmpty()
1502 || !settings->textTrackFontStyle().isEmpty()
1503 || !settings->textTrackFontVariant().isEmpty()
1504 || !settings->textTrackTextColor().isEmpty()
1505 || !settings->textTrackTextShadow().isEmpty()
1506 || !settings->textTrackTextSize().isEmpty())
1507 return true;
1508 return false;
1509 }
1510
1490 DEFINE_TRACE(StyleResolver) 1511 DEFINE_TRACE(StyleResolver)
1491 { 1512 {
1492 #if ENABLE(OILPAN) 1513 #if ENABLE(OILPAN)
1493 visitor->trace(m_matchedPropertiesCache); 1514 visitor->trace(m_matchedPropertiesCache);
1494 visitor->trace(m_viewportDependentMediaQueryResults); 1515 visitor->trace(m_viewportDependentMediaQueryResults);
1495 visitor->trace(m_selectorFilter); 1516 visitor->trace(m_selectorFilter);
1496 visitor->trace(m_viewportStyleResolver); 1517 visitor->trace(m_viewportStyleResolver);
1497 visitor->trace(m_features); 1518 visitor->trace(m_features);
1498 visitor->trace(m_siblingRuleSet); 1519 visitor->trace(m_siblingRuleSet);
1499 visitor->trace(m_uncommonAttributeRuleSet); 1520 visitor->trace(m_uncommonAttributeRuleSet);
1500 visitor->trace(m_watchedSelectorsRules); 1521 visitor->trace(m_watchedSelectorsRules);
1501 visitor->trace(m_treeBoundaryCrossingRules); 1522 visitor->trace(m_treeBoundaryCrossingRules);
1502 visitor->trace(m_styleResourceLoader); 1523 visitor->trace(m_styleResourceLoader);
1503 visitor->trace(m_styleSharingLists); 1524 visitor->trace(m_styleSharingLists);
1504 visitor->trace(m_pendingStyleSheets); 1525 visitor->trace(m_pendingStyleSheets);
1505 visitor->trace(m_document); 1526 visitor->trace(m_document);
1506 #endif 1527 #endif
1507 } 1528 }
1508 1529
1509 } // namespace blink 1530 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698