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

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

Issue 1878473002: ASSERT -> DCHECK in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Output info for some DCHECKs, add TODOs. Created 4 years, 8 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 15 matching lines...) Expand all
26 #include "core/editing/commands/MoveSelectionCommand.h" 26 #include "core/editing/commands/MoveSelectionCommand.h"
27 27
28 #include "core/dom/DocumentFragment.h" 28 #include "core/dom/DocumentFragment.h"
29 #include "core/editing/commands/ReplaceSelectionCommand.h" 29 #include "core/editing/commands/ReplaceSelectionCommand.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 MoveSelectionCommand::MoveSelectionCommand(DocumentFragment* fragment, const Pos ition& position, bool smartInsert, bool smartDelete) 33 MoveSelectionCommand::MoveSelectionCommand(DocumentFragment* fragment, const Pos ition& position, bool smartInsert, bool smartDelete)
34 : CompositeEditCommand(*position.document()), m_fragment(fragment), m_positi on(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete) 34 : CompositeEditCommand(*position.document()), m_fragment(fragment), m_positi on(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete)
35 { 35 {
36 ASSERT(m_fragment); 36 DCHECK(m_fragment);
37 } 37 }
38 38
39 void MoveSelectionCommand::doApply(EditingState* editingState) 39 void MoveSelectionCommand::doApply(EditingState* editingState)
40 { 40 {
41 ASSERT(endingSelection().isNonOrphanedRange()); 41 DCHECK(endingSelection().isNonOrphanedRange());
42 42
43 Position pos = m_position; 43 Position pos = m_position;
44 if (pos.isNull()) 44 if (pos.isNull())
45 return; 45 return;
46 46
47 // Update the position otherwise it may become invalid after the selection i s deleted. 47 // Update the position otherwise it may become invalid after the selection i s deleted.
48 Position selectionEnd = endingSelection().end(); 48 Position selectionEnd = endingSelection().end();
49 if (pos.isOffsetInAnchor() && selectionEnd.isOffsetInAnchor() 49 if (pos.isOffsetInAnchor() && selectionEnd.isOffsetInAnchor()
50 && selectionEnd.computeContainerNode() == pos.computeContainerNode() && selectionEnd.offsetInContainerNode() < pos.offsetInContainerNode()) { 50 && selectionEnd.computeContainerNode() == pos.computeContainerNode() && selectionEnd.offsetInContainerNode() < pos.offsetInContainerNode()) {
51 pos = Position(pos.computeContainerNode(), pos.offsetInContainerNode() - selectionEnd.offsetInContainerNode()); 51 pos = Position(pos.computeContainerNode(), pos.offsetInContainerNode() - selectionEnd.offsetInContainerNode());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 DEFINE_TRACE(MoveSelectionCommand) 89 DEFINE_TRACE(MoveSelectionCommand)
90 { 90 {
91 visitor->trace(m_fragment); 91 visitor->trace(m_fragment);
92 visitor->trace(m_position); 92 visitor->trace(m_position);
93 CompositeEditCommand::trace(visitor); 93 CompositeEditCommand::trace(visitor);
94 } 94 }
95 95
96 } // namespace blink 96 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698