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

Unified Diff: third_party/WebKit/Source/core/editing/serializers/Serialization.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/serializers/Serialization.cpp
diff --git a/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp b/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp
index 4e748dbb4e433e110d4325169d36389238963aa0..80e06949d7fcf76f1cb4149d65cf997f81afd57f 100644
--- a/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp
+++ b/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp
@@ -127,7 +127,7 @@ static void completeURLs(DocumentFragment& fragment, const String& baseURL)
static bool isHTMLBlockElement(const Node* node)
{
- ASSERT(node);
+ DCHECK(node);
return isHTMLTableCellElement(*node)
|| isNonTableCellHTMLBlockElement(node);
}
@@ -186,7 +186,7 @@ static HTMLElement* highestAncestorToWrapMarkup(const PositionTemplate<Strategy>
// For compatibility reason, we use container node of start and end
// positions rather than first node and last node in selection.
Node* commonAncestor = Strategy::commonAncestor(*startPosition.computeContainerNode(), *endPosition.computeContainerNode());
- ASSERT(commonAncestor);
+ DCHECK(commonAncestor);
HTMLElement* specialCommonAncestor = nullptr;
if (shouldAnnotate == AnnotateForInterchange) {
// Include ancestors that aren't completely inside the range but are required to retain
@@ -312,13 +312,13 @@ static void trimFragment(DocumentFragment* fragment, Comment* nodeBeforeContext,
continue;
}
next = NodeTraversal::nextSkippingChildren(*node);
- ASSERT(!node->contains(nodeAfterContext));
+ DCHECK(!node->contains(nodeAfterContext)) << node << " " << nodeAfterContext;
node->parentNode()->removeChild(node, ASSERT_NO_EXCEPTION);
if (nodeBeforeContext == node)
break;
}
- ASSERT(nodeAfterContext->parentNode());
+ DCHECK(nodeAfterContext->parentNode()) << nodeAfterContext;
for (Node* node = nodeAfterContext; node; node = next) {
next = NodeTraversal::nextSkippingChildren(*node);
node->parentNode()->removeChild(node, ASSERT_NO_EXCEPTION);
@@ -390,7 +390,7 @@ static void fillContainerFromString(ContainerNode* paragraph, const String& stri
return;
}
- ASSERT(string.find('\n') == kNotFound);
+ DCHECK_EQ(string.find('\n'), kNotFound) << string;
Vector<String> tabList;
string.split('\t', true, tabList);
@@ -423,7 +423,7 @@ static void fillContainerFromString(ContainerNode* paragraph, const String& stri
bool isPlainTextMarkup(Node* node)
{
- ASSERT(node);
+ DCHECK(node);
if (!isHTMLDivElement(*node))
return false;
@@ -515,7 +515,7 @@ DocumentFragment* createFragmentFromText(const EphemeralRange& context, const St
DocumentFragment* createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ParserContentPolicy parserContentPolicy, const char* method, ExceptionState& exceptionState)
{
- ASSERT(contextElement);
+ DCHECK(contextElement);
Document& document = isHTMLTemplateElement(*contextElement) ? contextElement->document().ensureTemplateDocument() : contextElement->document();
DocumentFragment* fragment = DocumentFragment::create(document);
@@ -569,7 +569,7 @@ static inline void removeElementPreservingChildren(DocumentFragment* fragment, H
static inline bool isSupportedContainer(Element* element)
{
- ASSERT(element);
+ DCHECK(element);
if (!element->isHTMLElement())
return true;
@@ -583,7 +583,7 @@ static inline bool isSupportedContainer(Element* element)
DocumentFragment* createContextualFragment(const String& markup, Element* element, ParserContentPolicy parserContentPolicy, ExceptionState& exceptionState)
{
- ASSERT(element);
+ DCHECK(element);
if (!isSupportedContainer(element)) {
exceptionState.throwDOMException(NotSupportedError, "The range's container is '" + element->localName() + "', which is not supported.");
return nullptr;
@@ -612,7 +612,7 @@ DocumentFragment* createContextualFragment(const String& markup, Element* elemen
void replaceChildrenWithFragment(ContainerNode* container, DocumentFragment* fragment, ExceptionState& exceptionState)
{
- ASSERT(container);
+ DCHECK(container);
ContainerNode* containerNode(container);
ChildListMutationScope mutation(*containerNode);
@@ -640,7 +640,7 @@ void replaceChildrenWithFragment(ContainerNode* container, DocumentFragment* fra
void replaceChildrenWithText(ContainerNode* container, const String& text, ExceptionState& exceptionState)
{
- ASSERT(container);
+ DCHECK(container);
ContainerNode* containerNode(container);
ChildListMutationScope mutation(*containerNode);
@@ -675,7 +675,7 @@ void replaceChildrenWithText(ContainerNode* container, const String& text, Excep
void mergeWithNextTextNode(Text* textNode, ExceptionState& exceptionState)
{
- ASSERT(textNode);
+ DCHECK(textNode);
Node* next = textNode->nextSibling();
if (!next || !next->isTextNode())
return;

Powered by Google App Engine
This is Rietveld 408576698