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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 formatRange(start, end, m_endOfLastParagraph, blockquoteForNextIndent); | 136 formatRange(start, end, m_endOfLastParagraph, blockquoteForNextIndent); |
137 | 137 |
138 // Don't put the next paragraph in the blockquote we just created for th
is paragraph unless | 138 // Don't put the next paragraph in the blockquote we just created for th
is paragraph unless |
139 // the next paragraph is in the same cell. | 139 // the next paragraph is in the same cell. |
140 if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParag
raph.deepEquivalent(), &isTableCell)) | 140 if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParag
raph.deepEquivalent(), &isTableCell)) |
141 blockquoteForNextIndent = 0; | 141 blockquoteForNextIndent = 0; |
142 | 142 |
143 // indentIntoBlockquote could move more than one paragraph if the paragr
aph | 143 // indentIntoBlockquote could move more than one paragraph if the paragr
aph |
144 // is in a list item or a table. As a result, endAfterSelection could re
fer to a position | 144 // is in a list item or a table. As a result, endAfterSelection could re
fer to a position |
145 // no longer in the document. | 145 // no longer in the document. |
146 if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent()
.anchorNode()->inDocument()) | 146 if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent()
.inDocument()) |
147 break; | 147 break; |
148 // Sanity check: Make sure our moveParagraph calls didn't remove endOfNe
xtParagraph.deepEquivalent().deprecatedNode() | 148 // Sanity check: Make sure our moveParagraph calls didn't remove endOfNe
xtParagraph.deepEquivalent().deprecatedNode() |
149 // If somehow we did, return to prevent crashes. | 149 // If somehow we did, return to prevent crashes. |
150 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().anchorNode()->inDocument()) { | 150 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().inDocument()) { |
151 ASSERT_NOT_REACHED(); | 151 ASSERT_NOT_REACHED(); |
152 return; | 152 return; |
153 } | 153 } |
154 endOfCurrentParagraph = endOfNextParagraph; | 154 endOfCurrentParagraph = endOfNextParagraph; |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 static bool isNewLineAtPosition(const Position& position) | 158 static bool isNewLineAtPosition(const Position& position) |
159 { | 159 { |
160 Node* textNode = position.containerNode(); | 160 Node* textNode = position.containerNode(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const | 281 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const |
282 { | 282 { |
283 RefPtr<Element> element = createHTMLElement(document(), m_tagName); | 283 RefPtr<Element> element = createHTMLElement(document(), m_tagName); |
284 if (m_inlineStyle.length()) | 284 if (m_inlineStyle.length()) |
285 element->setAttribute(styleAttr, m_inlineStyle); | 285 element->setAttribute(styleAttr, m_inlineStyle); |
286 return element.release(); | 286 return element.release(); |
287 } | 287 } |
288 | 288 |
289 } | 289 } |
OLD | NEW |