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

Unified Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp

Issue 1878473002: ASSERT -> DCHECK in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation. 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/ReplaceSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
index 9a7ab4a42ac715198bb47ff359f1e444f6066c0e..5381229b77020ab63a1f4adebf1d7e54dabed10f 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -158,7 +158,7 @@ ReplacementFragment::ReplacementFragment(Document* document, DocumentFragment* f
TRACE_EVENT0("blink", "ReplacementFragment constructor");
RawPtr<Element> editableRoot = selection.rootEditableElement();
- ASSERT(editableRoot);
+ DCHECK(editableRoot);
if (!editableRoot)
return;
@@ -284,7 +284,7 @@ void ReplacementFragment::insertNodeBefore(RawPtr<Node> node, Node* refNode)
RawPtr<HTMLElement> ReplacementFragment::insertFragmentForTestRendering(Element* rootEditableElement)
{
TRACE_EVENT0("blink", "ReplacementFragment::insertFragmentForTestRendering");
- ASSERT(m_document);
+ DCHECK(m_document);
RawPtr<HTMLElement> holder = createDefaultParagraphElement(*m_document.get());
holder->appendChild(m_fragment);
@@ -528,7 +528,7 @@ void ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline(Insert
if (element->isHTMLElement()) {
Vector<QualifiedName> attributes;
HTMLElement* htmlElement = toHTMLElement(element);
- ASSERT(htmlElement);
+ DCHECK(htmlElement);
if (newInlineStyle->conflictsWithImplicitStyleOfElement(htmlElement)) {
// e.g. <b style="font-weight: normal;"> is converted to <span style="font-weight: normal;">
@@ -977,8 +977,8 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
{
TRACE_EVENT0("blink", "ReplaceSelectionCommand::doApply");
const VisibleSelection selection = endingSelection();
- ASSERT(selection.isCaretOrRange());
- ASSERT(selection.start().anchorNode());
+ DCHECK(selection.isCaretOrRange());
+ DCHECK(selection.start().anchorNode());
if (!selection.isNonOrphanedCaretOrRange() || !selection.start().anchorNode())
return;
@@ -1044,7 +1044,7 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
return;
}
} else {
- ASSERT(selection.isCaret());
+ DCHECK(selection.isCaret());
if (fragment.hasInterchangeNewlineAtStart()) {
const VisiblePosition next = nextPositionOf(visibleStart, CannotCrossEditingBoundary);
if (isEndOfParagraph(visibleStart) && !isStartOfParagraph(visibleStart) && next.isNotNull())
@@ -1077,7 +1077,7 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
return;
// This will leave a br between the split.
Node* br = endingSelection().start().anchorNode();
- ASSERT(isHTMLBRElement(br));
+ DCHECK(isHTMLBRElement(br));
// Insert content between the two blockquotes, but remove the br (since it was just a placeholder).
insertionPos = positionInParentBeforeNode(*br);
removeNode(br, editingState);
@@ -1105,7 +1105,7 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
// Adjust insertionPos to prevent nesting.
// If the start was in a Mail blockquote, we will have already handled adjusting insertionPos above.
if (m_preventNesting && enclosingBlockOfInsertionPos && !isTableCell(enclosingBlockOfInsertionPos.get()) && !startIsInsideMailBlockquote) {
- ASSERT(enclosingBlockOfInsertionPos != currentRoot);
+ DCHECK_NE(enclosingBlockOfInsertionPos, currentRoot);
VisiblePosition visibleInsertionPos = createVisiblePosition(insertionPos);
if (isEndOfBlock(visibleInsertionPos) && !(isStartOfBlock(visibleInsertionPos) && fragment.hasInterchangeNewlineAtEnd()))
insertionPos = positionInParentAfterNode(*enclosingBlockOfInsertionPos);
@@ -1177,7 +1177,7 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
InsertedNodes insertedNodes;
RawPtr<Node> refNode = fragment.firstChild();
- ASSERT(refNode);
+ DCHECK(refNode);
RawPtr<Node> node = refNode->nextSibling();
fragment.removeNode(refNode);
@@ -1494,7 +1494,7 @@ void ReplaceSelectionCommand::completeHTMLReplacement(const Position &lastPositi
rebalanceWhitespaceAt(end);
if (m_matchStyle) {
- ASSERT(m_insertionStyle);
+ DCHECK(m_insertionStyle);
applyStyle(m_insertionStyle.get(), start, end, editingState);
if (editingState->isAborted())
return;

Powered by Google App Engine
This is Rietveld 408576698