OLD | NEW |
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 Loading... |
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 |
OLD | NEW |