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

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

Issue 2686793002: DOM: Do not skip 'replace data' operation on setting identical string to CharacterData. (Closed)
Patch Set: Created 3 years, 10 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/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.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) 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, 2013 Apple Inc. All 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All
5 * rights reserved. 5 * rights 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 24 matching lines...) Expand all
35 #include "wtf/CheckedNumeric.h" 35 #include "wtf/CheckedNumeric.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 void CharacterData::atomize() { 39 void CharacterData::atomize() {
40 m_data = AtomicString(m_data); 40 m_data = AtomicString(m_data);
41 } 41 }
42 42
43 void CharacterData::setData(const String& data) { 43 void CharacterData::setData(const String& data) {
44 const String& nonNullData = !data.isNull() ? data : emptyString; 44 const String& nonNullData = !data.isNull() ? data : emptyString;
45 if (m_data == nonNullData)
46 return;
47
48 unsigned oldLength = length(); 45 unsigned oldLength = length();
49 46
50 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), 47 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(),
51 UpdateFromNonParser); 48 UpdateFromNonParser);
52 document().didRemoveText(this, 0, oldLength); 49 document().didRemoveText(this, 0, oldLength);
53 } 50 }
54 51
55 String CharacterData::substringData(unsigned offset, 52 String CharacterData::substringData(unsigned offset,
56 unsigned count, 53 unsigned count,
57 ExceptionState& exceptionState) { 54 ExceptionState& exceptionState) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 dispatchSubtreeModifiedEvent(); 219 dispatchSubtreeModifiedEvent();
223 } 220 }
224 InspectorInstrumentation::characterDataModified(this); 221 InspectorInstrumentation::characterDataModified(this);
225 } 222 }
226 223
227 int CharacterData::maxCharacterOffset() const { 224 int CharacterData::maxCharacterOffset() const {
228 return static_cast<int>(length()); 225 return static_cast<int>(length());
229 } 226 }
230 227
231 } // namespace blink 228 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698