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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 379 } |
380 | 380 |
381 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const | 381 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const |
382 { | 382 { |
383 ASSERT(m_top); | 383 ASSERT(m_top); |
384 return m_top.get(); | 384 return m_top.get(); |
385 } | 385 } |
386 | 386 |
387 Element* HTMLElementStack::oneBelowTop() const | 387 Element* HTMLElementStack::oneBelowTop() const |
388 { | 388 { |
389 // We should never be calling this if it could be 0. | 389 // We should never call this if there are fewer than 2 elements on the stack
. |
390 ASSERT(m_top); | 390 ASSERT(m_top); |
391 ASSERT(m_top->next()); | 391 ASSERT(m_top->next()); |
392 return m_top->next()->element(); | 392 if (m_top->next()->node()->isElementNode()) |
| 393 return m_top->next()->element(); |
| 394 return 0; |
393 } | 395 } |
394 | 396 |
395 Element* HTMLElementStack::bottom() const | 397 Element* HTMLElementStack::bottom() const |
396 { | 398 { |
397 return htmlElement(); | 399 return htmlElement(); |
398 } | 400 } |
399 | 401 |
400 void HTMLElementStack::removeHTMLHeadElement(Element* element) | 402 void HTMLElementStack::removeHTMLHeadElement(Element* element) |
401 { | 403 { |
402 ASSERT(m_headElement == element); | 404 ASSERT(m_headElement == element); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 621 |
620 void HTMLElementStack::show() | 622 void HTMLElementStack::show() |
621 { | 623 { |
622 for (ElementRecord* record = m_top.get(); record; record = record->next()) | 624 for (ElementRecord* record = m_top.get(); record; record = record->next()) |
623 record->element()->showNode(); | 625 record->element()->showNode(); |
624 } | 626 } |
625 | 627 |
626 #endif | 628 #endif |
627 | 629 |
628 } | 630 } |
OLD | NEW |