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

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

Issue 892643002: Split property priority functions out of StyleResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 ada9f62818f3ec4ab276f8f0e3d05647a38aa019..c0da3008c6e462c909818a77e3b6b52678c61004 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -1029,12 +1029,12 @@ const StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* elemen
return nullptr;
}
-template <StyleResolver::StyleApplicationPass pass>
+template <StyleApplicationPass pass>
void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolations)
{
for (const auto& interpolationEntry : activeInterpolations) {
CSSPropertyID property = interpolationEntry.key;
- if (!isPropertyForPass<pass>(property))
+ if (!StylePropertyRange::isPropertyForPass<pass>(property))
continue;
const StyleInterpolation* interpolation = toStyleInterpolation(interpolationEntry.value.get());
interpolation->apply(state);
@@ -1214,60 +1214,14 @@ static inline bool isValidFirstLetterStyleProperty(CSSPropertyID id)
}
}
-// FIXME: Consider refactoring to create a new class which owns the following
-// first/last/range properties.
-// This method returns the first CSSPropertyId of high priority properties.
-// Other properties can depend on high priority properties. For example,
-// border-color property with currentColor value depends on color property.
-// All high priority properties are obtained by using
-// firstCSSPropertyId<HighPriorityProperties> and
-// lastCSSPropertyId<HighPriorityProperties>.
-template<> CSSPropertyID StyleResolver::firstCSSPropertyId<StyleResolver::HighPriorityProperties>()
-{
- static_assert(CSSPropertyColor == firstCSSProperty, "CSSPropertyColor should be the first high priority property");
- return CSSPropertyColor;
-}
-
-// This method returns the last CSSPropertyId of high priority properties.
-template<> CSSPropertyID StyleResolver::lastCSSPropertyId<StyleResolver::HighPriorityProperties>()
-{
- static_assert(CSSPropertyZoom == CSSPropertyColor + 16, "CSSPropertyZoom should be the end of the high priority property range");
- static_assert(CSSPropertyTextRendering == CSSPropertyZoom - 1, "CSSPropertyTextRendering should be immediately before CSSPropertyZoom");
- return CSSPropertyZoom;
-}
-
-// This method returns the first CSSPropertyId of remaining properties,
-// i.e. low priority properties. No properties depend on low priority
-// properties. So we don't need to resolve such properties quickly.
-// All low priority properties are obtained by using
-// firstCSSPropertyId<LowPriorityProperties> and
-// lastCSSPropertyId<LowPriorityProperties>.
-template<> CSSPropertyID StyleResolver::firstCSSPropertyId<StyleResolver::LowPriorityProperties>()
-{
- static_assert(CSSPropertyAlignContent == CSSPropertyZoom + 1, "CSSPropertyAlignContent should be the first low priority property");
- return CSSPropertyAlignContent;
-}
-
-// This method returns the last CSSPropertyId of low priority properties.
-template<> CSSPropertyID StyleResolver::lastCSSPropertyId<StyleResolver::LowPriorityProperties>()
-{
- return static_cast<CSSPropertyID>(lastCSSProperty);
-}
-
-template <StyleResolver::StyleApplicationPass pass>
-bool StyleResolver::isPropertyForPass(CSSPropertyID property)
-{
- return firstCSSPropertyId<pass>() <= property && property <= lastCSSPropertyId<pass>();
-}
-
// This method expands the 'all' shorthand property to longhand properties
// and applies the expanded longhand properties.
-template <StyleResolver::StyleApplicationPass pass>
+template <StyleApplicationPass pass>
void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allValue, bool inheritedOnly)
{
bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedValue();
- unsigned startCSSProperty = firstCSSPropertyId<pass>();
- unsigned endCSSProperty = lastCSSPropertyId<pass>();
+ unsigned startCSSProperty = StylePropertyRange::firstCSSPropertyId<pass>();
+ unsigned endCSSProperty = StylePropertyRange::lastCSSPropertyId<pass>();
for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) {
CSSPropertyID propertyId = static_cast<CSSPropertyID>(i);
@@ -1303,7 +1257,7 @@ void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
}
}
-template <StyleResolver::StyleApplicationPass pass>
+template <StyleApplicationPass pass>
void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
{
unsigned propertyCount = properties->propertyCount();
@@ -1331,14 +1285,14 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
continue;
}
- if (!isPropertyForPass<pass>(property))
+ if (!StylePropertyRange::isPropertyForPass<pass>(property))
continue;
StyleBuilder::applyProperty(current.id(), state, current.value());
}
}
-template <StyleResolver::StyleApplicationPass pass>
+template <StyleApplicationPass pass>
void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult, bool isImportant, int startIndex, int endIndex, bool inheritedOnly)
{
if (startIndex == -1)
« Source/core/css/resolver/StylePropertyRange.h ('K') | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698