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

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index a9c9fd3ade529c8a4ebbebcdc1eb128ba0ad4b1b..82083270ba88e8e87d95e13427ba8b1e7586305c 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -231,13 +231,13 @@ static bool executeApplyParagraphStyle(LocalFrame& frame, EditorCommandSource so
static bool executeInsertFragment(LocalFrame& frame, DocumentFragment* fragment)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectionCommand::PreventNesting, EditActionUnspecified)->apply();
}
static bool executeInsertElement(LocalFrame& frame, HTMLElement* content)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
DocumentFragment* fragment = DocumentFragment::create(*frame.document());
TrackExceptionState exceptionState;
fragment->appendChild(content, exceptionState);
@@ -356,7 +356,7 @@ static bool executeCreateLink(LocalFrame& frame, Event*, EditorCommandSource, co
{
if (value.isEmpty())
return false;
- ASSERT(frame.document());
+ DCHECK(frame.document());
return CreateLinkCommand::create(*frame.document(), value)->apply();
}
@@ -394,7 +394,7 @@ static bool executeDelete(LocalFrame& frame, Event*, EditorCommandSource source,
case CommandFromDOM:
// If the current selection is a caret, delete the preceding character. IE performs forwardDelete, but we currently side with Firefox.
// Doesn't scroll to make the selection visible, or modify the kill ring (this time, siding with IE, not Firefox).
- ASSERT(frame.document());
+ DCHECK(frame.document());
TypingCommand::deleteKeyPressed(*frame.document(), frame.selection().granularity() == WordGranularity ? TypingCommand::SmartDelete : 0);
return true;
}
@@ -454,7 +454,7 @@ static bool executeDeleteToMark(LocalFrame& frame, Event*, EditorCommandSource,
const EphemeralRange mark = frame.editor().mark().toNormalizedEphemeralRange();
if (mark.isNotNull()) {
bool selected = frame.selection().setSelectedRange(unionEphemeralRanges(mark, frame.editor().selectedRange()), TextAffinity::Downstream, SelectionDirectionalMode::NonDirectional, FrameSelection::CloseTyping);
- ASSERT(selected);
+ DCHECK(selected);
if (!selected)
return false;
}
@@ -514,7 +514,7 @@ static bool executeFormatBlock(LocalFrame& frame, Event*, EditorCommandSource, c
return false;
QualifiedName qualifiedTagName(prefix, localName, xhtmlNamespaceURI);
- ASSERT(frame.document());
+ DCHECK(frame.document());
FormatBlockCommand* command = FormatBlockCommand::create(*frame.document(), qualifiedTagName);
command->apply();
return command->didApply();
@@ -531,7 +531,7 @@ static bool executeForwardDelete(LocalFrame& frame, Event*, EditorCommandSource
// Doesn't scroll to make the selection visible, or modify the kill ring.
// ForwardDelete is not implemented in IE or Firefox, so this behavior is only needed for
// backward compatibility with ourselves, and for consistency with Delete.
- ASSERT(frame.document());
+ DCHECK(frame.document());
TypingCommand::forwardDeleteKeyPressed(*frame.document(), &editingState);
if (editingState.isAborted())
return false;
@@ -549,7 +549,7 @@ static bool executeIgnoreSpelling(LocalFrame& frame, Event*, EditorCommandSource
static bool executeIndent(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return IndentOutdentCommand::create(*frame.document(), IndentOutdentCommand::Indent)->apply();
}
@@ -560,7 +560,7 @@ static bool executeInsertBacktab(LocalFrame& frame, Event* event, EditorCommandS
static bool executeInsertHorizontalRule(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
HTMLHRElement* rule = HTMLHRElement::create(*frame.document());
if (!value.isEmpty())
rule->setIdAttribute(AtomicString(value));
@@ -569,13 +569,13 @@ static bool executeInsertHorizontalRule(LocalFrame& frame, Event*, EditorCommand
static bool executeInsertHTML(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return executeInsertFragment(frame, createFragmentFromMarkup(*frame.document(), value, ""));
}
static bool executeInsertImage(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
HTMLImageElement* image = HTMLImageElement::create(*frame.document());
if (!value.isEmpty())
image->setSrc(value);
@@ -591,7 +591,7 @@ static bool executeInsertLineBreak(LocalFrame& frame, Event* event, EditorComman
// Doesn't scroll to make the selection visible, or modify the kill ring.
// InsertLineBreak is not implemented in IE or Firefox, so this behavior is only needed for
// backward compatibility with ourselves, and for consistency with other commands.
- ASSERT(frame.document());
+ DCHECK(frame.document());
return TypingCommand::insertLineBreak(*frame.document());
}
ASSERT_NOT_REACHED();
@@ -606,19 +606,19 @@ static bool executeInsertNewline(LocalFrame& frame, Event* event, EditorCommandS
static bool executeInsertNewlineInQuotedContent(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return TypingCommand::insertParagraphSeparatorInQuotedContent(*frame.document());
}
static bool executeInsertOrderedList(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return InsertListCommand::create(*frame.document(), InsertListCommand::OrderedList)->apply();
}
static bool executeInsertParagraph(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return TypingCommand::insertParagraphSeparator(*frame.document());
}
@@ -629,14 +629,14 @@ static bool executeInsertTab(LocalFrame& frame, Event* event, EditorCommandSourc
static bool executeInsertText(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
TypingCommand::insertText(*frame.document(), value, 0);
return true;
}
static bool executeInsertUnorderedList(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return InsertListCommand::create(*frame.document(), InsertListCommand::UnorderedList)->apply();
}
@@ -984,7 +984,7 @@ static bool executeMoveToRightEndOfLineAndModifySelection(LocalFrame& frame, Eve
static bool executeOutdent(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return IndentOutdentCommand::create(*frame.document(), IndentOutdentCommand::Outdent)->apply();
}
@@ -1204,7 +1204,7 @@ static bool executeUndo(LocalFrame& frame, Event*, EditorCommandSource, const St
static bool executeUnlink(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- ASSERT(frame.document());
+ DCHECK(frame.document());
return UnlinkCommand::create(*frame.document())->apply();
}
@@ -1735,9 +1735,9 @@ Editor::Command::Command(const EditorInternalCommand* command, EditorCommandSour
{
// Use separate assertions so we can tell which bad thing happened.
if (!command)
- ASSERT(!m_frame);
+ DCHECK(!m_frame);
else
- ASSERT(m_frame);
+ DCHECK(m_frame);
}
bool Editor::Command::execute(const String& parameter, Event* triggeringEvent) const

Powered by Google App Engine
This is Rietveld 408576698