Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 75a480c3d6d890defa7fb5bd4d0483c22440185c..690691f2367bfcd19c1868469668760274942cee 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -1210,7 +1210,7 @@ static inline bool isValidFirstLetterStyleProperty(CSSPropertyID id) |
} |
} |
-static bool shouldIgnoreTextTrackAuthorStyle(Document& document) |
+static bool shouldIgnoreTextTrackAuthorStyle(const Document& document) |
{ |
Settings* settings = document.settings(); |
if (!settings) |
@@ -1227,10 +1227,25 @@ static bool shouldIgnoreTextTrackAuthorStyle(Document& document) |
return false; |
} |
+static inline bool isPropertyInWhitelist(PropertyWhitelistType propertyWhitelistType, CSSPropertyID property, const Document& document) |
+{ |
+ if (propertyWhitelistType == PropertyWhitelistNone) |
+ return true; // Early bail for the by far most common case. |
+ |
+ if (propertyWhitelistType == PropertyWhitelistFirstLetter) |
+ return isValidFirstLetterStyleProperty(property); |
+ |
+ if (propertyWhitelistType == PropertyWhitelistCue) |
+ return isValidCueStyleProperty(property) && !shouldIgnoreTextTrackAuthorStyle(document); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return true; |
+} |
+ |
// This method expands the 'all' shorthand property to longhand properties |
// and applies the expanded longhand properties. |
template <CSSPropertyPriority priority> |
-void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allValue, bool inheritedOnly) |
+void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allValue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) |
{ |
unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); |
unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); |
@@ -1251,6 +1266,9 @@ void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal |
if (!CSSProperty::isAffectedByAllProperty(propertyId)) |
continue; |
+ if (!isPropertyInWhitelist(propertyWhitelistType, propertyId, document())) |
+ continue; |
+ |
// When hitting matched properties' cache, only inherited properties will be |
// applied. |
if (inheritedOnly && !CSSPropertyMetadata::isInheritedProperty(propertyId)) |
@@ -1271,14 +1289,11 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper |
CSSPropertyID property = current.id(); |
if (property == CSSPropertyAll) { |
- applyAllProperty<priority>(state, current.value(), inheritedOnly); |
+ applyAllProperty<priority>(state, current.value(), inheritedOnly, propertyWhitelistType); |
continue; |
} |
- if (propertyWhitelistType == PropertyWhitelistCue && (!isValidCueStyleProperty(property) || shouldIgnoreTextTrackAuthorStyle(document()))) |
- continue; |
- |
- if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFirstLetterStyleProperty(property)) |
+ if (!isPropertyInWhitelist(propertyWhitelistType, property, document())) |
continue; |
if (inheritedOnly && !current.isInherited()) { |