Chromium Code Reviews| Index: third_party/WebKit/Source/core/events/TreeScopeEventContext.h |
| diff --git a/third_party/WebKit/Source/core/events/TreeScopeEventContext.h b/third_party/WebKit/Source/core/events/TreeScopeEventContext.h |
| index 8f01f7eb66cda1d106cf0550bfb840244d8b92f0..45b4ff766e9ba75aa51c225d2889d65e56e838a8 100644 |
| --- a/third_party/WebKit/Source/core/events/TreeScopeEventContext.h |
| +++ b/third_party/WebKit/Source/core/events/TreeScopeEventContext.h |
| @@ -64,7 +64,7 @@ public: |
| bool isInclusiveAncestorOf(const TreeScopeEventContext&) const; |
| bool isDescendantOf(const TreeScopeEventContext&) const; |
| -#if ENABLE(ASSERT) |
| +#if DCHECK_IS_ON() |
| bool isExclusivePartOf(const TreeScopeEventContext&) const; |
| #endif |
| void addChild(TreeScopeEventContext& child) { m_children.append(&child); } |
| @@ -78,7 +78,7 @@ public: |
| private: |
| TreeScopeEventContext(TreeScope&); |
| -#if ENABLE(ASSERT) |
| +#if DCHECK_IS_ON() |
| bool isUnreachableNode(EventTarget&); |
| #endif |
| @@ -97,7 +97,7 @@ private: |
| int m_postOrder; |
| }; |
| -#if ENABLE(ASSERT) |
| +#if DCHECK_IS_ON() |
| inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) |
| { |
| // FIXME: Checks also for SVG elements. |
| @@ -107,34 +107,47 @@ inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) |
| inline void TreeScopeEventContext::setTarget(EventTarget* target) |
| { |
| - ASSERT(target); |
| - ASSERT(!isUnreachableNode(*target)); |
| +#if DCHECK_IS_ON() |
| + DCHECK(target); |
|
hayato
2016/08/24 03:42:27
You do not have to guard DCHECK(target) by DCHECK_
tkent
2016/08/24 06:05:23
You're right.
I reconsidered isUnreachableNode(),
|
| + DCHECK(!isUnreachableNode(*target)); |
| +#endif |
| m_target = target; |
| } |
| inline void TreeScopeEventContext::setRelatedTarget(EventTarget* relatedTarget) |
| { |
| - ASSERT(relatedTarget); |
| - ASSERT(!isUnreachableNode(*relatedTarget)); |
| +#if DCHECK_IS_ON() |
| + DCHECK(relatedTarget); |
|
hayato
2016/08/24 03:42:27
You do not have to guard DCHECK(relataedTarget) by
|
| + DCHECK(!isUnreachableNode(*relatedTarget)); |
| +#endif |
| m_relatedTarget = relatedTarget; |
| } |
| inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventContext& other) const |
| { |
| - ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1); |
| + DCHECK_NE(m_preOrder, -1); |
| + DCHECK_NE(m_postOrder, -1); |
| + DCHECK_NE(other.m_preOrder, -1); |
| + DCHECK_NE(other.m_postOrder, -1); |
| return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; |
| } |
| inline bool TreeScopeEventContext::isDescendantOf(const TreeScopeEventContext& other) const |
| { |
| - ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1); |
| + DCHECK_NE(m_preOrder, -1); |
| + DCHECK_NE(m_postOrder, -1); |
| + DCHECK_NE(other.m_preOrder, -1); |
| + DCHECK_NE(other.m_postOrder, -1); |
| return other.m_preOrder < m_preOrder && m_postOrder < other.m_postOrder; |
| } |
| -#if ENABLE(ASSERT) |
| +#if DCHECK_IS_ON() |
| inline bool TreeScopeEventContext::isExclusivePartOf(const TreeScopeEventContext& other) const |
| { |
| - ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1); |
| + DCHECK_NE(m_preOrder, -1); |
| + DCHECK_NE(m_postOrder, -1); |
| + DCHECK_NE(other.m_preOrder, -1); |
| + DCHECK_NE(other.m_postOrder, -1); |
| return (m_preOrder < other.m_preOrder && m_postOrder < other.m_preOrder) |
| || (m_preOrder > other.m_preOrder && m_preOrder > other.m_postOrder); |
| } |