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

Side by Side Diff: Source/core/dom/ContainerNode.h

Issue 758523002: Store :last/first-child state as restyle flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed assert Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ChildrenOrSiblingsAffectedByFocus = 1 << 0, 43 ChildrenOrSiblingsAffectedByFocus = 1 << 0,
44 ChildrenOrSiblingsAffectedByHover = 1 << 1, 44 ChildrenOrSiblingsAffectedByHover = 1 << 1,
45 ChildrenOrSiblingsAffectedByActive = 1 << 2, 45 ChildrenOrSiblingsAffectedByActive = 1 << 2,
46 ChildrenOrSiblingsAffectedByDrag = 1 << 3, 46 ChildrenOrSiblingsAffectedByDrag = 1 << 3,
47 ChildrenAffectedByFirstChildRules = 1 << 4, 47 ChildrenAffectedByFirstChildRules = 1 << 4,
48 ChildrenAffectedByLastChildRules = 1 << 5, 48 ChildrenAffectedByLastChildRules = 1 << 5,
49 ChildrenAffectedByDirectAdjacentRules = 1 << 6, 49 ChildrenAffectedByDirectAdjacentRules = 1 << 6,
50 ChildrenAffectedByIndirectAdjacentRules = 1 << 7, 50 ChildrenAffectedByIndirectAdjacentRules = 1 << 7,
51 ChildrenAffectedByForwardPositionalRules = 1 << 8, 51 ChildrenAffectedByForwardPositionalRules = 1 << 8,
52 ChildrenAffectedByBackwardPositionalRules = 1 << 9, 52 ChildrenAffectedByBackwardPositionalRules = 1 << 9,
53 AffectedByFirstChildRules = 1 << 10,
54 AffectedByLastChildRules = 1 << 11,
53 55
54 NumberOfDynamicRestyleFlags = 10, 56 NumberOfDynamicRestyleFlags = 12,
55 }; 57 };
56 58
57 enum SubtreeModificationAction { 59 enum SubtreeModificationAction {
58 DispatchSubtreeModifiedEvent, 60 DispatchSubtreeModifiedEvent,
59 OmitSubtreeModifiedEvent 61 OmitSubtreeModifiedEvent
60 }; 62 };
61 63
62 // This constant controls how much buffer is initially allocated 64 // This constant controls how much buffer is initially allocated
63 // for a Node Vector that is used to store child Nodes of a given Node. 65 // for a Node Vector that is used to store child Nodes of a given Node.
64 // FIXME: Optimize the value. 66 // FIXME: Optimize the value.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 142
141 bool childrenAffectedByIndirectAdjacentRules() const { return hasRestyleFlag (ChildrenAffectedByIndirectAdjacentRules); } 143 bool childrenAffectedByIndirectAdjacentRules() const { return hasRestyleFlag (ChildrenAffectedByIndirectAdjacentRules); }
142 void setChildrenAffectedByIndirectAdjacentRules() { setRestyleFlag(ChildrenA ffectedByIndirectAdjacentRules); } 144 void setChildrenAffectedByIndirectAdjacentRules() { setRestyleFlag(ChildrenA ffectedByIndirectAdjacentRules); }
143 145
144 bool childrenAffectedByForwardPositionalRules() const { return hasRestyleFla g(ChildrenAffectedByForwardPositionalRules); } 146 bool childrenAffectedByForwardPositionalRules() const { return hasRestyleFla g(ChildrenAffectedByForwardPositionalRules); }
145 void setChildrenAffectedByForwardPositionalRules() { setRestyleFlag(Children AffectedByForwardPositionalRules); } 147 void setChildrenAffectedByForwardPositionalRules() { setRestyleFlag(Children AffectedByForwardPositionalRules); }
146 148
147 bool childrenAffectedByBackwardPositionalRules() const { return hasRestyleFl ag(ChildrenAffectedByBackwardPositionalRules); } 149 bool childrenAffectedByBackwardPositionalRules() const { return hasRestyleFl ag(ChildrenAffectedByBackwardPositionalRules); }
148 void setChildrenAffectedByBackwardPositionalRules() { setRestyleFlag(Childre nAffectedByBackwardPositionalRules); } 150 void setChildrenAffectedByBackwardPositionalRules() { setRestyleFlag(Childre nAffectedByBackwardPositionalRules); }
149 151
152 bool affectedByFirstChildRules() const { return hasRestyleFlag(AffectedByFir stChildRules); }
153 void setAffectedByFirstChildRules() { setRestyleFlag(AffectedByFirstChildRul es); }
154
155 bool affectedByLastChildRules() const { return hasRestyleFlag(AffectedByLast ChildRules); }
156 void setAffectedByLastChildRules() { setRestyleFlag(AffectedByLastChildRules ); }
157
150 // FIXME: These methods should all be renamed to something better than "chec k", 158 // FIXME: These methods should all be renamed to something better than "chec k",
151 // since it's not clear that they alter the style bits of siblings and child ren. 159 // since it's not clear that they alter the style bits of siblings and child ren.
152 void checkForChildrenAdjacentRuleChanges(); 160 void checkForChildrenAdjacentRuleChanges();
153 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib lingElementRemoved }; 161 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib lingElementRemoved };
154 void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, N ode* nodeAfterChange); 162 void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, N ode* nodeAfterChange);
155 void recalcChildStyle(StyleRecalcChange); 163 void recalcChildStyle(StyleRecalcChange);
156 164
157 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } 165 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); }
158 166
159 // ------------------------------------------------------------------------- ---- 167 // ------------------------------------------------------------------------- ----
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) 354 inline void getChildNodes(ContainerNode& node, NodeVector& nodes)
347 { 355 {
348 ASSERT(!nodes.size()); 356 ASSERT(!nodes.size());
349 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 357 for (Node* child = node.firstChild(); child; child = child->nextSibling())
350 nodes.append(child); 358 nodes.append(child);
351 } 359 }
352 360
353 } // namespace blink 361 } // namespace blink
354 362
355 #endif // ContainerNode_h 363 #endif // ContainerNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698