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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 VisiblePosition end(visiblePositionForIndex(endIndex, endScope.get())); | 103 VisiblePosition end(visiblePositionForIndex(endIndex, endScope.get())); |
104 if (start.isNotNull() && end.isNotNull()) | 104 if (start.isNotNull() && end.isNotNull()) |
105 setEndingSelection(VisibleSelection(start, end, endingSelection().is
Directional())); | 105 setEndingSelection(VisibleSelection(start, end, endingSelection().is
Directional())); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
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 = mostForwardCaretPosition(startOfSelection.deepEquivalent())
; |
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()
), TextAffinity::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; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return element.release(); | 294 return element.release(); |
295 } | 295 } |
296 | 296 |
297 DEFINE_TRACE(ApplyBlockElementCommand) | 297 DEFINE_TRACE(ApplyBlockElementCommand) |
298 { | 298 { |
299 visitor->trace(m_endOfLastParagraph); | 299 visitor->trace(m_endOfLastParagraph); |
300 CompositeEditCommand::trace(visitor); | 300 CompositeEditCommand::trace(visitor); |
301 } | 301 } |
302 | 302 |
303 } | 303 } |
OLD | NEW |