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

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

Issue 15871005: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding a mitigation for the perf regression to Element::recalcStyle. Created 7 years, 6 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/SiblingTraversalStrategies.h ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolver.h
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index d3eb47cccee2f8eaf29eca3710b0b34e12c29f21..4baf00a0a6fe20370e000c8830716f34ca630a6e 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -146,7 +146,13 @@ public:
void popParentShadowRoot(const ShadowRoot*);
PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing,
- RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0);
+ RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0, int childIndex = 0);
+
+ // childIndex's origin is 1, and avoids unnecessary tree walks to resolve nth/nth-last selectors.
+ PassRefPtr<RenderStyle> styleForElement(Element* element, int childIndex)
+ {
+ return styleForElement(element, 0, AllowStyleSharing, MatchAllRules, 0, childIndex);
+ }
void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
@@ -187,7 +193,7 @@ public:
}
private:
- void initElement(Element*);
+ void initElement(Element*, int childIndex = 0);
RenderStyle* locateSharedStyle();
bool styleSharingCandidateMatchesRuleSet(RuleSet*);
Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
« no previous file with comments | « Source/core/css/SiblingTraversalStrategies.h ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698