OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 | 1335 |
1336 VisiblePosition previous(caret.previous(CannotCrossEditingBoundary)); | 1336 VisiblePosition previous(caret.previous(CannotCrossEditingBoundary)); |
1337 // Only move forward if there's nothing before the caret, or if there's unqu
oted content before it. | 1337 // Only move forward if there's nothing before the caret, or if there's unqu
oted content before it. |
1338 if (enclosingNodeOfType(previous.deepEquivalent(), &isMailBlockquote)) | 1338 if (enclosingNodeOfType(previous.deepEquivalent(), &isMailBlockquote)) |
1339 return false; | 1339 return false; |
1340 | 1340 |
1341 RefPtr<Node> br = createBreakElement(document()); | 1341 RefPtr<Node> br = createBreakElement(document()); |
1342 // We want to replace this quoted paragraph with an unquoted one, so insert
a br | 1342 // We want to replace this quoted paragraph with an unquoted one, so insert
a br |
1343 // to hold the caret before the highest blockquote. | 1343 // to hold the caret before the highest blockquote. |
1344 insertNodeBefore(br, highestBlockquote); | 1344 insertNodeBefore(br, highestBlockquote); |
1345 VisiblePosition atBR(positionBeforeNode(br.get())); | 1345 VisiblePosition atBR(positionBeforeNode(*br)); |
1346 // If the br we inserted collapsed, for example foo<br><blockquote>...</bloc
kquote>, insert | 1346 // If the br we inserted collapsed, for example foo<br><blockquote>...</bloc
kquote>, insert |
1347 // a second one. | 1347 // a second one. |
1348 if (!isStartOfParagraph(atBR)) | 1348 if (!isStartOfParagraph(atBR)) |
1349 insertNodeBefore(createBreakElement(document()), br); | 1349 insertNodeBefore(createBreakElement(document()), br); |
1350 setEndingSelection(VisibleSelection(atBR, endingSelection().isDirectional())
); | 1350 setEndingSelection(VisibleSelection(atBR, endingSelection().isDirectional())
); |
1351 | 1351 |
1352 // If this is an empty paragraph there must be a line break here. | 1352 // If this is an empty paragraph there must be a line break here. |
1353 if (!lineBreakExistsAtVisiblePosition(caret)) | 1353 if (!lineBreakExistsAtVisiblePosition(caret)) |
1354 return false; | 1354 return false; |
1355 | 1355 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 return node.release(); | 1459 return node.release(); |
1460 } | 1460 } |
1461 | 1461 |
1462 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1462 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1463 { | 1463 { |
1464 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1464 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1465 return breakNode.release(); | 1465 return breakNode.release(); |
1466 } | 1466 } |
1467 | 1467 |
1468 } // namespace WebCore | 1468 } // namespace WebCore |
OLD | NEW |