| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } else { | 120 } else { |
| 121 extra_node = node_to_insert->cloneNode(false); | 121 extra_node = node_to_insert->cloneNode(false); |
| 122 InsertNodeAfter(extra_node, node_to_insert, editing_state); | 122 InsertNodeAfter(extra_node, node_to_insert, editing_state); |
| 123 } | 123 } |
| 124 if (editing_state->IsAborted()) | 124 if (editing_state->IsAborted()) |
| 125 return; | 125 return; |
| 126 node_to_insert = extra_node; | 126 node_to_insert = extra_node; |
| 127 } | 127 } |
| 128 | 128 |
| 129 SetEndingSelection(SelectionInDOMTree::Builder() | 129 SetEndingSelection(SelectionInDOMTree::Builder() |
| 130 .Collapse(Position::BeforeNode(node_to_insert)) | 130 .Collapse(Position::BeforeNode(*node_to_insert)) |
| 131 .SetIsDirectional(EndingSelection().IsDirectional()) | 131 .SetIsDirectional(EndingSelection().IsDirectional()) |
| 132 .Build()); | 132 .Build()); |
| 133 } else if (pos.ComputeEditingOffset() <= CaretMinOffset(pos.AnchorNode())) { | 133 } else if (pos.ComputeEditingOffset() <= CaretMinOffset(pos.AnchorNode())) { |
| 134 InsertNodeAt(node_to_insert, pos, editing_state); | 134 InsertNodeAt(node_to_insert, pos, editing_state); |
| 135 if (editing_state->IsAborted()) | 135 if (editing_state->IsAborted()) |
| 136 return; | 136 return; |
| 137 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 137 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 138 | 138 |
| 139 // Insert an extra br or '\n' if the just inserted one collapsed. | 139 // Insert an extra br or '\n' if the just inserted one collapsed. |
| 140 if (!IsStartOfParagraph(VisiblePosition::BeforeNode(node_to_insert))) { | 140 if (!IsStartOfParagraph(VisiblePosition::BeforeNode(node_to_insert))) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // block. | 226 // block. |
| 227 SetEndingSelection(SelectionInDOMTree::Builder() | 227 SetEndingSelection(SelectionInDOMTree::Builder() |
| 228 .Collapse(EndingSelection().End()) | 228 .Collapse(EndingSelection().End()) |
| 229 .Build()); | 229 .Build()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 RebalanceWhitespace(); | 232 RebalanceWhitespace(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace blink | 235 } // namespace blink |
| OLD | NEW |