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

Side by Side Diff: Source/WebCore/editing/ReplaceSelectionCommand.cpp

Issue 7780011: Merge 94793 - Crashes in WebCore::ReplaceSelectionCommand::doApply (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 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 | « LayoutTests/editing/inserting/insert-without-enclosing-block-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) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 987
988 VisiblePosition startOfInsertedContent, endOfInsertedContent; 988 VisiblePosition startOfInsertedContent, endOfInsertedContent;
989 989
990 RefPtr<Node> refNode = fragment.firstChild(); 990 RefPtr<Node> refNode = fragment.firstChild();
991 RefPtr<Node> node = refNode->nextSibling(); 991 RefPtr<Node> node = refNode->nextSibling();
992 992
993 fragment.removeNode(refNode); 993 fragment.removeNode(refNode);
994 994
995 Node* blockStart = enclosingBlock(insertionPos.deprecatedNode()); 995 Node* blockStart = enclosingBlock(insertionPos.deprecatedNode());
996 if ((isListElement(refNode.get()) || (isLegacyAppleStyleSpan(refNode.get()) && isListElement(refNode->firstChild()))) 996 if ((isListElement(refNode.get()) || (isLegacyAppleStyleSpan(refNode.get()) && isListElement(refNode->firstChild())))
997 && blockStart->renderer()->isListItem()) 997 && blockStart && blockStart->renderer()->isListItem())
998 refNode = insertAsListItems(refNode, blockStart, insertionPos); 998 refNode = insertAsListItems(refNode, blockStart, insertionPos);
999 else 999 else
1000 insertNodeAtAndUpdateNodesInserted(refNode, insertionPos); 1000 insertNodeAtAndUpdateNodesInserted(refNode, insertionPos);
1001 1001
1002 // Mutation events (bug 22634) may have already removed the inserted content 1002 // Mutation events (bug 22634) may have already removed the inserted content
1003 if (!refNode->inDocument()) 1003 if (!refNode->inDocument())
1004 return; 1004 return;
1005 1005
1006 bool plainTextFragment = isPlainTextMarkup(refNode.get()); 1006 bool plainTextFragment = isPlainTextMarkup(refNode.get());
1007 1007
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 return false; 1327 return false;
1328 1328
1329 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1329 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1330 1330
1331 setEndingSelection(selectionAfterReplace); 1331 setEndingSelection(selectionAfterReplace);
1332 1332
1333 return true; 1333 return true;
1334 } 1334 }
1335 1335
1336 } // namespace WebCore 1336 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/inserting/insert-without-enclosing-block-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698