| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 void InsertLineBreakCommand::doApply(EditingState* editingState) | 67 void InsertLineBreakCommand::doApply(EditingState* editingState) |
| 68 { | 68 { |
| 69 deleteSelection(editingState); | 69 deleteSelection(editingState); |
| 70 if (editingState->isAborted()) | 70 if (editingState->isAborted()) |
| 71 return; | 71 return; |
| 72 VisibleSelection selection = endingSelection(); | 72 VisibleSelection selection = endingSelection(); |
| 73 if (!selection.isNonOrphanedCaretOrRange()) | 73 if (!selection.isNonOrphanedCaretOrRange()) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 VisiblePosition caret(selection.visibleStart()); | 76 VisiblePosition caret(selection.visibleStartDeprecated()); |
| 77 // FIXME: If the node is hidden, we should still be able to insert text. | 77 // FIXME: If the node is hidden, we should still be able to insert text. |
| 78 // For now, we return to avoid a crash. https://bugs.webkit.org/show_bug.cg
i?id=40342 | 78 // For now, we return to avoid a crash. https://bugs.webkit.org/show_bug.cg
i?id=40342 |
| 79 if (caret.isNull()) | 79 if (caret.isNull()) |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 Position pos(caret.deepEquivalent()); | 82 Position pos(caret.deepEquivalent()); |
| 83 | 83 |
| 84 pos = positionAvoidingSpecialElementBoundary(pos, editingState); | 84 pos = positionAvoidingSpecialElementBoundary(pos, editingState); |
| 85 if (editingState->isAborted()) | 85 if (editingState->isAborted()) |
| 86 return; | 86 return; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // see <rdar://problem/5794462>. | 185 // see <rdar://problem/5794462>. |
| 186 applyStyle(typingStyle, firstPositionInOrBeforeNode(nodeToInsert), lastP
ositionInOrAfterNode(nodeToInsert), editingState); | 186 applyStyle(typingStyle, firstPositionInOrBeforeNode(nodeToInsert), lastP
ositionInOrAfterNode(nodeToInsert), editingState); |
| 187 if (editingState->isAborted()) | 187 if (editingState->isAborted()) |
| 188 return; | 188 return; |
| 189 // Even though this applyStyle operates on a Range, it still sets an end
ingSelection(). | 189 // Even though this applyStyle operates on a Range, it still sets an end
ingSelection(). |
| 190 // It tries to set a VisibleSelection around the content it operated on.
So, that VisibleSelection | 190 // It tries to set a VisibleSelection around the content it operated on.
So, that VisibleSelection |
| 191 // will either (a) select the line break we inserted, or it will (b) be
a caret just | 191 // will either (a) select the line break we inserted, or it will (b) be
a caret just |
| 192 // before the line break (if the line break is at the end of a block it
isn't selectable). | 192 // before the line break (if the line break is at the end of a block it
isn't selectable). |
| 193 // So, this next call sets the endingSelection() to a caret just after t
he line break | 193 // So, this next call sets the endingSelection() to a caret just after t
he line break |
| 194 // that we inserted, or just before it if it's at the end of a block. | 194 // that we inserted, or just before it if it's at the end of a block. |
| 195 setEndingSelection(endingSelection().visibleEnd()); | 195 setEndingSelection(endingSelection().visibleEndDeprecated()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 rebalanceWhitespace(); | 198 rebalanceWhitespace(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |