OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 Apple Computer, 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 rebalanceWhitespace(); | 95 rebalanceWhitespace(); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 // Don't move a line break just after the caret. Doing so would create an e
xtra, empty paragraph | 99 // Don't move a line break just after the caret. Doing so would create an e
xtra, empty paragraph |
100 // in the new blockquote. | 100 // in the new blockquote. |
101 if (lineBreakExistsAtVisiblePosition(visiblePos)) | 101 if (lineBreakExistsAtVisiblePosition(visiblePos)) |
102 pos = pos.next(); | 102 pos = pos.next(); |
103 | 103 |
104 // Adjust the position so we don't split at the beginning of a quote. | 104 // Adjust the position so we don't split at the beginning of a quote. |
105 while (isFirstVisiblePositionInNode(VisiblePosition(pos), enclosingNodeOfTyp
e(pos, isMailHTMLBlockquoteElement))) | 105 while (isFirstVisiblePositionInNode(VisiblePosition(pos), toHTMLQuoteElement
(enclosingNodeOfType(pos, isMailHTMLBlockquoteElement)))) |
106 pos = pos.previous(); | 106 pos = pos.previous(); |
107 | 107 |
108 // startNode is the first node that we need to move to the new blockquote. | 108 // startNode is the first node that we need to move to the new blockquote. |
109 Node* startNode = pos.deprecatedNode(); | 109 Node* startNode = pos.deprecatedNode(); |
110 ASSERT(startNode); | 110 ASSERT(startNode); |
111 | 111 |
112 // Split at pos if in the middle of a text node. | 112 // Split at pos if in the middle of a text node. |
113 if (startNode->isTextNode()) { | 113 if (startNode->isTextNode()) { |
114 Text* textNode = toText(startNode); | 114 Text* textNode = toText(startNode); |
115 if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) { | 115 if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Make sure the cloned block quote renders. | 183 // Make sure the cloned block quote renders. |
184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); | 184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); |
185 | 185 |
186 // Put the selection right before the break. | 186 // Put the selection right before the break. |
187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
DOWNSTREAM, endingSelection().isDirectional())); | 187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
DOWNSTREAM, endingSelection().isDirectional())); |
188 rebalanceWhitespace(); | 188 rebalanceWhitespace(); |
189 } | 189 } |
190 | 190 |
191 } // namespace blink | 191 } // namespace blink |
OLD | NEW |