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

Side by Side Diff: Source/core/events/TreeScopeEventContext.h

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/events/EventSender.h ('k') | Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All Rights Reserved. 2 * Copyright (C) 2014 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bool isInclusiveAncestorOf(const TreeScopeEventContext&); 65 bool isInclusiveAncestorOf(const TreeScopeEventContext&);
66 void addChild(TreeScopeEventContext& child) { m_children.append(&child); } 66 void addChild(TreeScopeEventContext& child) { m_children.append(&child); }
67 67
68 // For ancestor-descendant relationship check in Q(1). 68 // For ancestor-descendant relationship check in Q(1).
69 // Preprocessing takes O(N). 69 // Preprocessing takes O(N).
70 int calculatePrePostOrderNumber(int orderNumber); 70 int calculatePrePostOrderNumber(int orderNumber);
71 71
72 private: 72 private:
73 TreeScopeEventContext(TreeScope&); 73 TreeScopeEventContext(TreeScope&);
74 74
75 #ifndef NDEBUG 75 #if ENABLE(ASSERT)
76 bool isUnreachableNode(EventTarget&); 76 bool isUnreachableNode(EventTarget&);
77 #endif 77 #endif
78 78
79 RawPtrWillBeMember<TreeScope> m_treeScope; 79 RawPtrWillBeMember<TreeScope> m_treeScope;
80 RefPtrWillBeMember<EventTarget> m_target; 80 RefPtrWillBeMember<EventTarget> m_target;
81 RefPtrWillBeMember<EventTarget> m_relatedTarget; 81 RefPtrWillBeMember<EventTarget> m_relatedTarget;
82 RefPtrWillBeMember<StaticNodeList> m_eventPath; 82 RefPtrWillBeMember<StaticNodeList> m_eventPath;
83 RefPtrWillBeMember<TouchEventContext> m_touchEventContext; 83 RefPtrWillBeMember<TouchEventContext> m_touchEventContext;
84 84
85 WillBeHeapVector<RawPtrWillBeMember<TreeScopeEventContext> > m_children; 85 WillBeHeapVector<RawPtrWillBeMember<TreeScopeEventContext> > m_children;
86 int m_preOrder; 86 int m_preOrder;
87 int m_postOrder; 87 int m_postOrder;
88 }; 88 };
89 89
90 #ifndef NDEBUG 90 #if ENABLE(ASSERT)
91 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) 91 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target)
92 { 92 {
93 // FIXME: Checks also for SVG elements. 93 // FIXME: Checks also for SVG elements.
94 return target.toNode() && !target.toNode()->isSVGElement() && !target.toNode ()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope ()); 94 return target.toNode() && !target.toNode()->isSVGElement() && !target.toNode ()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope ());
95 } 95 }
96 #endif 96 #endif
97 97
98 inline void TreeScopeEventContext::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target) 98 inline void TreeScopeEventContext::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target)
99 { 99 {
100 ASSERT(target); 100 ASSERT(target);
(...skipping 10 matching lines...) Expand all
111 111
112 inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventCon text& other) 112 inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventCon text& other)
113 { 113 {
114 ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && ot her.m_postOrder != -1); 114 ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && ot her.m_postOrder != -1);
115 return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; 115 return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder;
116 } 116 }
117 117
118 } 118 }
119 119
120 #endif // TreeScopeEventContext_h 120 #endif // TreeScopeEventContext_h
OLDNEW
« no previous file with comments | « Source/core/events/EventSender.h ('k') | Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698