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, 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2014 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 m_fragmentContext.init(fragment, contextElement); | 247 m_fragmentContext.init(fragment, contextElement); |
248 | 248 |
249 // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: | 249 // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: |
250 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fr
agment-case | 250 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fr
agment-case |
251 // For efficiency, we skip step 4.2 ("Let root be a new html element with no | 251 // For efficiency, we skip step 4.2 ("Let root be a new html element with no |
252 // attributes") and instead use the DocumentFragment as a root node. | 252 // attributes") and instead use the DocumentFragment as a root node. |
253 m_tree.openElements()->pushRootNode(HTMLStackItem::create( | 253 m_tree.openElements()->pushRootNode(HTMLStackItem::create( |
254 fragment, HTMLStackItem::ItemForDocumentFragmentNode)); | 254 fragment, HTMLStackItem::ItemForDocumentFragmentNode)); |
255 | 255 |
256 if (isHTMLTemplateElement(*contextElement)) | 256 if (isHTMLTemplateElement(*contextElement)) |
257 m_templateInsertionModes.append(TemplateContentsMode); | 257 m_templateInsertionModes.push_back(TemplateContentsMode); |
258 | 258 |
259 resetInsertionModeAppropriately(); | 259 resetInsertionModeAppropriately(); |
260 } | 260 } |
261 | 261 |
262 HTMLTreeBuilder::~HTMLTreeBuilder() {} | 262 HTMLTreeBuilder::~HTMLTreeBuilder() {} |
263 | 263 |
264 void HTMLTreeBuilder::FragmentParsingContext::init(DocumentFragment* fragment, | 264 void HTMLTreeBuilder::FragmentParsingContext::init(DocumentFragment* fragment, |
265 Element* contextElement) { | 265 Element* contextElement) { |
266 DCHECK(fragment); | 266 DCHECK(fragment); |
267 DCHECK(!fragment->hasChildren()); | 267 DCHECK(!fragment->hasChildren()); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 return; | 844 return; |
845 } | 845 } |
846 m_tree.reconstructTheActiveFormattingElements(); | 846 m_tree.reconstructTheActiveFormattingElements(); |
847 m_tree.insertHTMLElement(token); | 847 m_tree.insertHTMLElement(token); |
848 } | 848 } |
849 | 849 |
850 void HTMLTreeBuilder::processTemplateStartTag(AtomicHTMLToken* token) { | 850 void HTMLTreeBuilder::processTemplateStartTag(AtomicHTMLToken* token) { |
851 m_tree.activeFormattingElements()->appendMarker(); | 851 m_tree.activeFormattingElements()->appendMarker(); |
852 m_tree.insertHTMLElement(token); | 852 m_tree.insertHTMLElement(token); |
853 m_framesetOk = false; | 853 m_framesetOk = false; |
854 m_templateInsertionModes.append(TemplateContentsMode); | 854 m_templateInsertionModes.push_back(TemplateContentsMode); |
855 setInsertionMode(TemplateContentsMode); | 855 setInsertionMode(TemplateContentsMode); |
856 } | 856 } |
857 | 857 |
858 bool HTMLTreeBuilder::processTemplateEndTag(AtomicHTMLToken* token) { | 858 bool HTMLTreeBuilder::processTemplateEndTag(AtomicHTMLToken* token) { |
859 ASSERT(token->name() == templateTag.localName()); | 859 ASSERT(token->name() == templateTag.localName()); |
860 if (!m_tree.openElements()->hasTemplateInHTMLScope()) { | 860 if (!m_tree.openElements()->hasTemplateInHTMLScope()) { |
861 ASSERT(m_templateInsertionModes.isEmpty() || | 861 ASSERT(m_templateInsertionModes.isEmpty() || |
862 (m_templateInsertionModes.size() == 1 && | 862 (m_templateInsertionModes.size() == 1 && |
863 isHTMLTemplateElement(m_fragmentContext.contextElement()))); | 863 isHTMLTemplateElement(m_fragmentContext.contextElement()))); |
864 parseError(token); | 864 parseError(token); |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2754 DEFINE_STRINGIFY(AfterFramesetMode) | 2754 DEFINE_STRINGIFY(AfterFramesetMode) |
2755 DEFINE_STRINGIFY(AfterAfterBodyMode) | 2755 DEFINE_STRINGIFY(AfterAfterBodyMode) |
2756 DEFINE_STRINGIFY(AfterAfterFramesetMode) | 2756 DEFINE_STRINGIFY(AfterAfterFramesetMode) |
2757 #undef DEFINE_STRINGIFY | 2757 #undef DEFINE_STRINGIFY |
2758 } | 2758 } |
2759 return "<unknown>"; | 2759 return "<unknown>"; |
2760 } | 2760 } |
2761 #endif | 2761 #endif |
2762 | 2762 |
2763 } // namespace blink | 2763 } // namespace blink |
OLD | NEW |