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

Side by Side Diff: Source/core/css/SelectorChecker.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 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 enum BehaviorAtBoundary { 48 enum BehaviorAtBoundary {
49 DoesNotCrossBoundary = 0, 49 DoesNotCrossBoundary = 0,
50 CrossesBoundary = 1, 50 CrossesBoundary = 1,
51 StaysWithinTreeScope = 2, 51 StaysWithinTreeScope = 2,
52 BoundaryBehaviorMask = 3, // 2bit for boundary behavior 52 BoundaryBehaviorMask = 3, // 2bit for boundary behavior
53 ScopeContainsLastMatchedElement = 4, 53 ScopeContainsLastMatchedElement = 4,
54 }; 54 };
55 55
56 struct SelectorCheckingContext { 56 struct SelectorCheckingContext {
57 // Initial selector constructor 57 // Initial selector constructor
58 SelectorCheckingContext(const CSSSelector* selector, Element* element, V isitedMatchType visitedMatchType) 58 SelectorCheckingContext(const CSSSelector* selector, Element* element, V isitedMatchType visitedMatchType, int childIndex = 0)
59 : selector(selector) 59 : selector(selector)
60 , element(element) 60 , element(element)
61 , scope(0) 61 , scope(0)
62 , visitedMatchType(visitedMatchType) 62 , visitedMatchType(visitedMatchType)
63 , pseudoId(NOPSEUDO) 63 , pseudoId(NOPSEUDO)
64 , elementStyle(0) 64 , elementStyle(0)
65 , scrollbar(0) 65 , scrollbar(0)
66 , scrollbarPart(NoPart) 66 , scrollbarPart(NoPart)
67 , isSubSelector(false) 67 , isSubSelector(false)
68 , hasScrollbarPseudo(false) 68 , hasScrollbarPseudo(false)
69 , hasSelectionPseudo(false) 69 , hasSelectionPseudo(false)
70 , behaviorAtBoundary(DoesNotCrossBoundary) 70 , behaviorAtBoundary(DoesNotCrossBoundary)
71 , childIndex(childIndex)
71 { } 72 { }
72 73
73 const CSSSelector* selector; 74 const CSSSelector* selector;
74 Element* element; 75 Element* element;
75 const ContainerNode* scope; 76 const ContainerNode* scope;
76 VisitedMatchType visitedMatchType; 77 VisitedMatchType visitedMatchType;
77 PseudoId pseudoId; 78 PseudoId pseudoId;
78 RenderStyle* elementStyle; 79 RenderStyle* elementStyle;
79 RenderScrollbar* scrollbar; 80 RenderScrollbar* scrollbar;
80 ScrollbarPart scrollbarPart; 81 ScrollbarPart scrollbarPart;
81 bool isSubSelector; 82 bool isSubSelector;
82 bool hasScrollbarPseudo; 83 bool hasScrollbarPseudo;
83 bool hasSelectionPseudo; 84 bool hasSelectionPseudo;
84 BehaviorAtBoundary behaviorAtBoundary; 85 BehaviorAtBoundary behaviorAtBoundary;
86 int childIndex;
85 }; 87 };
86 88
87 template<typename SiblingTraversalStrategy> 89 template<typename SiblingTraversalStrategy>
88 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa lStrategy&) const; 90 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa lStrategy&) const;
89 91
90 template<typename SiblingTraversalStrategy> 92 template<typename SiblingTraversalStrategy>
91 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate gy&, PseudoId&, SelectorCheckingContext& nextContext) const; 93 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate gy&, PseudoId&, SelectorCheckingContext& nextContext) const;
92 94
93 template<typename SiblingTraversalStrategy> 95 template<typename SiblingTraversalStrategy>
94 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy &) const; 96 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy &) const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const Attribute* attribute = element->attributeItem(i); 148 const Attribute* attribute = element->attributeItem(i);
147 if (attribute->matches(selectorAttributeName) && (!value || attribute->v alue().impl() == value)) 149 if (attribute->matches(selectorAttributeName) && (!value || attribute->v alue().impl() == value))
148 return true; 150 return true;
149 } 151 }
150 return false; 152 return false;
151 } 153 }
152 154
153 } 155 }
154 156
155 #endif 157 #endif
OLDNEW
« no previous file with comments | « LayoutTests/platform/win/fast/html/details-open2-expected.txt ('k') | Source/core/css/SelectorChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698