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

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

Issue 14629026: Fix an assertion failure in Range::textNodeSplit by Text::splitText. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/Range/split-text-in-range-expected.txt ('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 reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/dom/Text.h" 23 #include "core/dom/Text.h"
24 24
25 #include "core/dom/ExceptionCode.h" 25 #include "core/dom/ExceptionCode.h"
26 #include "core/dom/ExceptionCodePlaceholder.h" 26 #include "core/dom/ExceptionCodePlaceholder.h"
27 #include "core/dom/NodeRenderingContext.h" 27 #include "core/dom/NodeRenderingContext.h"
28 #include "core/dom/ScopedEventQueue.h"
28 #include "core/dom/shadow/ShadowRoot.h" 29 #include "core/dom/shadow/ShadowRoot.h"
29 #include "core/rendering/RenderCombineText.h" 30 #include "core/rendering/RenderCombineText.h"
30 #include "core/rendering/RenderText.h" 31 #include "core/rendering/RenderText.h"
31 32
32 #if ENABLE(SVG) 33 #if ENABLE(SVG)
33 #include "SVGNames.h" 34 #include "SVGNames.h"
34 #include "core/rendering/svg/RenderSVGInlineText.h" 35 #include "core/rendering/svg/RenderSVGInlineText.h"
35 #endif 36 #endif
36 37
37 #include "core/css/resolver/StyleResolver.h" 38 #include "core/css/resolver/StyleResolver.h"
(...skipping 24 matching lines...) Expand all
62 { 63 {
63 ec = 0; 64 ec = 0;
64 65
65 // INDEX_SIZE_ERR: Raised if the specified offset is negative or greater tha n 66 // INDEX_SIZE_ERR: Raised if the specified offset is negative or greater tha n
66 // the number of 16-bit units in data. 67 // the number of 16-bit units in data.
67 if (offset > length()) { 68 if (offset > length()) {
68 ec = INDEX_SIZE_ERR; 69 ec = INDEX_SIZE_ERR;
69 return 0; 70 return 0;
70 } 71 }
71 72
73 EventQueueScope scope;
72 String oldStr = data(); 74 String oldStr = data();
73 RefPtr<Text> newText = cloneWithData(oldStr.substring(offset)); 75 RefPtr<Text> newText = cloneWithData(oldStr.substring(offset));
74 setDataWithoutUpdate(oldStr.substring(0, offset)); 76 setDataWithoutUpdate(oldStr.substring(0, offset));
75 77
76 dispatchModifiedEvent(oldStr); 78 dispatchModifiedEvent(oldStr);
77 79
78 if (parentNode()) 80 if (parentNode())
79 parentNode()->insertBefore(newText.get(), nextSibling(), ec); 81 parentNode()->insertBefore(newText.get(), nextSibling(), ec);
80 if (ec) 82 if (ec)
81 return 0; 83 return 0;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 result.appendLiteral("; "); 349 result.appendLiteral("; ");
348 result.appendLiteral("value="); 350 result.appendLiteral("value=");
349 result.append(s); 351 result.append(s);
350 } 352 }
351 353
352 strncpy(buffer, result.toString().utf8().data(), length - 1); 354 strncpy(buffer, result.toString().utf8().data(), length - 1);
353 } 355 }
354 #endif 356 #endif
355 357
356 } // namespace WebCore 358 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Range/split-text-in-range-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698