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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()
.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, e.g. mutation event handler, we did, return to prevent cr
ashes. |
150 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().inDocument()) { | 150 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().inDocument()) |
151 ASSERT_NOT_REACHED(); | |
152 return; | 151 return; |
153 } | |
154 endOfCurrentParagraph = endOfNextParagraph; | 152 endOfCurrentParagraph = endOfNextParagraph; |
155 } | 153 } |
156 } | 154 } |
157 | 155 |
158 static bool isNewLineAtPosition(const Position& position) | 156 static bool isNewLineAtPosition(const Position& position) |
159 { | 157 { |
160 Node* textNode = position.containerNode(); | 158 Node* textNode = position.containerNode(); |
161 int offset = position.offsetInContainerNode(); | 159 int offset = position.offsetInContainerNode(); |
162 if (!textNode || !textNode->isTextNode() || offset < 0 || offset >= textNode
->maxCharacterOffset()) | 160 if (!textNode || !textNode->isTextNode() || offset < 0 || offset >= textNode
->maxCharacterOffset()) |
163 return false; | 161 return false; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 278 |
281 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const | 279 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const |
282 { | 280 { |
283 RefPtr<Element> element = createHTMLElement(document(), m_tagName); | 281 RefPtr<Element> element = createHTMLElement(document(), m_tagName); |
284 if (m_inlineStyle.length()) | 282 if (m_inlineStyle.length()) |
285 element->setAttribute(styleAttr, m_inlineStyle); | 283 element->setAttribute(styleAttr, m_inlineStyle); |
286 return element.release(); | 284 return element.release(); |
287 } | 285 } |
288 | 286 |
289 } | 287 } |
OLD | NEW |