| 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 13 matching lines...) Expand all Loading... |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/html/parser/HTMLElementStack.h" | 27 #include "core/html/parser/HTMLElementStack.h" |
| 28 | 28 |
| 29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
| 30 #include "core/MathMLNames.h" | 30 #include "core/MathMLNames.h" |
| 31 #include "core/SVGNames.h" | 31 #include "core/SVGNames.h" |
| 32 #include "core/dom/Element.h" | 32 #include "core/dom/Element.h" |
| 33 #include "core/html/HTMLElement.h" | 33 #include "core/html/HTMLElement.h" |
| 34 #include "core/html/HTMLFormControlElement.h" |
| 35 #include "core/html/HTMLSelectElement.h" |
| 34 | 36 |
| 35 namespace blink { | 37 namespace blink { |
| 36 | 38 |
| 37 using namespace HTMLNames; | 39 using namespace HTMLNames; |
| 38 | 40 |
| 39 namespace { | 41 namespace { |
| 40 | 42 |
| 41 inline bool isRootNode(HTMLStackItem* item) { | 43 inline bool isRootNode(HTMLStackItem* item) { |
| 42 return item->isDocumentFragmentNode() || item->hasTagName(htmlTag); | 44 return item->isDocumentFragmentNode() || item->hasTagName(htmlTag); |
| 43 } | 45 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 popCommon(); | 158 popCommon(); |
| 157 } | 159 } |
| 158 | 160 |
| 159 void HTMLElementStack::popAll() { | 161 void HTMLElementStack::popAll() { |
| 160 m_rootNode = nullptr; | 162 m_rootNode = nullptr; |
| 161 m_headElement = nullptr; | 163 m_headElement = nullptr; |
| 162 m_bodyElement = nullptr; | 164 m_bodyElement = nullptr; |
| 163 m_stackDepth = 0; | 165 m_stackDepth = 0; |
| 164 while (m_top) { | 166 while (m_top) { |
| 165 Node& node = *topNode(); | 167 Node& node = *topNode(); |
| 166 if (node.isElementNode()) | 168 if (node.isElementNode()) { |
| 167 toElement(node).finishParsingChildren(); | 169 toElement(node).finishParsingChildren(); |
| 170 if (isHTMLSelectElement(node)) |
| 171 toHTMLFormControlElement(node).setBlocksFormSubmission(true); |
| 172 } |
| 168 m_top = m_top->releaseNext(); | 173 m_top = m_top->releaseNext(); |
| 169 } | 174 } |
| 170 } | 175 } |
| 171 | 176 |
| 172 void HTMLElementStack::pop() { | 177 void HTMLElementStack::pop() { |
| 173 ASSERT(!topStackItem()->hasTagName(HTMLNames::headTag)); | 178 ASSERT(!topStackItem()->hasTagName(HTMLNames::headTag)); |
| 174 popCommon(); | 179 popCommon(); |
| 175 } | 180 } |
| 176 | 181 |
| 177 void HTMLElementStack::popUntil(const AtomicString& tagName) { | 182 void HTMLElementStack::popUntil(const AtomicString& tagName) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 #ifndef NDEBUG | 544 #ifndef NDEBUG |
| 540 | 545 |
| 541 void HTMLElementStack::show() { | 546 void HTMLElementStack::show() { |
| 542 for (ElementRecord* record = m_top.get(); record; record = record->next()) | 547 for (ElementRecord* record = m_top.get(); record; record = record->next()) |
| 543 LOG(INFO) << *record->element(); | 548 LOG(INFO) << *record->element(); |
| 544 } | 549 } |
| 545 | 550 |
| 546 #endif | 551 #endif |
| 547 | 552 |
| 548 } // namespace blink | 553 } // namespace blink |
| OLD | NEW |