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

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

Issue 1304123006: Applying the "all" property needs to check all properties against the whitelist. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) {
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698