Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: Source/WebCore/html/parser/HTMLConstructionSite.cpp

Issue 12088052: Merge 140101 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/parser/foster-parent-adopted2-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 RefPtr<Text> textNode = Text::createWithLengthLimit(task.parent->documen t(), shouldUseAtomicString ? AtomicString(characters).string() : characters, cur rentPosition); 384 RefPtr<Text> textNode = Text::createWithLengthLimit(task.parent->documen t(), shouldUseAtomicString ? AtomicString(characters).string() : characters, cur rentPosition);
385 // If we have a whole string of unbreakable characters the above could l ead to an infinite loop. Exceeding the length limit is the lesser evil. 385 // If we have a whole string of unbreakable characters the above could l ead to an infinite loop. Exceeding the length limit is the lesser evil.
386 if (!textNode->length()) { 386 if (!textNode->length()) {
387 String substring = characters.substring(currentPosition); 387 String substring = characters.substring(currentPosition);
388 textNode = Text::create(task.parent->document(), shouldUseAtomicStri ng ? AtomicString(substring).string() : substring); 388 textNode = Text::create(task.parent->document(), shouldUseAtomicStri ng ? AtomicString(substring).string() : substring);
389 } 389 }
390 390
391 currentPosition += textNode->length(); 391 currentPosition += textNode->length();
392 ASSERT(currentPosition <= characters.length()); 392 ASSERT(currentPosition <= characters.length());
393 task.child = textNode.release(); 393 task.child = textNode.release();
394
395 if (task.parent->document() != task.child->document())
396 task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION);
397
394 executeTask(task); 398 executeTask(task);
395 } 399 }
396 } 400 }
397 401
398 PassRefPtr<Element> HTMLConstructionSite::createElement(AtomicHTMLToken* token, const AtomicString& namespaceURI) 402 PassRefPtr<Element> HTMLConstructionSite::createElement(AtomicHTMLToken* token, const AtomicString& namespaceURI)
399 { 403 {
400 QualifiedName tagName(nullAtom, token->name(), namespaceURI); 404 QualifiedName tagName(nullAtom, token->name(), namespaceURI);
401 RefPtr<Element> element = ownerDocumentForCurrentNode()->createElement(tagNa me, true); 405 RefPtr<Element> element = ownerDocumentForCurrentNode()->createElement(tagNa me, true);
402 element->parserSetAttributes(token->attributes(), m_fragmentScriptingPermiss ion); 406 element->parserSetAttributes(token->attributes(), m_fragmentScriptingPermiss ion);
403 return element.release(); 407 return element.release();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 && currentStackItem()->isElementNode() 519 && currentStackItem()->isElementNode()
516 && currentStackItem()->causesFosterParenting(); 520 && currentStackItem()->causesFosterParenting();
517 } 521 }
518 522
519 void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node) 523 void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node)
520 { 524 {
521 HTMLConstructionSiteTask task; 525 HTMLConstructionSiteTask task;
522 findFosterSite(task); 526 findFosterSite(task);
523 task.child = node; 527 task.child = node;
524 ASSERT(task.parent); 528 ASSERT(task.parent);
529
530 if (task.parent->document() != task.child->document())
531 task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION);
532
525 m_attachmentQueue.append(task); 533 m_attachmentQueue.append(task);
526 } 534 }
527 535
528 } 536 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/parser/foster-parent-adopted2-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698