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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLElementStack.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 inline bool isSelectScopeMarker(HTMLStackItem* item) 113 inline bool isSelectScopeMarker(HTMLStackItem* item)
114 { 114 {
115 return !item->hasTagName(optgroupTag) 115 return !item->hasTagName(optgroupTag)
116 && !item->hasTagName(optionTag); 116 && !item->hasTagName(optionTag);
117 } 117 }
118 118
119 } // namespace 119 } // namespace
120 120
121 HTMLElementStack::ElementRecord::ElementRecord(PassRefPtrWillBeRawPtr<HTMLStackI tem> item, PassOwnPtrWillBeRawPtr<ElementRecord> next) 121 HTMLElementStack::ElementRecord::ElementRecord(RawPtr<HTMLStackItem> item, RawPt r<ElementRecord> next)
122 : m_item(item) 122 : m_item(item)
123 , m_next(next) 123 , m_next(next)
124 { 124 {
125 ASSERT(m_item); 125 ASSERT(m_item);
126 } 126 }
127 127
128 #if !ENABLE(OILPAN) 128 #if !ENABLE(OILPAN)
129 HTMLElementStack::ElementRecord::~ElementRecord() 129 HTMLElementStack::ElementRecord::~ElementRecord()
130 { 130 {
131 } 131 }
132 #endif 132 #endif
133 133
134 void HTMLElementStack::ElementRecord::replaceElement(PassRefPtrWillBeRawPtr<HTML StackItem> item) 134 void HTMLElementStack::ElementRecord::replaceElement(RawPtr<HTMLStackItem> item)
135 { 135 {
136 ASSERT(item); 136 ASSERT(item);
137 ASSERT(!m_item || m_item->isElementNode()); 137 ASSERT(!m_item || m_item->isElementNode());
138 // FIXME: Should this call finishParsingChildren? 138 // FIXME: Should this call finishParsingChildren?
139 m_item = item; 139 m_item = item;
140 } 140 }
141 141
142 bool HTMLElementStack::ElementRecord::isAbove(ElementRecord* other) const 142 bool HTMLElementStack::ElementRecord::isAbove(ElementRecord* other) const
143 { 143 {
144 for (ElementRecord* below = next(); below; below = below->next()) { 144 for (ElementRecord* below = next(); below; below = below->next()) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 || item->hasTagName(SVGNames::descTag) 303 || item->hasTagName(SVGNames::descTag)
304 || item->hasTagName(SVGNames::titleTag); 304 || item->hasTagName(SVGNames::titleTag);
305 } 305 }
306 306
307 void HTMLElementStack::popUntilForeignContentScopeMarker() 307 void HTMLElementStack::popUntilForeignContentScopeMarker()
308 { 308 {
309 while (!isForeignContentScopeMarker(topStackItem())) 309 while (!isForeignContentScopeMarker(topStackItem()))
310 pop(); 310 pop();
311 } 311 }
312 312
313 void HTMLElementStack::pushRootNode(PassRefPtrWillBeRawPtr<HTMLStackItem> rootIt em) 313 void HTMLElementStack::pushRootNode(RawPtr<HTMLStackItem> rootItem)
314 { 314 {
315 ASSERT(rootItem->isDocumentFragmentNode()); 315 ASSERT(rootItem->isDocumentFragmentNode());
316 pushRootNodeCommon(rootItem); 316 pushRootNodeCommon(rootItem);
317 } 317 }
318 318
319 void HTMLElementStack::pushHTMLHtmlElement(PassRefPtrWillBeRawPtr<HTMLStackItem> item) 319 void HTMLElementStack::pushHTMLHtmlElement(RawPtr<HTMLStackItem> item)
320 { 320 {
321 ASSERT(item->hasTagName(htmlTag)); 321 ASSERT(item->hasTagName(htmlTag));
322 pushRootNodeCommon(item); 322 pushRootNodeCommon(item);
323 } 323 }
324 324
325 void HTMLElementStack::pushRootNodeCommon(PassRefPtrWillBeRawPtr<HTMLStackItem> rootItem) 325 void HTMLElementStack::pushRootNodeCommon(RawPtr<HTMLStackItem> rootItem)
326 { 326 {
327 ASSERT(!m_top); 327 ASSERT(!m_top);
328 ASSERT(!m_rootNode); 328 ASSERT(!m_rootNode);
329 m_rootNode = rootItem->node(); 329 m_rootNode = rootItem->node();
330 pushCommon(rootItem); 330 pushCommon(rootItem);
331 } 331 }
332 332
333 void HTMLElementStack::pushHTMLHeadElement(PassRefPtrWillBeRawPtr<HTMLStackItem> item) 333 void HTMLElementStack::pushHTMLHeadElement(RawPtr<HTMLStackItem> item)
334 { 334 {
335 ASSERT(item->hasTagName(HTMLNames::headTag)); 335 ASSERT(item->hasTagName(HTMLNames::headTag));
336 ASSERT(!m_headElement); 336 ASSERT(!m_headElement);
337 m_headElement = item->element(); 337 m_headElement = item->element();
338 pushCommon(item); 338 pushCommon(item);
339 } 339 }
340 340
341 void HTMLElementStack::pushHTMLBodyElement(PassRefPtrWillBeRawPtr<HTMLStackItem> item) 341 void HTMLElementStack::pushHTMLBodyElement(RawPtr<HTMLStackItem> item)
342 { 342 {
343 ASSERT(item->hasTagName(HTMLNames::bodyTag)); 343 ASSERT(item->hasTagName(HTMLNames::bodyTag));
344 ASSERT(!m_bodyElement); 344 ASSERT(!m_bodyElement);
345 m_bodyElement = item->element(); 345 m_bodyElement = item->element();
346 pushCommon(item); 346 pushCommon(item);
347 } 347 }
348 348
349 void HTMLElementStack::push(PassRefPtrWillBeRawPtr<HTMLStackItem> item) 349 void HTMLElementStack::push(RawPtr<HTMLStackItem> item)
350 { 350 {
351 ASSERT(!item->hasTagName(htmlTag)); 351 ASSERT(!item->hasTagName(htmlTag));
352 ASSERT(!item->hasTagName(headTag)); 352 ASSERT(!item->hasTagName(headTag));
353 ASSERT(!item->hasTagName(bodyTag)); 353 ASSERT(!item->hasTagName(bodyTag));
354 ASSERT(m_rootNode); 354 ASSERT(m_rootNode);
355 pushCommon(item); 355 pushCommon(item);
356 } 356 }
357 357
358 void HTMLElementStack::insertAbove(PassRefPtrWillBeRawPtr<HTMLStackItem> item, E lementRecord* recordBelow) 358 void HTMLElementStack::insertAbove(RawPtr<HTMLStackItem> item, ElementRecord* re cordBelow)
359 { 359 {
360 ASSERT(item); 360 ASSERT(item);
361 ASSERT(recordBelow); 361 ASSERT(recordBelow);
362 ASSERT(m_top); 362 ASSERT(m_top);
363 ASSERT(!item->hasTagName(htmlTag)); 363 ASSERT(!item->hasTagName(htmlTag));
364 ASSERT(!item->hasTagName(headTag)); 364 ASSERT(!item->hasTagName(headTag));
365 ASSERT(!item->hasTagName(bodyTag)); 365 ASSERT(!item->hasTagName(bodyTag));
366 ASSERT(m_rootNode); 366 ASSERT(m_rootNode);
367 if (recordBelow == m_top) { 367 if (recordBelow == m_top) {
368 push(item); 368 push(item);
369 return; 369 return;
370 } 370 }
371 371
372 for (ElementRecord* recordAbove = m_top.get(); recordAbove; recordAbove = re cordAbove->next()) { 372 for (ElementRecord* recordAbove = m_top.get(); recordAbove; recordAbove = re cordAbove->next()) {
373 if (recordAbove->next() != recordBelow) 373 if (recordAbove->next() != recordBelow)
374 continue; 374 continue;
375 375
376 m_stackDepth++; 376 m_stackDepth++;
377 recordAbove->setNext(adoptPtrWillBeNoop(new ElementRecord(item, recordAb ove->releaseNext()))); 377 recordAbove->setNext(new ElementRecord(item, recordAbove->releaseNext()) );
378 recordAbove->next()->element()->beginParsingChildren(); 378 recordAbove->next()->element()->beginParsingChildren();
379 return; 379 return;
380 } 380 }
381 ASSERT_NOT_REACHED(); 381 ASSERT_NOT_REACHED();
382 } 382 }
383 383
384 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const 384 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const
385 { 385 {
386 ASSERT(m_top); 386 ASSERT(m_top);
387 return m_top.get(); 387 return m_top.get();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 ASSERT(m_bodyElement); 558 ASSERT(m_bodyElement);
559 return m_bodyElement; 559 return m_bodyElement;
560 } 560 }
561 561
562 ContainerNode* HTMLElementStack::rootNode() const 562 ContainerNode* HTMLElementStack::rootNode() const
563 { 563 {
564 ASSERT(m_rootNode); 564 ASSERT(m_rootNode);
565 return m_rootNode; 565 return m_rootNode;
566 } 566 }
567 567
568 void HTMLElementStack::pushCommon(PassRefPtrWillBeRawPtr<HTMLStackItem> item) 568 void HTMLElementStack::pushCommon(RawPtr<HTMLStackItem> item)
569 { 569 {
570 ASSERT(m_rootNode); 570 ASSERT(m_rootNode);
571 571
572 m_stackDepth++; 572 m_stackDepth++;
573 m_top = adoptPtrWillBeNoop(new ElementRecord(item, m_top.release())); 573 m_top = new ElementRecord(item, m_top.release());
574 } 574 }
575 575
576 void HTMLElementStack::popCommon() 576 void HTMLElementStack::popCommon()
577 { 577 {
578 ASSERT(!topStackItem()->hasTagName(htmlTag)); 578 ASSERT(!topStackItem()->hasTagName(htmlTag));
579 ASSERT(!topStackItem()->hasTagName(headTag) || !m_headElement); 579 ASSERT(!topStackItem()->hasTagName(headTag) || !m_headElement);
580 ASSERT(!topStackItem()->hasTagName(bodyTag) || !m_bodyElement); 580 ASSERT(!topStackItem()->hasTagName(bodyTag) || !m_bodyElement);
581 top()->finishParsingChildren(); 581 top()->finishParsingChildren();
582 m_top = m_top->releaseNext(); 582 m_top = m_top->releaseNext();
583 583
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 void HTMLElementStack::show() 628 void HTMLElementStack::show()
629 { 629 {
630 for (ElementRecord* record = m_top.get(); record; record = record->next()) 630 for (ElementRecord* record = m_top.get(); record; record = record->next())
631 record->element()->showNode(); 631 record->element()->showNode();
632 } 632 }
633 633
634 #endif 634 #endif
635 635
636 } // namespace blink 636 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698