| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 insertionPosition = insertionPosition.upstream(); | 128 insertionPosition = insertionPosition.upstream(); |
| 129 if (!insertionPosition.isCandidate()) | 129 if (!insertionPosition.isCandidate()) |
| 130 insertionPosition = insertionPosition.downstream(); | 130 insertionPosition = insertionPosition.downstream(); |
| 131 | 131 |
| 132 // Adjust the insertion position after the delete | 132 // Adjust the insertion position after the delete |
| 133 insertionPosition = positionAvoidingSpecialElementBoundary(insertionPosition
); | 133 insertionPosition = positionAvoidingSpecialElementBoundary(insertionPosition
); |
| 134 VisiblePosition visiblePos(insertionPosition, affinity); | 134 VisiblePosition visiblePos(insertionPosition, affinity); |
| 135 calculateStyleBeforeInsertion(insertionPosition); | 135 calculateStyleBeforeInsertion(insertionPosition); |
| 136 | 136 |
| 137 //--------------------------------------------------------------------- | 137 //--------------------------------------------------------------------- |
| 138 // Handle special case of typing return on an empty list item | |
| 139 if (breakOutOfEmptyListItem()) | |
| 140 return; | |
| 141 | |
| 142 //--------------------------------------------------------------------- | |
| 143 // Prepare for more general cases. | 138 // Prepare for more general cases. |
| 144 | 139 |
| 145 bool isFirstInBlock = isStartOfBlock(visiblePos); | 140 bool isFirstInBlock = isStartOfBlock(visiblePos); |
| 146 bool isLastInBlock = isEndOfBlock(visiblePos); | 141 bool isLastInBlock = isEndOfBlock(visiblePos); |
| 147 bool nestNewBlock = false; | 142 bool nestNewBlock = false; |
| 148 | 143 |
| 149 // Create block to be inserted. | 144 // Create block to be inserted. |
| 150 RefPtr<Element> blockToInsert = nullptr; | 145 RefPtr<Element> blockToInsert = nullptr; |
| 151 if (startBlock->isRootEditableElement()) { | 146 if (startBlock->isRootEditableElement()) { |
| 152 blockToInsert = createDefaultParagraphElement(document()); | 147 blockToInsert = createDefaultParagraphElement(document()); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 deleteInsignificantTextDownstream(positionAfterSplit); | 307 deleteInsignificantTextDownstream(positionAfterSplit); |
| 313 if (positionAfterSplit.deprecatedNode()->isTextNode()) | 308 if (positionAfterSplit.deprecatedNode()->isTextNode()) |
| 314 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0
, nonBreakingSpaceString()); | 309 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0
, nonBreakingSpaceString()); |
| 315 } | 310 } |
| 316 } | 311 } |
| 317 | 312 |
| 318 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); | 313 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); |
| 319 } | 314 } |
| 320 | 315 |
| 321 } // namespace blink | 316 } // namespace blink |
| OLD | NEW |