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

Side by Side Diff: Source/core/css/SelectorChecker.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: Merging ToT 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/css/SelectorChecker.cpp » ('j') | Source/core/css/SelectorChecker.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 enum BehaviorAtBoundary { 51 enum BehaviorAtBoundary {
52 DoesNotCrossBoundary = 0, 52 DoesNotCrossBoundary = 0,
53 CrossesBoundary = 1, 53 CrossesBoundary = 1,
54 StaysWithinTreeScope = 2, 54 StaysWithinTreeScope = 2,
55 BoundaryBehaviorMask = 3, // 2bit for boundary behavior 55 BoundaryBehaviorMask = 3, // 2bit for boundary behavior
56 ScopeContainsLastMatchedElement = 4, 56 ScopeContainsLastMatchedElement = 4,
57 }; 57 };
58 58
59 struct SelectorCheckingContext { 59 struct SelectorCheckingContext {
60 // Initial selector constructor 60 // Initial selector constructor
61 SelectorCheckingContext(const CSSSelector* selector, Element* element, V isitedMatchType visitedMatchType) 61 SelectorCheckingContext(const CSSSelector* selector, Element* element, V isitedMatchType visitedMatchType, int childIndex = 0)
62 : selector(selector) 62 : selector(selector)
63 , element(element) 63 , element(element)
64 , scope(0) 64 , scope(0)
65 , visitedMatchType(visitedMatchType) 65 , visitedMatchType(visitedMatchType)
66 , pseudoId(NOPSEUDO) 66 , pseudoId(NOPSEUDO)
67 , elementStyle(0) 67 , elementStyle(0)
68 , scrollbar(0) 68 , scrollbar(0)
69 , scrollbarPart(NoPart) 69 , scrollbarPart(NoPart)
70 , isSubSelector(false) 70 , isSubSelector(false)
71 , hasScrollbarPseudo(false) 71 , hasScrollbarPseudo(false)
72 , hasSelectionPseudo(false) 72 , hasSelectionPseudo(false)
73 , behaviorAtBoundary(DoesNotCrossBoundary) 73 , behaviorAtBoundary(DoesNotCrossBoundary)
74 , childIndex(childIndex)
74 { } 75 { }
75 76
76 const CSSSelector* selector; 77 const CSSSelector* selector;
77 Element* element; 78 Element* element;
78 const ContainerNode* scope; 79 const ContainerNode* scope;
79 VisitedMatchType visitedMatchType; 80 VisitedMatchType visitedMatchType;
80 PseudoId pseudoId; 81 PseudoId pseudoId;
81 RenderStyle* elementStyle; 82 RenderStyle* elementStyle;
82 RenderScrollbar* scrollbar; 83 RenderScrollbar* scrollbar;
83 ScrollbarPart scrollbarPart; 84 ScrollbarPart scrollbarPart;
84 bool isSubSelector; 85 bool isSubSelector;
85 bool hasScrollbarPseudo; 86 bool hasScrollbarPseudo;
86 bool hasSelectionPseudo; 87 bool hasSelectionPseudo;
87 BehaviorAtBoundary behaviorAtBoundary; 88 BehaviorAtBoundary behaviorAtBoundary;
89 int childIndex;
88 }; 90 };
89 91
90 template<typename SiblingTraversalStrategy> 92 template<typename SiblingTraversalStrategy>
91 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa lStrategy&) const; 93 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa lStrategy&) const;
92 94
93 template<typename SiblingTraversalStrategy> 95 template<typename SiblingTraversalStrategy>
94 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate gy&, PseudoId&, SelectorCheckingContext& nextContext) const; 96 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate gy&, PseudoId&, SelectorCheckingContext& nextContext) const;
95 97
96 template<typename SiblingTraversalStrategy> 98 template<typename SiblingTraversalStrategy>
97 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy &) const; 99 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy &) const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const Attribute* attribute = element->attributeItem(i); 151 const Attribute* attribute = element->attributeItem(i);
150 if (attribute->matches(selectorAttributeName) && (!value || attribute->v alue().impl() == value)) 152 if (attribute->matches(selectorAttributeName) && (!value || attribute->v alue().impl() == value))
151 return true; 153 return true;
152 } 154 }
153 return false; 155 return false;
154 } 156 }
155 157
156 } 158 }
157 159
158 #endif 160 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/SelectorChecker.cpp » ('j') | Source/core/css/SelectorChecker.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698