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

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: Addressing comments. 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
Index: Source/core/css/resolver/StyleResolver.h
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index 0649cd877901e607ee48c4fe7b0f3c0ad949cbba..003e55dd61e342bd2d7fe54a4256022193609396 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -148,7 +148,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&);
@@ -186,7 +192,7 @@ public:
}
private:
- void initElement(Element*);
+ void initElement(Element*, int childIndex = 0);
eseidel 2013/06/04 06:29:35 This method is so horrible and must die. StyleRes
eseidel 2013/06/04 06:29:35 Why 0? isn't that the firstChild?
RenderStyle* locateSharedStyle();
bool styleSharingCandidateMatchesRuleSet(RuleSet*);
Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;

Powered by Google App Engine
This is Rietveld 408576698