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

Side by Side Diff: Source/core/dom/ContainerNode.h

Issue 301173006: Move NoEventDispatchAssertion class to its own file (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add missing include Created 6 years, 6 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 | « no previous file | Source/core/dom/ContainerNode.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef ContainerNode_h 24 #ifndef ContainerNode_h
25 #define ContainerNode_h 25 #define ContainerNode_h
26 26
27 #include "bindings/v8/ExceptionStatePlaceholder.h" 27 #include "bindings/v8/ExceptionStatePlaceholder.h"
28 #include "core/dom/Node.h" 28 #include "core/dom/Node.h"
29 #include "wtf/OwnPtr.h" 29 #include "wtf/OwnPtr.h"
30 #include "wtf/TemporaryChange.h"
31 #include "wtf/Vector.h" 30 #include "wtf/Vector.h"
32 31
33 namespace WebCore { 32 namespace WebCore {
34 33
35 class ExceptionState; 34 class ExceptionState;
36 class FloatPoint; 35 class FloatPoint;
37 class HTMLCollection; 36 class HTMLCollection;
38 37
39 namespace Private { 38 namespace Private {
40 template<class GenericNode, class GenericNodeContainer> 39 template<class GenericNode, class GenericNodeContainer>
41 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Ge nericNodeContainer&); 40 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Ge nericNodeContainer&);
42 } 41 }
43 42
44 #ifndef NDEBUG
45 // FIXME: Move this class to its own file.
46 class NoEventDispatchAssertion {
47 public:
48 NoEventDispatchAssertion()
49 {
50 if (!isMainThread())
51 return;
52 s_count++;
53 }
54
55 ~NoEventDispatchAssertion()
56 {
57 if (!isMainThread())
58 return;
59 ASSERT(s_count);
60 s_count--;
61 }
62
63 static bool isEventDispatchForbidden()
64 {
65 if (!isMainThread())
66 return false;
67 return s_count;
68 }
69
70 // It's safe to dispatch events in SVGImage since there can't be any script
71 // listeners.
72 class AllowSVGImageEvents {
73 public:
74 AllowSVGImageEvents()
75 : m_change(s_count, 0)
76 {
77 }
78
79 ~AllowSVGImageEvents()
80 {
81 ASSERT(!s_count);
82 }
83
84 TemporaryChange<unsigned> m_change;
85 };
86
87 private:
88 static unsigned s_count;
89 };
90 #else
91 class NoEventDispatchAssertion {
92 public:
93 NoEventDispatchAssertion() { }
94 class AllowSVGImageEvents {
95 public:
96 AllowSVGImageEvents() { }
97 };
98 };
99 #endif
100
101 enum DynamicRestyleFlags { 43 enum DynamicRestyleFlags {
102 ChildrenAffectedByFocus = 1 << 0, 44 ChildrenAffectedByFocus = 1 << 0,
103 ChildrenAffectedByHover = 1 << 1, 45 ChildrenAffectedByHover = 1 << 1,
104 ChildrenAffectedByActive = 1 << 2, 46 ChildrenAffectedByActive = 1 << 2,
105 ChildrenAffectedByDrag = 1 << 3, 47 ChildrenAffectedByDrag = 1 << 3,
106 ChildrenAffectedByFirstChildRules = 1 << 4, 48 ChildrenAffectedByFirstChildRules = 1 << 4,
107 ChildrenAffectedByLastChildRules = 1 << 5, 49 ChildrenAffectedByLastChildRules = 1 << 5,
108 ChildrenAffectedByDirectAdjacentRules = 1 << 6, 50 ChildrenAffectedByDirectAdjacentRules = 1 << 6,
109 ChildrenAffectedByIndirectAdjacentRules = 1 << 7, 51 ChildrenAffectedByIndirectAdjacentRules = 1 << 7,
110 ChildrenAffectedByForwardPositionalRules = 1 << 8, 52 ChildrenAffectedByForwardPositionalRules = 1 << 8,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 inline void getChildNodes(Node& node, NodeVector& nodes) 307 inline void getChildNodes(Node& node, NodeVector& nodes)
366 { 308 {
367 ASSERT(!nodes.size()); 309 ASSERT(!nodes.size());
368 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 310 for (Node* child = node.firstChild(); child; child = child->nextSibling())
369 nodes.append(child); 311 nodes.append(child);
370 } 312 }
371 313
372 } // namespace WebCore 314 } // namespace WebCore
373 315
374 #endif // ContainerNode_h 316 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698