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

Side by Side Diff: Source/core/css/resolver/StyleResolver.h

Issue 18276003: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removing extra parens (whoops) Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 StyleResolver(Document*, bool matchAuthorAndUserStyles); 176 StyleResolver(Document*, bool matchAuthorAndUserStyles);
177 ~StyleResolver(); 177 ~StyleResolver();
178 178
179 // Using these during tree walk will allow style selector to optimize child and descendant selector lookups. 179 // Using these during tree walk will allow style selector to optimize child and descendant selector lookups.
180 void pushParentElement(Element*); 180 void pushParentElement(Element*);
181 void popParentElement(Element*); 181 void popParentElement(Element*);
182 void pushParentShadowRoot(const ShadowRoot*); 182 void pushParentShadowRoot(const ShadowRoot*);
183 void popParentShadowRoot(const ShadowRoot*); 183 void popParentShadowRoot(const ShadowRoot*);
184 184
185 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing, 185 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing,
186 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0 ); 186 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0 , int childIndex = 0);
187
188 // childIndex's origin is 1, and avoids unnecessary tree walks to resolve nt h/nth-last selectors.
189 PassRefPtr<RenderStyle> styleForElement(Element* element, int childIndex)
190 {
191 return styleForElement(element, 0, AllowStyleSharing, MatchAllRules, 0, childIndex);
192 }
187 193
188 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&) ; 194 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&) ;
189 195
190 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq uest&, RenderStyle* parentStyle); 196 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq uest&, RenderStyle* parentStyle);
191 197
192 PassRefPtr<RenderStyle> styleForPage(int pageIndex); 198 PassRefPtr<RenderStyle> styleForPage(int pageIndex);
193 PassRefPtr<RenderStyle> defaultStyleForElement(); 199 PassRefPtr<RenderStyle> defaultStyleForElement();
194 PassRefPtr<RenderStyle> styleForText(Text*); 200 PassRefPtr<RenderStyle> styleForText(Text*);
195 201
196 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector* = 0); 202 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector* = 0);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 PseudoId ignoreDynamicPseudo = NOPSEUDO; 409 PseudoId ignoreDynamicPseudo = NOPSEUDO;
404 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) 410 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches)
405 return true; 411 return true;
406 } 412 }
407 return false; 413 return false;
408 } 414 }
409 415
410 } // namespace WebCore 416 } // namespace WebCore
411 417
412 #endif // StyleResolver_h 418 #endif // StyleResolver_h
OLDNEW
« 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