| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return; | 148 return; |
| 149 | 149 |
| 150 // Don't put the next paragraph in the blockquote we just created for th
is paragraph unless | 150 // Don't put the next paragraph in the blockquote we just created for th
is paragraph unless |
| 151 // the next paragraph is in the same cell. | 151 // the next paragraph is in the same cell. |
| 152 if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParag
raph.deepEquivalent(), &isTableCell)) | 152 if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParag
raph.deepEquivalent(), &isTableCell)) |
| 153 blockquoteForNextIndent = nullptr; | 153 blockquoteForNextIndent = nullptr; |
| 154 | 154 |
| 155 // indentIntoBlockquote could move more than one paragraph if the paragr
aph | 155 // indentIntoBlockquote could move more than one paragraph if the paragr
aph |
| 156 // is in a list item or a table. As a result, endAfterSelection could re
fer to a position | 156 // is in a list item or a table. As a result, endAfterSelection could re
fer to a position |
| 157 // no longer in the document. | 157 // no longer in the document. |
| 158 if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent()
.inDocument()) | 158 if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent()
.inShadowIncludingDocument()) |
| 159 break; | 159 break; |
| 160 // Sanity check: Make sure our moveParagraph calls didn't remove endOfNe
xtParagraph.deepEquivalent().anchorNode() | 160 // Sanity check: Make sure our moveParagraph calls didn't remove endOfNe
xtParagraph.deepEquivalent().anchorNode() |
| 161 // If somehow, e.g. mutation event handler, we did, return to prevent cr
ashes. | 161 // If somehow, e.g. mutation event handler, we did, return to prevent cr
ashes. |
| 162 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().inDocument()) | 162 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().inShadowIncludingDocument()) |
| 163 return; | 163 return; |
| 164 endOfCurrentParagraph = endOfNextParagraph; | 164 endOfCurrentParagraph = endOfNextParagraph; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 static bool isNewLineAtPosition(const Position& position) | 168 static bool isNewLineAtPosition(const Position& position) |
| 169 { | 169 { |
| 170 Node* textNode = position.computeContainerNode(); | 170 Node* textNode = position.computeContainerNode(); |
| 171 int offset = position.offsetInContainerNode(); | 171 int offset = position.offsetInContainerNode(); |
| 172 if (!textNode || !textNode->isTextNode() || offset < 0 || offset >= textNode
->maxCharacterOffset()) | 172 if (!textNode || !textNode->isTextNode() || offset < 0 || offset >= textNode
->maxCharacterOffset()) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return element.release(); | 301 return element.release(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 DEFINE_TRACE(ApplyBlockElementCommand) | 304 DEFINE_TRACE(ApplyBlockElementCommand) |
| 305 { | 305 { |
| 306 visitor->trace(m_endOfLastParagraph); | 306 visitor->trace(m_endOfLastParagraph); |
| 307 CompositeEditCommand::trace(visitor); | 307 CompositeEditCommand::trace(visitor); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |