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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |