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

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

Issue 2950053002: Make Position::BeforeNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-21T17:56:36 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) 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (IsAtUnsplittableElement(caret_position)) { 144 if (IsAtUnsplittableElement(caret_position)) {
145 HTMLElement* blockquote = CreateBlockElement(); 145 HTMLElement* blockquote = CreateBlockElement();
146 InsertNodeAt(blockquote, caret_position, editing_state); 146 InsertNodeAt(blockquote, caret_position, editing_state);
147 if (editing_state->IsAborted()) 147 if (editing_state->IsAborted())
148 return; 148 return;
149 HTMLBRElement* placeholder = HTMLBRElement::Create(GetDocument()); 149 HTMLBRElement* placeholder = HTMLBRElement::Create(GetDocument());
150 AppendNode(placeholder, blockquote, editing_state); 150 AppendNode(placeholder, blockquote, editing_state);
151 if (editing_state->IsAborted()) 151 if (editing_state->IsAborted())
152 return; 152 return;
153 SetEndingSelection(SelectionInDOMTree::Builder() 153 SetEndingSelection(SelectionInDOMTree::Builder()
154 .Collapse(Position::BeforeNode(placeholder)) 154 .Collapse(Position::BeforeNode(*placeholder))
155 .SetIsDirectional(EndingSelection().IsDirectional()) 155 .SetIsDirectional(EndingSelection().IsDirectional())
156 .Build()); 156 .Build());
157 return; 157 return;
158 } 158 }
159 159
160 HTMLElement* blockquote_for_next_indent = nullptr; 160 HTMLElement* blockquote_for_next_indent = nullptr;
161 VisiblePosition end_of_current_paragraph = EndOfParagraph(start_of_selection); 161 VisiblePosition end_of_current_paragraph = EndOfParagraph(start_of_selection);
162 const VisiblePosition& visible_end_of_last_paragraph = 162 const VisiblePosition& visible_end_of_last_paragraph =
163 EndOfParagraph(end_of_selection); 163 EndOfParagraph(end_of_selection);
164 const Position& end_of_next_last_paragraph = 164 const Position& end_of_next_last_paragraph =
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 HTMLElement* ApplyBlockElementCommand::CreateBlockElement() const { 413 HTMLElement* ApplyBlockElementCommand::CreateBlockElement() const {
414 HTMLElement* element = CreateHTMLElement(GetDocument(), tag_name_); 414 HTMLElement* element = CreateHTMLElement(GetDocument(), tag_name_);
415 if (inline_style_.length()) 415 if (inline_style_.length())
416 element->setAttribute(styleAttr, inline_style_); 416 element->setAttribute(styleAttr, inline_style_);
417 return element; 417 return element;
418 } 418 }
419 419
420 } // namespace blink 420 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698