| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel
ection, const VisiblePosition& endOfSelection) | 104 void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel
ection, const VisiblePosition& endOfSelection) |
| 105 { | 105 { |
| 106 // Special case empty unsplittable elements because there's nothing to split | 106 // Special case empty unsplittable elements because there's nothing to split |
| 107 // and there's nothing to move. | 107 // and there's nothing to move. |
| 108 Position start = startOfSelection.deepEquivalent().downstream(); | 108 Position start = startOfSelection.deepEquivalent().downstream(); |
| 109 if (isAtUnsplittableElement(start)) { | 109 if (isAtUnsplittableElement(start)) { |
| 110 RefPtr<Element> blockquote = createBlockElement(); | 110 RefPtr<Element> blockquote = createBlockElement(); |
| 111 insertNodeAt(blockquote, start); | 111 insertNodeAt(blockquote, start); |
| 112 RefPtr<Element> placeholder = createBreakElement(document()); | 112 RefPtr<Element> placeholder = createBreakElement(document()); |
| 113 appendNode(placeholder, blockquote); | 113 appendNode(placeholder, blockquote); |
| 114 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get()
), DOWNSTREAM, endingSelection().isDirectional())); | 114 setEndingSelection(VisibleSelection(positionBeforeNode(*placeholder), DO
WNSTREAM, endingSelection().isDirectional())); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 RefPtr<Element> blockquoteForNextIndent; | 118 RefPtr<Element> blockquoteForNextIndent; |
| 119 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); | 119 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); |
| 120 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); | 120 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); |
| 121 VisiblePosition endAfterSelection = endOfParagraph(endOfLastParagraph.next()
); | 121 VisiblePosition endAfterSelection = endOfParagraph(endOfLastParagraph.next()
); |
| 122 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent(); | 122 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent(); |
| 123 | 123 |
| 124 bool atEnd = false; | 124 bool atEnd = false; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const | 279 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const |
| 280 { | 280 { |
| 281 RefPtr<Element> element = createHTMLElement(document(), m_tagName); | 281 RefPtr<Element> element = createHTMLElement(document(), m_tagName); |
| 282 if (m_inlineStyle.length()) | 282 if (m_inlineStyle.length()) |
| 283 element->setAttribute(styleAttr, m_inlineStyle); | 283 element->setAttribute(styleAttr, m_inlineStyle); |
| 284 return element.release(); | 284 return element.release(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } | 287 } |
| OLD | NEW |