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

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

Issue 10408066: Merge 116545 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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
« no previous file with comments | « LayoutTests/editing/inserting/insert-html-crash-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 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 return false; 1329 return false;
1330 1330
1331 // FIXME: Would be nice to handle smart replace in the fast path. 1331 // FIXME: Would be nice to handle smart replace in the fast path.
1332 if (m_smartReplace || fragment.hasInterchangeNewlineAtStart() || fragment.ha sInterchangeNewlineAtEnd()) 1332 if (m_smartReplace || fragment.hasInterchangeNewlineAtStart() || fragment.ha sInterchangeNewlineAtEnd())
1333 return false; 1333 return false;
1334 1334
1335 // e.g. when "bar" is inserted after "foo" in <div><u>foo</u></div>, "bar" s hould not be underlined. 1335 // e.g. when "bar" is inserted after "foo" in <div><u>foo</u></div>, "bar" s hould not be underlined.
1336 if (nodeToSplitToAvoidPastingIntoInlineNodesWithStyle(endingSelection().star t())) 1336 if (nodeToSplitToAvoidPastingIntoInlineNodesWithStyle(endingSelection().star t()))
1337 return false; 1337 return false;
1338 1338
1339 Node* nodeAfterInsertionPos = endingSelection().end().downstream().anchorNod e(); 1339 RefPtr<Node> nodeAfterInsertionPos = endingSelection().end().downstream().an chorNode();
1340 Text* textNode = toText(fragment.firstChild()); 1340 Text* textNode = toText(fragment.firstChild());
1341 // Our fragment creation code handles tabs, spaces, and newlines, so we don' t have to worry about those here. 1341 // Our fragment creation code handles tabs, spaces, and newlines, so we don' t have to worry about those here.
1342 1342
1343 Position start = endingSelection().start(); 1343 Position start = endingSelection().start();
1344 Position end = replaceSelectedTextInNode(textNode->data()); 1344 Position end = replaceSelectedTextInNode(textNode->data());
1345 if (end.isNull()) 1345 if (end.isNull())
1346 return false; 1346 return false;
1347 1347
1348 if (nodeAfterInsertionPos && nodeAfterInsertionPos->hasTagName(brTag) && sho uldRemoveEndBR(nodeAfterInsertionPos, positionBeforeNode(nodeAfterInsertionPos)) ) 1348 if (nodeAfterInsertionPos && nodeAfterInsertionPos->parentNode() && nodeAfte rInsertionPos->hasTagName(brTag)
1349 removeNodeAndPruneAncestors(nodeAfterInsertionPos); 1349 && shouldRemoveEndBR(nodeAfterInsertionPos.get(), positionBeforeNode(nod eAfterInsertionPos.get())))
1350 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1350 1351
1351 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1352 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1352 1353
1353 setEndingSelection(selectionAfterReplace); 1354 setEndingSelection(selectionAfterReplace);
1354 1355
1355 return true; 1356 return true;
1356 } 1357 }
1357 1358
1358 } // namespace WebCore 1359 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/inserting/insert-html-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698