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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 void HTMLTreeBuilder::processTemplateStartTag(AtomicHTMLToken* token) | 950 void HTMLTreeBuilder::processTemplateStartTag(AtomicHTMLToken* token) |
951 { | 951 { |
952 m_tree.activeFormattingElements()->appendMarker(); | 952 m_tree.activeFormattingElements()->appendMarker(); |
953 m_tree.insertHTMLElement(token); | 953 m_tree.insertHTMLElement(token); |
954 m_templateInsertionModes.append(TemplateContentsMode); | 954 m_templateInsertionModes.append(TemplateContentsMode); |
955 setInsertionMode(TemplateContentsMode); | 955 setInsertionMode(TemplateContentsMode); |
956 } | 956 } |
957 | 957 |
958 void HTMLTreeBuilder::processTemplateEndTag(AtomicHTMLToken* token) | 958 void HTMLTreeBuilder::processTemplateEndTag(AtomicHTMLToken* token) |
959 { | 959 { |
960 if (!m_tree.openElements()->inScope(token->name())) { | 960 if (!m_tree.openElements()->hasTemplateInHTMLScope()) { |
| 961 ASSERT(m_templateInsertionModes.isEmpty()); |
961 parseError(token); | 962 parseError(token); |
962 return; | 963 return; |
963 } | 964 } |
964 m_tree.generateImpliedEndTags(); | 965 m_tree.generateImpliedEndTags(); |
965 if (!m_tree.currentStackItem()->hasLocalName(token->name())) | 966 if (!m_tree.currentStackItem()->hasLocalName(token->name())) |
966 parseError(token); | 967 parseError(token); |
967 m_tree.openElements()->popUntilPopped(token->name()); | 968 m_tree.openElements()->popUntilPopped(token->name()); |
968 m_tree.activeFormattingElements()->clearToLastMarker(); | 969 m_tree.activeFormattingElements()->clearToLastMarker(); |
969 m_templateInsertionModes.removeLast(); | 970 m_templateInsertionModes.removeLast(); |
970 resetInsertionModeAppropriately(); | 971 resetInsertionModeAppropriately(); |
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 ASSERT(m_isAttached); | 2932 ASSERT(m_isAttached); |
2932 // Warning, this may detach the parser. Do not do anything else after this. | 2933 // Warning, this may detach the parser. Do not do anything else after this. |
2933 m_tree.finishedParsing(); | 2934 m_tree.finishedParsing(); |
2934 } | 2935 } |
2935 | 2936 |
2936 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2937 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
2937 { | 2938 { |
2938 } | 2939 } |
2939 | 2940 |
2940 } | 2941 } |
OLD | NEW |