Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2011 Igalia S.L. | 5 * Copyright (C) 2011 Igalia S.L. |
| 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 ContainerNode* containerNode(container); | 707 ContainerNode* containerNode(container); |
| 708 | 708 |
| 709 ChildListMutationScope mutation(*containerNode); | 709 ChildListMutationScope mutation(*containerNode); |
| 710 | 710 |
| 711 if (!fragment->firstChild()) { | 711 if (!fragment->firstChild()) { |
| 712 containerNode->removeChildren(); | 712 containerNode->removeChildren(); |
| 713 return; | 713 return; |
| 714 } | 714 } |
| 715 | 715 |
| 716 // FIXME: This is wrong if containerNode->firstChild() has more than one ref! | 716 // FIXME: This is wrong if containerNode->firstChild() has more than one ref! |
| 717 if (containerNode->hasOneTextChild() && fragment->hasOneTextChild()) { | 717 if (containerNode->hasOneTextChild() && fragment->hasOneTextChild()) { |
|
tkent
2016/11/30 03:50:25
We should remove this block. This is a wrong opti
hayato
2016/11/30 05:22:55
Agreed. I removed this optimization.
| |
| 718 containerNode->firstChild()->checkSlotChangeBeforeRemoved(); | |
| 718 toText(containerNode->firstChild()) | 719 toText(containerNode->firstChild()) |
| 719 ->setData(toText(fragment->firstChild())->data()); | 720 ->setData(toText(fragment->firstChild())->data()); |
| 721 containerNode->firstChild()->checkSlotChangeAfterInserted(); | |
| 720 return; | 722 return; |
| 721 } | 723 } |
| 722 | 724 |
| 723 // FIXME: No need to replace the child it is a text node and its contents are | 725 // FIXME: No need to replace the child it is a text node and its contents are |
| 724 // already == text. | 726 // already == text. |
| 725 if (containerNode->hasOneChild()) { | 727 if (containerNode->hasOneChild()) { |
| 726 containerNode->replaceChild(fragment, containerNode->firstChild(), | 728 containerNode->replaceChild(fragment, containerNode->firstChild(), |
| 727 exceptionState); | 729 exceptionState); |
| 728 return; | 730 return; |
| 729 } | 731 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 782 textNode->appendData(textNext->data()); | 784 textNode->appendData(textNext->data()); |
| 783 if (textNext->parentNode()) // Might have been removed by mutation event. | 785 if (textNext->parentNode()) // Might have been removed by mutation event. |
| 784 textNext->remove(exceptionState); | 786 textNext->remove(exceptionState); |
| 785 } | 787 } |
| 786 | 788 |
| 787 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; | 789 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; |
| 788 template class CORE_TEMPLATE_EXPORT | 790 template class CORE_TEMPLATE_EXPORT |
| 789 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>; | 791 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>; |
| 790 | 792 |
| 791 } // namespace blink | 793 } // namespace blink |
| OLD | NEW |