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

Side by Side Diff: third_party/WebKit/Source/core/dom/Text.cpp

Issue 2644063002: Make SynchronousMutationObserver::didMergeTextNodes() to take both merged and merging nodes (Closed)
Patch Set: 2017-01-19T17:22:18 Created 3 years, 11 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 | « third_party/WebKit/Source/core/dom/SynchronousMutationObserver.cpp ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 continue; 75 continue;
76 } 76 }
77 77
78 // Both non-empty text nodes. Merge them. 78 // Both non-empty text nodes. Merge them.
79 unsigned offset = length(); 79 unsigned offset = length();
80 String nextTextData = nextText->data(); 80 String nextTextData = nextText->data();
81 String oldTextData = data(); 81 String oldTextData = data();
82 setDataWithoutUpdate(data() + nextTextData); 82 setDataWithoutUpdate(data() + nextTextData);
83 updateTextLayoutObject(oldTextData.length(), 0); 83 updateTextLayoutObject(oldTextData.length(), 0);
84 84
85 document().didMergeTextNodes(*this, *nextText, offset);
86
85 // Empty nextText for layout update. 87 // Empty nextText for layout update.
86 nextText->setDataWithoutUpdate(emptyString()); 88 nextText->setDataWithoutUpdate(emptyString());
87 nextText->updateTextLayoutObject(0, nextTextData.length()); 89 nextText->updateTextLayoutObject(0, nextTextData.length());
88 90
89 document().didMergeTextNodes(*nextText, offset);
90
91 // Restore nextText for mutation event. 91 // Restore nextText for mutation event.
92 nextText->setDataWithoutUpdate(nextTextData); 92 nextText->setDataWithoutUpdate(nextTextData);
93 nextText->updateTextLayoutObject(0, 0); 93 nextText->updateTextLayoutObject(0, 0);
94 94
95 document().incDOMTreeVersion(); 95 document().incDOMTreeVersion();
96 didModifyData(oldTextData, CharacterData::UpdateFromNonParser); 96 didModifyData(oldTextData, CharacterData::UpdateFromNonParser);
97 nextText->remove(IGNORE_EXCEPTION_FOR_TESTING); 97 nextText->remove(IGNORE_EXCEPTION_FOR_TESTING);
98 } 98 }
99 99
100 return NodeTraversal::nextPostOrder(*this); 100 return NodeTraversal::nextPostOrder(*this);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 Text* Text::cloneWithData(const String& data) { 450 Text* Text::cloneWithData(const String& data) {
451 return create(document(), data); 451 return create(document(), data);
452 } 452 }
453 453
454 DEFINE_TRACE(Text) { 454 DEFINE_TRACE(Text) {
455 CharacterData::trace(visitor); 455 CharacterData::trace(visitor);
456 } 456 }
457 457
458 } // namespace blink 458 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/SynchronousMutationObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698