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

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

Issue 2952983002: Make Position::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-23T10:37:43 Created 3 years, 5 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, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 InsertNodeAt(HTMLBRElement::Create(GetDocument()), 1497 InsertNodeAt(HTMLBRElement::Create(GetDocument()),
1498 before_paragraph.DeepEquivalent(), editing_state); 1498 before_paragraph.DeepEquivalent(), editing_state);
1499 if (editing_state->IsAborted()) 1499 if (editing_state->IsAborted())
1500 return; 1500 return;
1501 } 1501 }
1502 1502
1503 // TextIterator::rangeLength requires clean layout. 1503 // TextIterator::rangeLength requires clean layout.
1504 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 1504 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
1505 1505
1506 destination_index = TextIterator::RangeLength( 1506 destination_index = TextIterator::RangeLength(
1507 Position::FirstPositionInNode(GetDocument().documentElement()), 1507 Position::FirstPositionInNode(*GetDocument().documentElement()),
1508 destination.ToParentAnchoredPosition(), 1508 destination.ToParentAnchoredPosition(),
1509 TextIteratorBehavior::AllVisiblePositionsRangeLengthBehavior()); 1509 TextIteratorBehavior::AllVisiblePositionsRangeLengthBehavior());
1510 1510
1511 const SelectionInDOMTree& destination_selection = 1511 const SelectionInDOMTree& destination_selection =
1512 SelectionInDOMTree::Builder() 1512 SelectionInDOMTree::Builder()
1513 .Collapse(destination.ToPositionWithAffinity()) 1513 .Collapse(destination.ToPositionWithAffinity())
1514 .SetIsDirectional(original_is_directional) 1514 .SetIsDirectional(original_is_directional)
1515 .Build(); 1515 .Build();
1516 if (EndingSelection().IsNone()) { 1516 if (EndingSelection().IsNone()) {
1517 // We abort executing command since |destination| becomes invisible. 1517 // We abort executing command since |destination| becomes invisible.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 editing_state); 1671 editing_state);
1672 if (editing_state->IsAborted()) 1672 if (editing_state->IsAborted())
1673 return false; 1673 return false;
1674 } 1674 }
1675 1675
1676 AppendBlockPlaceholder(new_block, editing_state); 1676 AppendBlockPlaceholder(new_block, editing_state);
1677 if (editing_state->IsAborted()) 1677 if (editing_state->IsAborted())
1678 return false; 1678 return false;
1679 1679
1680 SetEndingSelection(SelectionInDOMTree::Builder() 1680 SetEndingSelection(SelectionInDOMTree::Builder()
1681 .Collapse(Position::FirstPositionInNode(new_block)) 1681 .Collapse(Position::FirstPositionInNode(*new_block))
1682 .SetIsDirectional(EndingSelection().IsDirectional()) 1682 .SetIsDirectional(EndingSelection().IsDirectional())
1683 .Build()); 1683 .Build());
1684 1684
1685 style->PrepareToApplyAt(EndingSelection().Start()); 1685 style->PrepareToApplyAt(EndingSelection().Start());
1686 if (!style->IsEmpty()) { 1686 if (!style->IsEmpty()) {
1687 ApplyStyle(style, editing_state); 1687 ApplyStyle(style, editing_state);
1688 if (editing_state->IsAborted()) 1688 if (editing_state->IsAborted())
1689 return false; 1689 return false;
1690 } 1690 }
1691 1691
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 1974
1975 DEFINE_TRACE(CompositeEditCommand) { 1975 DEFINE_TRACE(CompositeEditCommand) {
1976 visitor->Trace(commands_); 1976 visitor->Trace(commands_);
1977 visitor->Trace(starting_selection_); 1977 visitor->Trace(starting_selection_);
1978 visitor->Trace(ending_selection_); 1978 visitor->Trace(ending_selection_);
1979 visitor->Trace(undo_step_); 1979 visitor->Trace(undo_step_);
1980 EditCommand::Trace(visitor); 1980 EditCommand::Trace(visitor);
1981 } 1981 }
1982 1982
1983 } // namespace blink 1983 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698