| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 , m_fragmentContext(fragment, contextElement) | 288 , m_fragmentContext(fragment, contextElement) |
| 289 , m_tree(fragment, parserContentPolicy) | 289 , m_tree(fragment, parserContentPolicy) |
| 290 , m_insertionMode(InitialMode) | 290 , m_insertionMode(InitialMode) |
| 291 , m_originalInsertionMode(InitialMode) | 291 , m_originalInsertionMode(InitialMode) |
| 292 , m_shouldSkipLeadingNewline(false) | 292 , m_shouldSkipLeadingNewline(false) |
| 293 , m_parser(parser) | 293 , m_parser(parser) |
| 294 , m_scriptToProcessStartPosition(uninitializedPositionValue1()) | 294 , m_scriptToProcessStartPosition(uninitializedPositionValue1()) |
| 295 , m_options(options) | 295 , m_options(options) |
| 296 { | 296 { |
| 297 ASSERT(isMainThread()); | 297 ASSERT(isMainThread()); |
| 298 // FIXME: This assertion will become invalid if <http://webkit.org/b/60316>
is fixed. | |
| 299 ASSERT(contextElement); | 298 ASSERT(contextElement); |
| 300 if (contextElement) { | |
| 301 // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: | |
| 302 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.h
tml#fragment-case | |
| 303 // For efficiency, we skip step 4.2 ("Let root be a new html element wit
h no attributes") | |
| 304 // and instead use the DocumentFragment as a root node. | |
| 305 m_tree.openElements()->pushRootNode(HTMLStackItem::create(fragment, HTML
StackItem::ItemForDocumentFragmentNode)); | |
| 306 | 299 |
| 307 if (isHTMLTemplateElement(*contextElement)) | 300 // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: |
| 308 m_templateInsertionModes.append(TemplateContentsMode); | 301 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#
fragment-case |
| 302 // For efficiency, we skip step 4.2 ("Let root be a new html element with no
attributes") |
| 303 // and instead use the DocumentFragment as a root node. |
| 304 m_tree.openElements()->pushRootNode(HTMLStackItem::create(fragment, HTMLStac
kItem::ItemForDocumentFragmentNode)); |
| 309 | 305 |
| 310 resetInsertionModeAppropriately(); | 306 if (isHTMLTemplateElement(*contextElement)) |
| 311 m_tree.setForm(closestFormAncestor(*contextElement)); | 307 m_templateInsertionModes.append(TemplateContentsMode); |
| 312 } | 308 |
| 309 resetInsertionModeAppropriately(); |
| 310 m_tree.setForm(closestFormAncestor(*contextElement)); |
| 313 } | 311 } |
| 314 | 312 |
| 315 HTMLTreeBuilder::~HTMLTreeBuilder() | 313 HTMLTreeBuilder::~HTMLTreeBuilder() |
| 316 { | 314 { |
| 317 } | 315 } |
| 318 | 316 |
| 319 void HTMLTreeBuilder::trace(Visitor* visitor) | 317 void HTMLTreeBuilder::trace(Visitor* visitor) |
| 320 { | 318 { |
| 321 visitor->trace(m_fragmentContext); | 319 visitor->trace(m_fragmentContext); |
| 322 visitor->trace(m_tree); | 320 visitor->trace(m_tree); |
| (...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 ASSERT(m_isAttached); | 2794 ASSERT(m_isAttached); |
| 2797 // Warning, this may detach the parser. Do not do anything else after this. | 2795 // Warning, this may detach the parser. Do not do anything else after this. |
| 2798 m_tree.finishedParsing(); | 2796 m_tree.finishedParsing(); |
| 2799 } | 2797 } |
| 2800 | 2798 |
| 2801 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2799 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
| 2802 { | 2800 { |
| 2803 } | 2801 } |
| 2804 | 2802 |
| 2805 } // namespace WebCore | 2803 } // namespace WebCore |
| OLD | NEW |