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

Unified Diff: third_party/WebKit/Source/core/events/EventPath.cpp

Issue 2270293002: Replace ASSERT*() with DCHECK*() in core/events/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isUnreachableNode -> checkReachableNode Created 4 years, 4 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/events/EventPath.cpp
diff --git a/third_party/WebKit/Source/core/events/EventPath.cpp b/third_party/WebKit/Source/core/events/EventPath.cpp
index d9b95f3f7b5f1f27281a8bf7c0b49b5224577155..5347b62cf18070216d145f7fc49bd055883a5330 100644
--- a/third_party/WebKit/Source/core/events/EventPath.cpp
+++ b/third_party/WebKit/Source/core/events/EventPath.cpp
@@ -42,7 +42,7 @@ namespace blink {
EventTarget* EventPath::eventTargetRespectingTargetRules(Node& referenceNode)
{
if (referenceNode.isPseudoElement()) {
- ASSERT(referenceNode.parentNode());
+ DCHECK(referenceNode.parentNode());
return referenceNode.parentNode();
}
@@ -103,8 +103,8 @@ void EventPath::initialize()
void EventPath::calculatePath()
{
- ASSERT(m_node);
- ASSERT(m_nodeEventContexts.isEmpty());
+ DCHECK(m_node);
+ DCHECK(m_nodeEventContexts.isEmpty());
m_node->updateDistribution();
// For performance and memory usage reasons we want to store the
@@ -133,7 +133,7 @@ void EventPath::calculatePath()
for (const auto& insertionPoint : insertionPoints) {
if (insertionPoint->isShadowInsertionPoint()) {
ShadowRoot* containingShadowRoot = insertionPoint->containingShadowRoot();
- ASSERT(containingShadowRoot);
+ DCHECK(containingShadowRoot);
if (!containingShadowRoot->isOldest())
nodesInPath.append(containingShadowRoot->olderShadowRoot());
}
@@ -182,14 +182,15 @@ void EventPath::calculateTreeOrderAndSetNearestAncestorClosedTree()
// http://w3c.github.io/webcomponents/spec/shadow/
TreeScope* parent = treeScopeEventContext.get()->treeScope().olderShadowRootOrParentTreeScope();
if (!parent) {
- ASSERT(!rootTree);
+ DCHECK(!rootTree);
rootTree = treeScopeEventContext.get();
continue;
}
+ // TODO(tkent): Add a stream printer for HashMap::iterator.
ASSERT(treeScopeEventContextMap.find(parent) != treeScopeEventContextMap.end());
treeScopeEventContextMap.find(parent)->value->addChild(*treeScopeEventContext.get());
}
- ASSERT(rootTree);
+ DCHECK(rootTree);
rootTree->calculateTreeOrderAndSetNearestAncestorClosedTree(0, nullptr);
}
@@ -232,7 +233,7 @@ void EventPath::calculateAdjustedTargets()
if (lastTreeScope != &currentTreeScope) {
lastTreeScopeEventContext = ensureTreeScopeEventContext(currentNode, &currentTreeScope, treeScopeEventContextMap);
}
- ASSERT(lastTreeScopeEventContext);
+ DCHECK(lastTreeScopeEventContext);
at(i).setTreeScopeEventContext(lastTreeScopeEventContext);
lastTreeScope = &currentTreeScope;
}
@@ -263,7 +264,7 @@ EventTarget* EventPath::findRelatedNode(TreeScope& scope, RelatedTargetMap& rela
break;
}
}
- ASSERT(relatedNode);
+ DCHECK(relatedNode);
for (const auto& entry : parentTreeScopes)
relatedTargetMap.add(entry, relatedNode);
@@ -290,7 +291,7 @@ void EventPath::retargetRelatedTarget(const Node& relatedTargetNode)
for (const auto& treeScopeEventContext : m_treeScopeEventContexts) {
EventTarget* adjustedRelatedTarget = findRelatedNode(treeScopeEventContext->treeScope(), relatedNodeMap);
- ASSERT(adjustedRelatedTarget);
+ DCHECK(adjustedRelatedTarget);
treeScopeEventContext.get()->setRelatedTarget(adjustedRelatedTarget);
}
}
@@ -327,7 +328,7 @@ void EventPath::adjustForTouchEvent(TouchEvent& touchEvent)
adjustTouchList(touchEvent.targetTouches(), adjustedTargetTouches, treeScopes);
adjustTouchList(touchEvent.changedTouches(), adjustedChangedTouches, treeScopes);
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
for (const auto& treeScopeEventContext : m_treeScopeEventContexts) {
TreeScope& treeScope = treeScopeEventContext->treeScope();
TouchEventContext* touchEventContext = treeScopeEventContext->touchEventContext();
@@ -361,22 +362,22 @@ void EventPath::adjustTouchList(const TouchList* touchList, HeapVector<Member<To
const NodeEventContext& EventPath::topNodeEventContext()
{
- ASSERT(!isEmpty());
+ DCHECK(!isEmpty());
return last();
}
void EventPath::ensureWindowEventContext()
{
- ASSERT(m_event);
+ DCHECK(m_event);
if (!m_windowEventContext)
m_windowEventContext = new WindowEventContext(*m_event, topNodeEventContext());
}
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList)
{
for (size_t i = 0; i < touchList.length(); ++i)
- ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope));
+ DCHECK(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope));
}
#endif
« no previous file with comments | « third_party/WebKit/Source/core/events/EventPath.h ('k') | third_party/WebKit/Source/core/events/EventSender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698