| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 static inline bool isAllWhitespace(const String& string) | 65 static inline bool isAllWhitespace(const String& string) |
| 66 { | 66 { |
| 67 return string.isAllSpecialCharacters<isHTMLSpace<UChar> >(); | 67 return string.isAllSpecialCharacters<isHTMLSpace<UChar> >(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static inline void insert(HTMLConstructionSiteTask& task) | 70 static inline void insert(HTMLConstructionSiteTask& task) |
| 71 { | 71 { |
| 72 if (isHTMLTemplateElement(*task.parent)) | 72 if (isHTMLTemplateElement(*task.parent)) |
| 73 task.parent = toHTMLTemplateElement(task.parent.get())->content(); | 73 task.parent = toHTMLTemplateElement(task.parent.get())->content(); |
| 74 | |
| 75 if (ContainerNode* parent = task.child->parentNode()) | |
| 76 parent->parserRemoveChild(*task.child); | |
| 77 | |
| 78 task.parent->parserAppendChild(task.child.get()); | 74 task.parent->parserAppendChild(task.child.get()); |
| 79 } | 75 } |
| 80 | 76 |
| 81 static inline void executeInsertTask(HTMLConstructionSiteTask& task) | 77 static inline void executeInsertTask(HTMLConstructionSiteTask& task) |
| 82 { | 78 { |
| 83 ASSERT(task.operation == HTMLConstructionSiteTask::Insert); | 79 ASSERT(task.operation == HTMLConstructionSiteTask::Insert); |
| 84 | 80 |
| 85 insert(task); | 81 insert(task); |
| 86 | 82 |
| 87 if (task.child->isElementNode()) { | 83 if (task.child->isElementNode()) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 338 |
| 343 PassRefPtr<HTMLElement> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken*
token) | 339 PassRefPtr<HTMLElement> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken*
token) |
| 344 { | 340 { |
| 345 Document& document = ownerDocumentForCurrentNode(); | 341 Document& document = ownerDocumentForCurrentNode(); |
| 346 RefPtr<HTMLElement> element = HTMLElementFactory::createHTMLElement(token->n
ame(), document, true); | 342 RefPtr<HTMLElement> element = HTMLElementFactory::createHTMLElement(token->n
ame(), document, true); |
| 347 setAttributes(element.get(), token); | 343 setAttributes(element.get(), token); |
| 348 return element.release(); | 344 return element.release(); |
| 349 } | 345 } |
| 350 | 346 |
| 351 } | 347 } |
| OLD | NEW |