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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.h

Issue 2479373005: Use template parameter to reduce branching in style resolve apply passes (Closed)
Patch Set: Enum Created 4 years, 1 month 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 | « no previous file | third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/resolver/StyleResolver.h
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.h b/third_party/WebKit/Source/core/css/resolver/StyleResolver.h
index fcac3552c42007d7a2728c116fa227368f7e0cd9..9416e8b425d69fbff01834fb05d5a4a34066d84e 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.h
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.h
@@ -219,16 +219,10 @@ class CORE_EXPORT StyleResolver final
// and isImportant is required.
class NeedsApplyPass {
public:
- bool needsUpdate() const { return m_needsUpdate; }
- bool setNeedsUpdate(bool needsUpdate) {
- return m_needsUpdate = needsUpdate;
- }
bool get(CSSPropertyPriority priority, bool isImportant) const {
- DCHECK(!needsUpdate());
return m_flags[getIndex(priority, isImportant)];
}
void set(CSSPropertyPriority priority, bool isImportant) {
- DCHECK(needsUpdate());
m_flags[getIndex(priority, isImportant)] = true;
}
@@ -237,17 +231,21 @@ class CORE_EXPORT StyleResolver final
DCHECK(priority >= 0 && priority < PropertyPriorityCount);
return priority * 2 + isImportant;
}
- bool m_needsUpdate = true;
bool m_flags[PropertyPriorityCount * 2] = {0};
};
- template <CSSPropertyPriority priority>
+ enum ShouldUpdateNeedsApplyPass {
+ CheckNeedsApplyPass = false,
+ UpdateNeedsApplyPass = true,
+ };
+
+ template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
void applyMatchedProperties(StyleResolverState&,
const MatchedPropertiesRange&,
bool important,
bool inheritedOnly,
NeedsApplyPass&);
- template <CSSPropertyPriority priority>
+ template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
void applyProperties(StyleResolverState&,
const StylePropertySet* properties,
bool isImportant,
@@ -262,7 +260,7 @@ class CORE_EXPORT StyleResolver final
const CSSValue&,
bool inheritedOnly,
PropertyWhitelistType);
- template <CSSPropertyPriority priority>
+ template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
void applyPropertiesForApplyAtRule(StyleResolverState&,
const CSSValue&,
bool isImportant,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698