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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h

Issue 2478573002: Make removeChild, parserRemoveChild and removeChildren more consistent. (Closed)
Patch Set: SubframeLoadingDisabler (oldChild) Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 public: 126 public:
127 explicit SubframeLoadingDisabler(Node& root) 127 explicit SubframeLoadingDisabler(Node& root)
128 : SubframeLoadingDisabler(&root) {} 128 : SubframeLoadingDisabler(&root) {}
129 129
130 explicit SubframeLoadingDisabler(Node* root) : m_root(root) { 130 explicit SubframeLoadingDisabler(Node* root) : m_root(root) {
131 if (m_root) 131 if (m_root)
132 disabledSubtreeRoots().add(m_root); 132 disabledSubtreeRoots().add(m_root);
133 } 133 }
134 134
135 ~SubframeLoadingDisabler() { 135 ~SubframeLoadingDisabler() { release(); }
136
137 void release() {
136 if (m_root) 138 if (m_root)
137 disabledSubtreeRoots().remove(m_root); 139 disabledSubtreeRoots().remove(m_root);
138 } 140 }
139 141
140 static bool canLoadFrame(HTMLFrameOwnerElement& owner) { 142 static bool canLoadFrame(HTMLFrameOwnerElement& owner) {
141 for (Node* node = &owner; node; node = node->parentOrShadowHostNode()) { 143 for (Node* node = &owner; node; node = node->parentOrShadowHostNode()) {
142 if (disabledSubtreeRoots().contains(node)) 144 if (disabledSubtreeRoots().contains(node))
143 return false; 145 return false;
144 } 146 }
145 return true; 147 return true;
146 } 148 }
147 149
148 private: 150 private:
149 using SubtreeRootSet = HeapHashCountedSet<Member<Node>>; 151 using SubtreeRootSet = HeapHashCountedSet<Member<Node>>;
150 152
151 CORE_EXPORT static SubtreeRootSet& disabledSubtreeRoots(); 153 CORE_EXPORT static SubtreeRootSet& disabledSubtreeRoots();
152 154
153 Member<Node> m_root; 155 Member<Node> m_root;
154 }; 156 };
155 157
156 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, 158 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement,
157 FrameOwner, 159 FrameOwner,
158 owner, 160 owner,
159 owner->isLocal(), 161 owner->isLocal(),
160 owner.isLocal()); 162 owner.isLocal());
161 163
162 } // namespace blink 164 } // namespace blink
163 165
164 #endif // HTMLFrameOwnerElement_h 166 #endif // HTMLFrameOwnerElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698