Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp

Issue 2958483003: Make VisiblePosition::BeforeNode() to take const Node& instead of Node* (Closed)
Patch Set: 017-06-23T18:57:25 Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
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))) {
141 InsertNodeBefore(node_to_insert->cloneNode(false), node_to_insert, 141 InsertNodeBefore(node_to_insert->cloneNode(false), node_to_insert,
142 editing_state); 142 editing_state);
143 if (editing_state->IsAborted()) 143 if (editing_state->IsAborted())
144 return; 144 return;
145 } 145 }
146 146
147 SetEndingSelection( 147 SetEndingSelection(
148 SelectionInDOMTree::Builder() 148 SelectionInDOMTree::Builder()
149 .Collapse(Position::InParentAfterNode(*node_to_insert)) 149 .Collapse(Position::InParentAfterNode(*node_to_insert))
150 .SetIsDirectional(EndingSelection().IsDirectional()) 150 .SetIsDirectional(EndingSelection().IsDirectional())
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698