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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 return false; | 1292 return false; |
1293 | 1293 |
1294 // FIXME: Would be nice to handle smart replace in the fast path. | 1294 // FIXME: Would be nice to handle smart replace in the fast path. |
1295 if (m_smartReplace || fragment.hasInterchangeNewlineAtStart() || fragment.ha
sInterchangeNewlineAtEnd()) | 1295 if (m_smartReplace || fragment.hasInterchangeNewlineAtStart() || fragment.ha
sInterchangeNewlineAtEnd()) |
1296 return false; | 1296 return false; |
1297 | 1297 |
1298 // e.g. when "bar" is inserted after "foo" in <div><u>foo</u></div>, "bar" s
hould not be underlined. | 1298 // e.g. when "bar" is inserted after "foo" in <div><u>foo</u></div>, "bar" s
hould not be underlined. |
1299 if (nodeToSplitToAvoidPastingIntoInlineNodesWithStyle(endingSelection().star
t())) | 1299 if (nodeToSplitToAvoidPastingIntoInlineNodesWithStyle(endingSelection().star
t())) |
1300 return false; | 1300 return false; |
1301 | 1301 |
1302 Node* nodeAfterInsertionPos = endingSelection().end().downstream().anchorNod
e(); | 1302 RefPtr<Node> nodeAfterInsertionPos = endingSelection().end().downstream().an
chorNode(); |
1303 Text* textNode = toText(fragment.firstChild()); | 1303 Text* textNode = toText(fragment.firstChild()); |
1304 // Our fragment creation code handles tabs, spaces, and newlines, so we don'
t have to worry about those here. | 1304 // Our fragment creation code handles tabs, spaces, and newlines, so we don'
t have to worry about those here. |
1305 | 1305 |
1306 Position start = endingSelection().start(); | 1306 Position start = endingSelection().start(); |
1307 Position end = replaceSelectedTextInNode(textNode->data()); | 1307 Position end = replaceSelectedTextInNode(textNode->data()); |
1308 if (end.isNull()) | 1308 if (end.isNull()) |
1309 return false; | 1309 return false; |
1310 | 1310 |
1311 if (nodeAfterInsertionPos && nodeAfterInsertionPos->hasTagName(brTag) && sho
uldRemoveEndBR(nodeAfterInsertionPos, positionBeforeNode(nodeAfterInsertionPos))
) | 1311 if (nodeAfterInsertionPos && nodeAfterInsertionPos->parentNode() && nodeAfte
rInsertionPos->hasTagName(brTag) |
1312 removeNodeAndPruneAncestors(nodeAfterInsertionPos); | 1312 && shouldRemoveEndBR(nodeAfterInsertionPos.get(), positionBeforeNode(nod
eAfterInsertionPos.get()))) |
| 1313 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1313 | 1314 |
1314 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1315 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1315 | 1316 |
1316 setEndingSelection(selectionAfterReplace); | 1317 setEndingSelection(selectionAfterReplace); |
1317 | 1318 |
1318 return true; | 1319 return true; |
1319 } | 1320 } |
1320 | 1321 |
1321 } // namespace WebCore | 1322 } // namespace WebCore |
OLD | NEW |