OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 inline bool isSelectScopeMarker(HTMLStackItem* item) { | 94 inline bool isSelectScopeMarker(HTMLStackItem* item) { |
95 return !item->hasTagName(optgroupTag) && !item->hasTagName(optionTag); | 95 return !item->hasTagName(optgroupTag) && !item->hasTagName(optionTag); |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 HTMLElementStack::ElementRecord::ElementRecord(HTMLStackItem* item, | 100 HTMLElementStack::ElementRecord::ElementRecord(HTMLStackItem* item, |
101 ElementRecord* next) | 101 ElementRecord* next) |
102 : m_item(item), m_next(next) { | 102 : m_item(item), m_next(next) { |
103 ASSERT(m_item); | 103 DCHECK(m_item); |
104 } | 104 } |
105 | 105 |
106 void HTMLElementStack::ElementRecord::replaceElement(HTMLStackItem* item) { | 106 void HTMLElementStack::ElementRecord::replaceElement(HTMLStackItem* item) { |
107 ASSERT(item); | 107 DCHECK(item); |
108 ASSERT(!m_item || m_item->isElementNode()); | 108 DCHECK(!m_item || m_item->isElementNode()); |
109 // FIXME: Should this call finishParsingChildren? | 109 // FIXME: Should this call finishParsingChildren? |
110 m_item = item; | 110 m_item = item; |
111 } | 111 } |
112 | 112 |
113 bool HTMLElementStack::ElementRecord::isAbove(ElementRecord* other) const { | 113 bool HTMLElementStack::ElementRecord::isAbove(ElementRecord* other) const { |
114 for (ElementRecord* below = next(); below; below = below->next()) { | 114 for (ElementRecord* below = next(); below; below = below->next()) { |
115 if (below == other) | 115 if (below == other) |
116 return true; | 116 return true; |
117 } | 117 } |
118 return false; | 118 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
132 HTMLElementStack::~HTMLElementStack() {} | 132 HTMLElementStack::~HTMLElementStack() {} |
133 | 133 |
134 bool HTMLElementStack::hasOnlyOneElement() const { | 134 bool HTMLElementStack::hasOnlyOneElement() const { |
135 return !topRecord()->next(); | 135 return !topRecord()->next(); |
136 } | 136 } |
137 | 137 |
138 bool HTMLElementStack::secondElementIsHTMLBodyElement() const { | 138 bool HTMLElementStack::secondElementIsHTMLBodyElement() const { |
139 // This is used the fragment case of <body> and <frameset> in the "in body" | 139 // This is used the fragment case of <body> and <frameset> in the "in body" |
140 // insertion mode. | 140 // insertion mode. |
141 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.ht
ml#parsing-main-inbody | 141 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.ht
ml#parsing-main-inbody |
142 ASSERT(m_rootNode); | 142 DCHECK(m_rootNode); |
143 // If we have a body element, it must always be the second element on the | 143 // If we have a body element, it must always be the second element on the |
144 // stack, as we always start with an html element, and any other element | 144 // stack, as we always start with an html element, and any other element |
145 // would cause the implicit creation of a body element. | 145 // would cause the implicit creation of a body element. |
146 return !!m_bodyElement; | 146 return !!m_bodyElement; |
147 } | 147 } |
148 | 148 |
149 void HTMLElementStack::popHTMLHeadElement() { | 149 void HTMLElementStack::popHTMLHeadElement() { |
150 ASSERT(top() == m_headElement); | 150 DCHECK_EQ(top(), m_headElement); |
151 m_headElement = nullptr; | 151 m_headElement = nullptr; |
152 popCommon(); | 152 popCommon(); |
153 } | 153 } |
154 | 154 |
155 void HTMLElementStack::popHTMLBodyElement() { | 155 void HTMLElementStack::popHTMLBodyElement() { |
156 ASSERT(top() == m_bodyElement); | 156 DCHECK_EQ(top(), m_bodyElement); |
157 m_bodyElement = nullptr; | 157 m_bodyElement = nullptr; |
158 popCommon(); | 158 popCommon(); |
159 } | 159 } |
160 | 160 |
161 void HTMLElementStack::popAll() { | 161 void HTMLElementStack::popAll() { |
162 m_rootNode = nullptr; | 162 m_rootNode = nullptr; |
163 m_headElement = nullptr; | 163 m_headElement = nullptr; |
164 m_bodyElement = nullptr; | 164 m_bodyElement = nullptr; |
165 m_stackDepth = 0; | 165 m_stackDepth = 0; |
166 while (m_top) { | 166 while (m_top) { |
167 Node& node = *topNode(); | 167 Node& node = *topNode(); |
168 if (node.isElementNode()) { | 168 if (node.isElementNode()) { |
169 toElement(node).finishParsingChildren(); | 169 toElement(node).finishParsingChildren(); |
170 if (isHTMLSelectElement(node)) | 170 if (isHTMLSelectElement(node)) |
171 toHTMLFormControlElement(node).setBlocksFormSubmission(true); | 171 toHTMLFormControlElement(node).setBlocksFormSubmission(true); |
172 } | 172 } |
173 m_top = m_top->releaseNext(); | 173 m_top = m_top->releaseNext(); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 void HTMLElementStack::pop() { | 177 void HTMLElementStack::pop() { |
178 ASSERT(!topStackItem()->hasTagName(HTMLNames::headTag)); | 178 DCHECK(!topStackItem()->hasTagName(HTMLNames::headTag)); |
179 popCommon(); | 179 popCommon(); |
180 } | 180 } |
181 | 181 |
182 void HTMLElementStack::popUntil(const AtomicString& tagName) { | 182 void HTMLElementStack::popUntil(const AtomicString& tagName) { |
183 while (!topStackItem()->matchesHTMLTag(tagName)) { | 183 while (!topStackItem()->matchesHTMLTag(tagName)) { |
184 // pop() will ASSERT if a <body>, <head> or <html> will be popped. | 184 // pop() will ASSERT if a <body>, <head> or <html> will be popped. |
185 pop(); | 185 pop(); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 item->hasTagName(SVGNames::descTag) || | 253 item->hasTagName(SVGNames::descTag) || |
254 item->hasTagName(SVGNames::titleTag); | 254 item->hasTagName(SVGNames::titleTag); |
255 } | 255 } |
256 | 256 |
257 void HTMLElementStack::popUntilForeignContentScopeMarker() { | 257 void HTMLElementStack::popUntilForeignContentScopeMarker() { |
258 while (!isForeignContentScopeMarker(topStackItem())) | 258 while (!isForeignContentScopeMarker(topStackItem())) |
259 pop(); | 259 pop(); |
260 } | 260 } |
261 | 261 |
262 void HTMLElementStack::pushRootNode(HTMLStackItem* rootItem) { | 262 void HTMLElementStack::pushRootNode(HTMLStackItem* rootItem) { |
263 ASSERT(rootItem->isDocumentFragmentNode()); | 263 DCHECK(rootItem->isDocumentFragmentNode()); |
264 pushRootNodeCommon(rootItem); | 264 pushRootNodeCommon(rootItem); |
265 } | 265 } |
266 | 266 |
267 void HTMLElementStack::pushHTMLHtmlElement(HTMLStackItem* item) { | 267 void HTMLElementStack::pushHTMLHtmlElement(HTMLStackItem* item) { |
268 ASSERT(item->hasTagName(htmlTag)); | 268 DCHECK(item->hasTagName(htmlTag)); |
269 pushRootNodeCommon(item); | 269 pushRootNodeCommon(item); |
270 } | 270 } |
271 | 271 |
272 void HTMLElementStack::pushRootNodeCommon(HTMLStackItem* rootItem) { | 272 void HTMLElementStack::pushRootNodeCommon(HTMLStackItem* rootItem) { |
273 ASSERT(!m_top); | 273 DCHECK(!m_top); |
274 ASSERT(!m_rootNode); | 274 DCHECK(!m_rootNode); |
275 m_rootNode = rootItem->node(); | 275 m_rootNode = rootItem->node(); |
276 pushCommon(rootItem); | 276 pushCommon(rootItem); |
277 } | 277 } |
278 | 278 |
279 void HTMLElementStack::pushHTMLHeadElement(HTMLStackItem* item) { | 279 void HTMLElementStack::pushHTMLHeadElement(HTMLStackItem* item) { |
280 ASSERT(item->hasTagName(HTMLNames::headTag)); | 280 DCHECK(item->hasTagName(HTMLNames::headTag)); |
281 ASSERT(!m_headElement); | 281 DCHECK(!m_headElement); |
282 m_headElement = item->element(); | 282 m_headElement = item->element(); |
283 pushCommon(item); | 283 pushCommon(item); |
284 } | 284 } |
285 | 285 |
286 void HTMLElementStack::pushHTMLBodyElement(HTMLStackItem* item) { | 286 void HTMLElementStack::pushHTMLBodyElement(HTMLStackItem* item) { |
287 ASSERT(item->hasTagName(HTMLNames::bodyTag)); | 287 DCHECK(item->hasTagName(HTMLNames::bodyTag)); |
288 ASSERT(!m_bodyElement); | 288 DCHECK(!m_bodyElement); |
289 m_bodyElement = item->element(); | 289 m_bodyElement = item->element(); |
290 pushCommon(item); | 290 pushCommon(item); |
291 } | 291 } |
292 | 292 |
293 void HTMLElementStack::push(HTMLStackItem* item) { | 293 void HTMLElementStack::push(HTMLStackItem* item) { |
294 ASSERT(!item->hasTagName(htmlTag)); | 294 DCHECK(!item->hasTagName(htmlTag)); |
295 ASSERT(!item->hasTagName(headTag)); | 295 DCHECK(!item->hasTagName(headTag)); |
296 ASSERT(!item->hasTagName(bodyTag)); | 296 DCHECK(!item->hasTagName(bodyTag)); |
297 ASSERT(m_rootNode); | 297 DCHECK(m_rootNode); |
298 pushCommon(item); | 298 pushCommon(item); |
299 } | 299 } |
300 | 300 |
301 void HTMLElementStack::insertAbove(HTMLStackItem* item, | 301 void HTMLElementStack::insertAbove(HTMLStackItem* item, |
302 ElementRecord* recordBelow) { | 302 ElementRecord* recordBelow) { |
303 ASSERT(item); | 303 DCHECK(item); |
304 ASSERT(recordBelow); | 304 DCHECK(recordBelow); |
305 ASSERT(m_top); | 305 DCHECK(m_top); |
306 ASSERT(!item->hasTagName(htmlTag)); | 306 DCHECK(!item->hasTagName(htmlTag)); |
307 ASSERT(!item->hasTagName(headTag)); | 307 DCHECK(!item->hasTagName(headTag)); |
308 ASSERT(!item->hasTagName(bodyTag)); | 308 DCHECK(!item->hasTagName(bodyTag)); |
309 ASSERT(m_rootNode); | 309 DCHECK(m_rootNode); |
310 if (recordBelow == m_top) { | 310 if (recordBelow == m_top) { |
311 push(item); | 311 push(item); |
312 return; | 312 return; |
313 } | 313 } |
314 | 314 |
315 for (ElementRecord* recordAbove = m_top.get(); recordAbove; | 315 for (ElementRecord* recordAbove = m_top.get(); recordAbove; |
316 recordAbove = recordAbove->next()) { | 316 recordAbove = recordAbove->next()) { |
317 if (recordAbove->next() != recordBelow) | 317 if (recordAbove->next() != recordBelow) |
318 continue; | 318 continue; |
319 | 319 |
320 m_stackDepth++; | 320 m_stackDepth++; |
321 recordAbove->setNext(new ElementRecord(item, recordAbove->releaseNext())); | 321 recordAbove->setNext(new ElementRecord(item, recordAbove->releaseNext())); |
322 recordAbove->next()->element()->beginParsingChildren(); | 322 recordAbove->next()->element()->beginParsingChildren(); |
323 return; | 323 return; |
324 } | 324 } |
325 ASSERT_NOT_REACHED(); | 325 NOTREACHED(); |
326 } | 326 } |
327 | 327 |
328 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const { | 328 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const { |
329 ASSERT(m_top); | 329 DCHECK(m_top); |
330 return m_top.get(); | 330 return m_top.get(); |
331 } | 331 } |
332 | 332 |
333 HTMLStackItem* HTMLElementStack::oneBelowTop() const { | 333 HTMLStackItem* HTMLElementStack::oneBelowTop() const { |
334 // We should never call this if there are fewer than 2 elements on the stack. | 334 // We should never call this if there are fewer than 2 elements on the stack. |
335 ASSERT(m_top); | 335 DCHECK(m_top); |
336 ASSERT(m_top->next()); | 336 DCHECK(m_top->next()); |
337 if (m_top->next()->stackItem()->isElementNode()) | 337 if (m_top->next()->stackItem()->isElementNode()) |
338 return m_top->next()->stackItem(); | 338 return m_top->next()->stackItem(); |
339 return nullptr; | 339 return nullptr; |
340 } | 340 } |
341 | 341 |
342 void HTMLElementStack::removeHTMLHeadElement(Element* element) { | 342 void HTMLElementStack::removeHTMLHeadElement(Element* element) { |
343 ASSERT(m_headElement == element); | 343 DCHECK_EQ(m_headElement, element); |
344 if (m_top->element() == element) { | 344 if (m_top->element() == element) { |
345 popHTMLHeadElement(); | 345 popHTMLHeadElement(); |
346 return; | 346 return; |
347 } | 347 } |
348 m_headElement = nullptr; | 348 m_headElement = nullptr; |
349 removeNonTopCommon(element); | 349 removeNonTopCommon(element); |
350 } | 350 } |
351 | 351 |
352 void HTMLElementStack::remove(Element* element) { | 352 void HTMLElementStack::remove(Element* element) { |
353 ASSERT(!isHTMLHeadElement(element)); | 353 DCHECK(!isHTMLHeadElement(element)); |
354 if (m_top->element() == element) { | 354 if (m_top->element() == element) { |
355 pop(); | 355 pop(); |
356 return; | 356 return; |
357 } | 357 } |
358 removeNonTopCommon(element); | 358 removeNonTopCommon(element); |
359 } | 359 } |
360 | 360 |
361 HTMLElementStack::ElementRecord* HTMLElementStack::find( | 361 HTMLElementStack::ElementRecord* HTMLElementStack::find( |
362 Element* element) const { | 362 Element* element) const { |
363 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { | 363 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { |
(...skipping 23 matching lines...) Expand all Loading... |
387 template <bool isMarker(HTMLStackItem*)> | 387 template <bool isMarker(HTMLStackItem*)> |
388 bool inScopeCommon(HTMLElementStack::ElementRecord* top, | 388 bool inScopeCommon(HTMLElementStack::ElementRecord* top, |
389 const AtomicString& targetTag) { | 389 const AtomicString& targetTag) { |
390 for (HTMLElementStack::ElementRecord* pos = top; pos; pos = pos->next()) { | 390 for (HTMLElementStack::ElementRecord* pos = top; pos; pos = pos->next()) { |
391 HTMLStackItem* item = pos->stackItem(); | 391 HTMLStackItem* item = pos->stackItem(); |
392 if (item->matchesHTMLTag(targetTag)) | 392 if (item->matchesHTMLTag(targetTag)) |
393 return true; | 393 return true; |
394 if (isMarker(item)) | 394 if (isMarker(item)) |
395 return false; | 395 return false; |
396 } | 396 } |
397 ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker. | 397 NOTREACHED(); // <html> is always on the stack and is a scope marker. |
398 return false; | 398 return false; |
399 } | 399 } |
400 | 400 |
401 bool HTMLElementStack::hasNumberedHeaderElementInScope() const { | 401 bool HTMLElementStack::hasNumberedHeaderElementInScope() const { |
402 for (ElementRecord* record = m_top.get(); record; record = record->next()) { | 402 for (ElementRecord* record = m_top.get(); record; record = record->next()) { |
403 HTMLStackItem* item = record->stackItem(); | 403 HTMLStackItem* item = record->stackItem(); |
404 if (item->isNumberedHeaderElement()) | 404 if (item->isNumberedHeaderElement()) |
405 return true; | 405 return true; |
406 if (isScopeMarker(item)) | 406 if (isScopeMarker(item)) |
407 return false; | 407 return false; |
408 } | 408 } |
409 ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker. | 409 NOTREACHED(); // <html> is always on the stack and is a scope marker. |
410 return false; | 410 return false; |
411 } | 411 } |
412 | 412 |
413 bool HTMLElementStack::inScope(Element* targetElement) const { | 413 bool HTMLElementStack::inScope(Element* targetElement) const { |
414 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { | 414 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { |
415 HTMLStackItem* item = pos->stackItem(); | 415 HTMLStackItem* item = pos->stackItem(); |
416 if (item->node() == targetElement) | 416 if (item->node() == targetElement) |
417 return true; | 417 return true; |
418 if (isScopeMarker(item)) | 418 if (isScopeMarker(item)) |
419 return false; | 419 return false; |
420 } | 420 } |
421 ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker. | 421 NOTREACHED(); // <html> is always on the stack and is a scope marker. |
422 return false; | 422 return false; |
423 } | 423 } |
424 | 424 |
425 bool HTMLElementStack::inScope(const AtomicString& targetTag) const { | 425 bool HTMLElementStack::inScope(const AtomicString& targetTag) const { |
426 return inScopeCommon<isScopeMarker>(m_top.get(), targetTag); | 426 return inScopeCommon<isScopeMarker>(m_top.get(), targetTag); |
427 } | 427 } |
428 | 428 |
429 bool HTMLElementStack::inScope(const QualifiedName& tagName) const { | 429 bool HTMLElementStack::inScope(const QualifiedName& tagName) const { |
430 return inScope(tagName.localName()); | 430 return inScope(tagName.localName()); |
431 } | 431 } |
(...skipping 28 matching lines...) Expand all Loading... |
460 | 460 |
461 bool HTMLElementStack::inSelectScope(const QualifiedName& tagName) const { | 461 bool HTMLElementStack::inSelectScope(const QualifiedName& tagName) const { |
462 return inSelectScope(tagName.localName()); | 462 return inSelectScope(tagName.localName()); |
463 } | 463 } |
464 | 464 |
465 bool HTMLElementStack::hasTemplateInHTMLScope() const { | 465 bool HTMLElementStack::hasTemplateInHTMLScope() const { |
466 return inScopeCommon<isRootNode>(m_top.get(), templateTag.localName()); | 466 return inScopeCommon<isRootNode>(m_top.get(), templateTag.localName()); |
467 } | 467 } |
468 | 468 |
469 Element* HTMLElementStack::htmlElement() const { | 469 Element* HTMLElementStack::htmlElement() const { |
470 ASSERT(m_rootNode); | 470 DCHECK(m_rootNode); |
471 return toElement(m_rootNode); | 471 return toElement(m_rootNode); |
472 } | 472 } |
473 | 473 |
474 Element* HTMLElementStack::headElement() const { | 474 Element* HTMLElementStack::headElement() const { |
475 ASSERT(m_headElement); | 475 DCHECK(m_headElement); |
476 return m_headElement; | 476 return m_headElement; |
477 } | 477 } |
478 | 478 |
479 Element* HTMLElementStack::bodyElement() const { | 479 Element* HTMLElementStack::bodyElement() const { |
480 ASSERT(m_bodyElement); | 480 DCHECK(m_bodyElement); |
481 return m_bodyElement; | 481 return m_bodyElement; |
482 } | 482 } |
483 | 483 |
484 ContainerNode* HTMLElementStack::rootNode() const { | 484 ContainerNode* HTMLElementStack::rootNode() const { |
485 ASSERT(m_rootNode); | 485 DCHECK(m_rootNode); |
486 return m_rootNode; | 486 return m_rootNode; |
487 } | 487 } |
488 | 488 |
489 void HTMLElementStack::pushCommon(HTMLStackItem* item) { | 489 void HTMLElementStack::pushCommon(HTMLStackItem* item) { |
490 ASSERT(m_rootNode); | 490 DCHECK(m_rootNode); |
491 | 491 |
492 m_stackDepth++; | 492 m_stackDepth++; |
493 m_top = new ElementRecord(item, m_top.release()); | 493 m_top = new ElementRecord(item, m_top.release()); |
494 } | 494 } |
495 | 495 |
496 void HTMLElementStack::popCommon() { | 496 void HTMLElementStack::popCommon() { |
497 ASSERT(!topStackItem()->hasTagName(htmlTag)); | 497 DCHECK(!topStackItem()->hasTagName(htmlTag)); |
498 ASSERT(!topStackItem()->hasTagName(headTag) || !m_headElement); | 498 DCHECK(!topStackItem()->hasTagName(headTag) || !m_headElement); |
499 ASSERT(!topStackItem()->hasTagName(bodyTag) || !m_bodyElement); | 499 DCHECK(!topStackItem()->hasTagName(bodyTag) || !m_bodyElement); |
500 top()->finishParsingChildren(); | 500 top()->finishParsingChildren(); |
501 m_top = m_top->releaseNext(); | 501 m_top = m_top->releaseNext(); |
502 | 502 |
503 m_stackDepth--; | 503 m_stackDepth--; |
504 } | 504 } |
505 | 505 |
506 void HTMLElementStack::removeNonTopCommon(Element* element) { | 506 void HTMLElementStack::removeNonTopCommon(Element* element) { |
507 ASSERT(!isHTMLHtmlElement(element)); | 507 DCHECK(!isHTMLHtmlElement(element)); |
508 ASSERT(!isHTMLBodyElement(element)); | 508 DCHECK(!isHTMLBodyElement(element)); |
509 ASSERT(top() != element); | 509 DCHECK_NE(top(), element); |
510 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { | 510 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { |
511 if (pos->next()->element() == element) { | 511 if (pos->next()->element() == element) { |
512 // FIXME: Is it OK to call finishParsingChildren() | 512 // FIXME: Is it OK to call finishParsingChildren() |
513 // when the children aren't actually finished? | 513 // when the children aren't actually finished? |
514 element->finishParsingChildren(); | 514 element->finishParsingChildren(); |
515 pos->setNext(pos->next()->releaseNext()); | 515 pos->setNext(pos->next()->releaseNext()); |
516 m_stackDepth--; | 516 m_stackDepth--; |
517 return; | 517 return; |
518 } | 518 } |
519 } | 519 } |
520 ASSERT_NOT_REACHED(); | 520 NOTREACHED(); |
521 } | 521 } |
522 | 522 |
523 HTMLElementStack::ElementRecord* | 523 HTMLElementStack::ElementRecord* |
524 HTMLElementStack::furthestBlockForFormattingElement( | 524 HTMLElementStack::furthestBlockForFormattingElement( |
525 Element* formattingElement) const { | 525 Element* formattingElement) const { |
526 ElementRecord* furthestBlock = 0; | 526 ElementRecord* furthestBlock = 0; |
527 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { | 527 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { |
528 if (pos->element() == formattingElement) | 528 if (pos->element() == formattingElement) |
529 return furthestBlock; | 529 return furthestBlock; |
530 if (pos->stackItem()->isSpecialNode()) | 530 if (pos->stackItem()->isSpecialNode()) |
531 furthestBlock = pos; | 531 furthestBlock = pos; |
532 } | 532 } |
533 ASSERT_NOT_REACHED(); | 533 NOTREACHED(); |
534 return nullptr; | 534 return nullptr; |
535 } | 535 } |
536 | 536 |
537 DEFINE_TRACE(HTMLElementStack) { | 537 DEFINE_TRACE(HTMLElementStack) { |
538 visitor->trace(m_top); | 538 visitor->trace(m_top); |
539 visitor->trace(m_rootNode); | 539 visitor->trace(m_rootNode); |
540 visitor->trace(m_headElement); | 540 visitor->trace(m_headElement); |
541 visitor->trace(m_bodyElement); | 541 visitor->trace(m_bodyElement); |
542 } | 542 } |
543 | 543 |
544 #ifndef NDEBUG | 544 #ifndef NDEBUG |
545 | 545 |
546 void HTMLElementStack::show() { | 546 void HTMLElementStack::show() { |
547 for (ElementRecord* record = m_top.get(); record; record = record->next()) | 547 for (ElementRecord* record = m_top.get(); record; record = record->next()) |
548 LOG(INFO) << *record->element(); | 548 LOG(INFO) << *record->element(); |
549 } | 549 } |
550 | 550 |
551 #endif | 551 #endif |
552 | 552 |
553 } // namespace blink | 553 } // namespace blink |
OLD | NEW |