OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel
ection, const VisiblePosition& endOfSelection) | 109 void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel
ection, const VisiblePosition& endOfSelection) |
110 { | 110 { |
111 // Special case empty unsplittable elements because there's nothing to split | 111 // Special case empty unsplittable elements because there's nothing to split |
112 // and there's nothing to move. | 112 // and there's nothing to move. |
113 Position start = startOfSelection.deepEquivalent().downstream(); | 113 Position start = startOfSelection.deepEquivalent().downstream(); |
114 if (isAtUnsplittableElement(start)) { | 114 if (isAtUnsplittableElement(start)) { |
115 RefPtrWillBeRawPtr<HTMLElement> blockquote = createBlockElement(); | 115 RefPtrWillBeRawPtr<HTMLElement> blockquote = createBlockElement(); |
116 insertNodeAt(blockquote, start); | 116 insertNodeAt(blockquote, start); |
117 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = createBreakElement(docum
ent()); | 117 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = createBreakElement(docum
ent()); |
118 appendNode(placeholder, blockquote); | 118 appendNode(placeholder, blockquote); |
119 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get()
), DOWNSTREAM, endingSelection().isDirectional())); | 119 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get()
), TextAffinity::Downstream, endingSelection().isDirectional())); |
120 return; | 120 return; |
121 } | 121 } |
122 | 122 |
123 RefPtrWillBeRawPtr<HTMLElement> blockquoteForNextIndent = nullptr; | 123 RefPtrWillBeRawPtr<HTMLElement> blockquoteForNextIndent = nullptr; |
124 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); | 124 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); |
125 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); | 125 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); |
126 VisiblePosition endAfterSelection = endOfParagraph(endOfLastParagraph.next()
); | 126 VisiblePosition endAfterSelection = endOfParagraph(endOfLastParagraph.next()
); |
127 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent(); | 127 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent(); |
128 | 128 |
129 bool atEnd = false; | 129 bool atEnd = false; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 return element.release(); | 290 return element.release(); |
291 } | 291 } |
292 | 292 |
293 DEFINE_TRACE(ApplyBlockElementCommand) | 293 DEFINE_TRACE(ApplyBlockElementCommand) |
294 { | 294 { |
295 visitor->trace(m_endOfLastParagraph); | 295 visitor->trace(m_endOfLastParagraph); |
296 CompositeEditCommand::trace(visitor); | 296 CompositeEditCommand::trace(visitor); |
297 } | 297 } |
298 | 298 |
299 } | 299 } |
OLD | NEW |