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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 ASSERT(!endingSelection().isNone()); | 88 ASSERT(!endingSelection().isNone()); |
89 | 89 |
90 if (endingSelection().isNone()) | 90 if (endingSelection().isNone()) |
91 return; | 91 return; |
92 | 92 |
93 VisiblePosition visiblePos = endingSelection().visibleStart(); | 93 VisiblePosition visiblePos = endingSelection().visibleStart(); |
94 | 94 |
95 // pos is a position equivalent to the caret. We use downstream() so that p
os will | 95 // pos is a position equivalent to the caret. We use downstream() so that p
os will |
96 // be in the first node that we need to move (there are a few exceptions to
this, see below). | 96 // be in the first node that we need to move (there are a few exceptions to
this, see below). |
97 Position pos = endingSelection().start().downstream(); | 97 Position pos = mostForwardCaretPosition(endingSelection().start()); |
98 | 98 |
99 // Find the top-most blockquote from the start. | 99 // Find the top-most blockquote from the start. |
100 HTMLQuoteElement* topBlockquote = toHTMLQuoteElement(highestEnclosingNodeOfT
ype(pos, isMailHTMLBlockquoteElement)); | 100 HTMLQuoteElement* topBlockquote = toHTMLQuoteElement(highestEnclosingNodeOfT
ype(pos, isMailHTMLBlockquoteElement)); |
101 if (!topBlockquote || !topBlockquote->parentNode()) | 101 if (!topBlockquote || !topBlockquote->parentNode()) |
102 return; | 102 return; |
103 | 103 |
104 RefPtrWillBeRawPtr<HTMLBRElement> breakElement = createBreakElement(document
()); | 104 RefPtrWillBeRawPtr<HTMLBRElement> breakElement = createBreakElement(document
()); |
105 | 105 |
106 bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockqu
ote); | 106 bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockqu
ote); |
107 | 107 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 // Make sure the cloned block quote renders. | 219 // Make sure the cloned block quote renders. |
220 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); | 220 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); |
221 | 221 |
222 // Put the selection right before the break. | 222 // Put the selection right before the break. |
223 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
TextAffinity::Downstream, endingSelection().isDirectional())); | 223 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
TextAffinity::Downstream, endingSelection().isDirectional())); |
224 rebalanceWhitespace(); | 224 rebalanceWhitespace(); |
225 } | 225 } |
226 | 226 |
227 } // namespace blink | 227 } // namespace blink |
OLD | NEW |