| 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 ed52221bb94198fa04fb720b9a08b47229ec284f..bf9e4c777ed62523d52e68e05f9511647ed3e5bc 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
|
| @@ -197,13 +197,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);
|
| @@ -322,7 +322,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();
|
| }
|
|
|
| @@ -360,7 +360,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;
|
| }
|
| @@ -420,7 +420,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;
|
| }
|
| @@ -480,7 +480,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();
|
| @@ -497,7 +497,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;
|
| @@ -515,7 +515,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();
|
| }
|
|
|
| @@ -526,7 +526,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));
|
| @@ -535,13 +535,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);
|
| @@ -557,7 +557,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();
|
| @@ -572,19 +572,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());
|
| }
|
|
|
| @@ -595,14 +595,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();
|
| }
|
|
|
| @@ -950,7 +950,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();
|
| }
|
|
|
| @@ -1170,7 +1170,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();
|
| }
|
|
|
| @@ -1682,10 +1682,10 @@ static const CommandMap& createCommandMap()
|
| #endif
|
| for (size_t i = 0; i < WTF_ARRAY_LENGTH(commands); ++i) {
|
| const CommandEntry& command = commands[i];
|
| - ASSERT(!commandMap.get(command.name));
|
| + DCHECK(!commandMap.get(command.name));
|
| commandMap.set(String(command.name), &command.command);
|
| -#if ENABLE(ASSERT)
|
| - ASSERT(!idSet.contains(command.command.idForUserMetrics));
|
| +#if DCHECK_IS_ON()
|
| + DCHECK(!idSet.contains(command.command.idForUserMetrics));
|
| idSet.add(command.command.idForUserMetrics);
|
| #endif
|
| }
|
| @@ -1763,9 +1763,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
|
|
|