| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 while (hasImpliedEndTag(currentStackItem())) | 483 while (hasImpliedEndTag(currentStackItem())) |
| 484 m_openElements.pop(); | 484 m_openElements.pop(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void HTMLConstructionSite::findFosterSite(HTMLConstructionSiteTask& task) | 487 void HTMLConstructionSite::findFosterSite(HTMLConstructionSiteTask& task) |
| 488 { | 488 { |
| 489 #if ENABLE(TEMPLATE_ELEMENT) | 489 #if ENABLE(TEMPLATE_ELEMENT) |
| 490 // When a node is to be foster parented, the last template element with no t
able element is below it in the stack of open elements is the foster parent elem
ent (NOT the template's parent!) | 490 // When a node is to be foster parented, the last template element with no t
able element is below it in the stack of open elements is the foster parent elem
ent (NOT the template's parent!) |
| 491 HTMLElementStack::ElementRecord* lastTemplateElement = m_openElements.topmos
t(templateTag.localName()); | 491 HTMLElementStack::ElementRecord* lastTemplateElement = m_openElements.topmos
t(templateTag.localName()); |
| 492 if (lastTemplateElement && !m_openElements.inTableScope(tableTag)) { | 492 if (lastTemplateElement && !m_openElements.inTableScope(tableTag)) { |
| 493 task.parent = lastTemplateElement->element(); | 493 task.parent = toHTMLTemplateElement(lastTemplateElement->element())->con
tent(); |
| 494 return; | 494 return; |
| 495 } | 495 } |
| 496 |
| 496 #endif | 497 #endif |
| 497 | 498 |
| 498 HTMLElementStack::ElementRecord* lastTableElementRecord = m_openElements.top
most(tableTag.localName()); | 499 HTMLElementStack::ElementRecord* lastTableElementRecord = m_openElements.top
most(tableTag.localName()); |
| 499 if (lastTableElementRecord) { | 500 if (lastTableElementRecord) { |
| 500 Element* lastTableElement = lastTableElementRecord->element(); | 501 Element* lastTableElement = lastTableElementRecord->element(); |
| 501 ContainerNode* parent = lastTableElement->parentNode(); | 502 ContainerNode* parent = lastTableElement->parentNode(); |
| 502 // When parsing HTML fragments, we skip step 4.2 ("Let root be a new htm
l element with no attributes") for efficiency, | 503 // When parsing HTML fragments, we skip step 4.2 ("Let root be a new htm
l element with no attributes") for efficiency, |
| 503 // and instead use the DocumentFragment as a root node. So we must treat
the root node (DocumentFragment) as if it is a html element here. | 504 // and instead use the DocumentFragment as a root node. So we must treat
the root node (DocumentFragment) as if it is a html element here. |
| 504 if (parent && (parent->isElementNode() || (m_isParsingFragment && parent
== m_openElements.rootNode()))) { | 505 if (parent && (parent->isElementNode() || (m_isParsingFragment && parent
== m_openElements.rootNode()))) { |
| 505 task.parent = parent; | 506 task.parent = parent; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 527 task.child = node; | 528 task.child = node; |
| 528 ASSERT(task.parent); | 529 ASSERT(task.parent); |
| 529 | 530 |
| 530 if (task.parent->document() != task.child->document()) | 531 if (task.parent->document() != task.child->document()) |
| 531 task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION); | 532 task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION); |
| 532 | 533 |
| 533 m_attachmentQueue.append(task); | 534 m_attachmentQueue.append(task); |
| 534 } | 535 } |
| 535 | 536 |
| 536 } | 537 } |
| OLD | NEW |