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

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

Issue 23513013: Have Text constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 | Annotate | Revision Log
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 Node* previousChild = task.nextChild ? task.nextChild->previousSibling() : t ask.parent->lastChild(); 549 Node* previousChild = task.nextChild ? task.nextChild->previousSibling() : t ask.parent->lastChild();
550 if (previousChild && previousChild->isTextNode()) { 550 if (previousChild && previousChild->isTextNode()) {
551 // FIXME: We're only supposed to append to this text node if it 551 // FIXME: We're only supposed to append to this text node if it
552 // was the last text node inserted by the parser. 552 // was the last text node inserted by the parser.
553 CharacterData* textNode = static_cast<CharacterData*>(previousChild); 553 CharacterData* textNode = static_cast<CharacterData*>(previousChild);
554 currentPosition = textNode->parserAppendData(characters, 0, lengthLimit) ; 554 currentPosition = textNode->parserAppendData(characters, 0, lengthLimit) ;
555 } 555 }
556 556
557 while (currentPosition < characters.length()) { 557 while (currentPosition < characters.length()) {
558 RefPtr<Text> textNode = Text::createWithLengthLimit(&task.parent->docume nt(), shouldUseAtomicString ? AtomicString(characters).string() : characters, cu rrentPosition, lengthLimit); 558 RefPtr<Text> textNode = Text::createWithLengthLimit(task.parent->documen t(), shouldUseAtomicString ? AtomicString(characters).string() : characters, cur rentPosition, lengthLimit);
559 // 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. 559 // 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.
560 if (!textNode->length()) { 560 if (!textNode->length()) {
561 String substring = characters.substring(currentPosition); 561 String substring = characters.substring(currentPosition);
562 textNode = Text::create(&task.parent->document(), shouldUseAtomicStr ing ? AtomicString(substring).string() : substring); 562 textNode = Text::create(task.parent->document(), shouldUseAtomicStri ng ? AtomicString(substring).string() : substring);
563 } 563 }
564 564
565 currentPosition += textNode->length(); 565 currentPosition += textNode->length();
566 ASSERT(currentPosition <= characters.length()); 566 ASSERT(currentPosition <= characters.length());
567 task.child = textNode.release(); 567 task.child = textNode.release();
568 568
569 executeTask(task); 569 executeTask(task);
570 } 570 }
571 } 571 }
572 572
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 { 744 {
745 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); 745 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
746 findFosterSite(task); 746 findFosterSite(task);
747 task.child = node; 747 task.child = node;
748 ASSERT(task.parent); 748 ASSERT(task.parent);
749 749
750 m_taskQueue.append(task); 750 m_taskQueue.append(task);
751 } 751 }
752 752
753 } 753 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLViewSourceDocument.cpp ('k') | Source/core/html/shadow/DateTimeEditElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698