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

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: 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/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 a4d52c5b2440d93b33cc288d839d0bd50a0b6da5..f15fdc4ac54e09c466cc4e32d90154ad3e2e1ce7 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");
Element* editableRoot = selection.rootEditableElement();
- ASSERT(editableRoot);
+ DCHECK(editableRoot);
if (!editableRoot)
return;
@@ -284,7 +284,7 @@ void ReplacementFragment::insertNodeBefore(Node* node, Node* refNode)
HTMLElement* ReplacementFragment::insertFragmentForTestRendering(Element* rootEditableElement)
{
TRACE_EVENT0("blink", "ReplacementFragment::insertFragmentForTestRendering");
- ASSERT(m_document);
+ DCHECK(m_document);
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;">
@@ -974,8 +974,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;
@@ -1041,7 +1041,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())
@@ -1074,7 +1074,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)) << br;
// Insert content between the two blockquotes, but remove the br (since it was just a placeholder).
insertionPos = positionInParentBeforeNode(*br);
removeNode(br, editingState);
@@ -1102,7 +1102,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) && !startIsInsideMailBlockquote) {
- ASSERT(enclosingBlockOfInsertionPos != currentRoot);
+ DCHECK_NE(enclosingBlockOfInsertionPos, currentRoot);
VisiblePosition visibleInsertionPos = createVisiblePosition(insertionPos);
if (isEndOfBlock(visibleInsertionPos) && !(isStartOfBlock(visibleInsertionPos) && fragment.hasInterchangeNewlineAtEnd()))
insertionPos = positionInParentAfterNode(*enclosingBlockOfInsertionPos);
@@ -1174,7 +1174,7 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
InsertedNodes insertedNodes;
Node* refNode = fragment.firstChild();
- ASSERT(refNode);
+ DCHECK(refNode);
Node* node = refNode->nextSibling();
fragment.removeNode(refNode);
@@ -1491,7 +1491,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