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

Side by Side Diff: third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp

Issue 1765933003: style: Rename the PseudoId enum values to CamelCase and prefix them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum-clash-PseudoId: none Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return next; 65 return next;
66 } else { 66 } else {
67 if (Node* next = FlatTreeTraversal::nextSibling(node)) 67 if (Node* next = FlatTreeTraversal::nextSibling(node))
68 return next; 68 return next;
69 if (node.isAfterPseudoElement()) 69 if (node.isAfterPseudoElement())
70 return 0; 70 return 0;
71 } 71 }
72 72
73 Node* parent = FlatTreeTraversal::parent(node); 73 Node* parent = FlatTreeTraversal::parent(node);
74 if (parent && parent->isElementNode()) 74 if (parent && parent->isElementNode())
75 return toElement(parent)->pseudoElement(AFTER); 75 return toElement(parent)->pseudoElement(PseudoIdAfter);
76 76
77 return 0; 77 return 0;
78 } 78 }
79 79
80 Node* previousSibling(const Node& node) 80 Node* previousSibling(const Node& node)
81 { 81 {
82 if (node.isAfterPseudoElement()) { 82 if (node.isAfterPseudoElement()) {
83 if (Node* previous = FlatTreeTraversal::lastChild(*FlatTreeTraversal::pa rent(node))) 83 if (Node* previous = FlatTreeTraversal::lastChild(*FlatTreeTraversal::pa rent(node)))
84 return previous; 84 return previous;
85 } else { 85 } else {
86 if (Node* previous = FlatTreeTraversal::previousSibling(node)) 86 if (Node* previous = FlatTreeTraversal::previousSibling(node))
87 return previous; 87 return previous;
88 if (node.isBeforePseudoElement()) 88 if (node.isBeforePseudoElement())
89 return 0; 89 return 0;
90 } 90 }
91 91
92 Node* parent = FlatTreeTraversal::parent(node); 92 Node* parent = FlatTreeTraversal::parent(node);
93 if (parent && parent->isElementNode()) 93 if (parent && parent->isElementNode())
94 return toElement(parent)->pseudoElement(BEFORE); 94 return toElement(parent)->pseudoElement(PseudoIdBefore);
95 95
96 return 0; 96 return 0;
97 } 97 }
98 98
99 static Node* lastChild(const Node& node) 99 static Node* lastChild(const Node& node)
100 { 100 {
101 return FlatTreeTraversal::lastChild(node); 101 return FlatTreeTraversal::lastChild(node);
102 } 102 }
103 103
104 static Node* pseudoAwarePreviousSibling(const Node& node) 104 static Node* pseudoAwarePreviousSibling(const Node& node)
105 { 105 {
106 Node* previousNode = previousSibling(node); 106 Node* previousNode = previousSibling(node);
107 Node* parentNode = parent(node); 107 Node* parentNode = parent(node);
108 108
109 if (parentNode && parentNode->isElementNode() && !previousNode) { 109 if (parentNode && parentNode->isElementNode() && !previousNode) {
110 if (node.isAfterPseudoElement()) { 110 if (node.isAfterPseudoElement()) {
111 if (Node* child = lastChild(*parentNode)) 111 if (Node* child = lastChild(*parentNode))
112 return child; 112 return child;
113 } 113 }
114 if (!node.isBeforePseudoElement()) 114 if (!node.isBeforePseudoElement())
115 return toElement(parentNode)->pseudoElement(BEFORE); 115 return toElement(parentNode)->pseudoElement(PseudoIdBefore);
116 } 116 }
117 return previousNode; 117 return previousNode;
118 } 118 }
119 119
120 static Node* pseudoAwareLastChild(const Node& node) 120 static Node* pseudoAwareLastChild(const Node& node)
121 { 121 {
122 if (node.isElementNode()) { 122 if (node.isElementNode()) {
123 const Element& currentElement = toElement(node); 123 const Element& currentElement = toElement(node);
124 Node* last = currentElement.pseudoElement(AFTER); 124 Node* last = currentElement.pseudoElement(PseudoIdAfter);
125 if (last) 125 if (last)
126 return last; 126 return last;
127 127
128 last = lastChild(currentElement); 128 last = lastChild(currentElement);
129 if (!last) 129 if (!last)
130 last = currentElement.pseudoElement(BEFORE); 130 last = currentElement.pseudoElement(PseudoIdBefore);
131 return last; 131 return last;
132 } 132 }
133 133
134 return lastChild(node); 134 return lastChild(node);
135 } 135 }
136 136
137 Node* previous(const Node& node, const Node* stayWithin) 137 Node* previous(const Node& node, const Node* stayWithin)
138 { 138 {
139 if (node == stayWithin) 139 if (node == stayWithin)
140 return 0; 140 return 0;
(...skipping 15 matching lines...) Expand all
156 { 156 {
157 Node* parentNode = parent(node); 157 Node* parentNode = parent(node);
158 Node* nextNode = nextSibling(node); 158 Node* nextNode = nextSibling(node);
159 159
160 if (parentNode && parentNode->isElementNode() && !nextNode) { 160 if (parentNode && parentNode->isElementNode() && !nextNode) {
161 if (node.isBeforePseudoElement()) { 161 if (node.isBeforePseudoElement()) {
162 if (Node* child = firstChild(*parentNode)) 162 if (Node* child = firstChild(*parentNode))
163 return child; 163 return child;
164 } 164 }
165 if (!node.isAfterPseudoElement()) 165 if (!node.isAfterPseudoElement())
166 return toElement(parentNode)->pseudoElement(AFTER); 166 return toElement(parentNode)->pseudoElement(PseudoIdAfter);
167 } 167 }
168 return nextNode; 168 return nextNode;
169 } 169 }
170 170
171 static Node* pseudoAwareFirstChild(const Node& node) 171 static Node* pseudoAwareFirstChild(const Node& node)
172 { 172 {
173 if (node.isElementNode()) { 173 if (node.isElementNode()) {
174 const Element& currentElement = toElement(node); 174 const Element& currentElement = toElement(node);
175 Node* first = currentElement.pseudoElement(BEFORE); 175 Node* first = currentElement.pseudoElement(PseudoIdBefore);
176 if (first) 176 if (first)
177 return first; 177 return first;
178 first = firstChild(currentElement); 178 first = firstChild(currentElement);
179 if (!first) 179 if (!first)
180 first = currentElement.pseudoElement(AFTER); 180 first = currentElement.pseudoElement(PseudoIdAfter);
181 return first; 181 return first;
182 } 182 }
183 183
184 return firstChild(node); 184 return firstChild(node);
185 } 185 }
186 186
187 static Node* nextAncestorSibling(const Node& node, const Node* stayWithin) 187 static Node* nextAncestorSibling(const Node& node, const Node* stayWithin)
188 { 188 {
189 ASSERT(!pseudoAwareNextSibling(node)); 189 ASSERT(!pseudoAwareNextSibling(node));
190 ASSERT(node != stayWithin); 190 ASSERT(node != stayWithin);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 for (size_t i = position + 1; i < topLayerElements.size(); ++i) { 243 for (size_t i = position + 1; i < topLayerElements.size(); ++i) {
244 if (LayoutObject* layoutObject = topLayerElements[i]->layoutObject()) 244 if (LayoutObject* layoutObject = topLayerElements[i]->layoutObject())
245 return layoutObject; 245 return layoutObject;
246 } 246 }
247 return 0; 247 return 0;
248 } 248 }
249 249
250 } // namespace LayoutTreeBuilderTraversal 250 } // namespace LayoutTreeBuilderTraversal
251 251
252 } // namespace blink 252 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698