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

Side by Side Diff: third_party/WebKit/Source/core/editing/serializers/Serialization.cpp

Issue 2532393003: Remove the wrong optimization in replacing a text node with innerHTML (Closed)
Patch Set: use NeedsRebaseline Created 4 years 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 | « third_party/WebKit/LayoutTests/shadow-dom/slotchange.html ('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) 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 DCHECK(container); 706 DCHECK(container);
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!
717 if (containerNode->hasOneTextChild() && fragment->hasOneTextChild()) {
718 toText(containerNode->firstChild())
719 ->setData(toText(fragment->firstChild())->data());
720 return;
721 }
722
723 // FIXME: No need to replace the child it is a text node and its contents are 716 // FIXME: No need to replace the child it is a text node and its contents are
724 // already == text. 717 // already == text.
725 if (containerNode->hasOneChild()) { 718 if (containerNode->hasOneChild()) {
726 containerNode->replaceChild(fragment, containerNode->firstChild(), 719 containerNode->replaceChild(fragment, containerNode->firstChild(),
727 exceptionState); 720 exceptionState);
728 return; 721 return;
729 } 722 }
730 723
731 containerNode->removeChildren(); 724 containerNode->removeChildren();
732 containerNode->appendChild(fragment, exceptionState); 725 containerNode->appendChild(fragment, exceptionState);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 textNode->appendData(textNext->data()); 775 textNode->appendData(textNext->data());
783 if (textNext->parentNode()) // Might have been removed by mutation event. 776 if (textNext->parentNode()) // Might have been removed by mutation event.
784 textNext->remove(exceptionState); 777 textNext->remove(exceptionState);
785 } 778 }
786 779
787 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; 780 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>;
788 template class CORE_TEMPLATE_EXPORT 781 template class CORE_TEMPLATE_EXPORT
789 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>; 782 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>;
790 783
791 } // namespace blink 784 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/slotchange.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698