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

Side by Side Diff: third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp

Issue 2393313002: reflow comments in core/frame (Closed)
Patch Set: tweak Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/EventHandlerRegistry.h" 5 #include "core/frame/EventHandlerRegistry.h"
6 6
7 #include "core/events/EventListenerOptions.h" 7 #include "core/events/EventListenerOptions.h"
8 #include "core/events/EventUtil.h" 8 #include "core/events/EventUtil.h"
9 #include "core/frame/LocalDOMWindow.h" 9 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 for (const auto& eventTarget : *targets) { 293 for (const auto& eventTarget : *targets) {
294 if (Node* node = eventTarget.key->toNode()) { 294 if (Node* node = eventTarget.key->toNode()) {
295 for (Document* doc = &node->document(); doc; 295 for (Document* doc = &node->document(); doc;
296 doc = doc->localOwner() ? &doc->localOwner()->document() : 0) { 296 doc = doc->localOwner() ? &doc->localOwner()->document() : 0) {
297 if (doc == &document) { 297 if (doc == &document) {
298 targetsToRemove.append(eventTarget.key); 298 targetsToRemove.append(eventTarget.key);
299 break; 299 break;
300 } 300 }
301 } 301 }
302 } else if (eventTarget.key->toLocalDOMWindow()) { 302 } else if (eventTarget.key->toLocalDOMWindow()) {
303 // DOMWindows may outlive their documents, so we shouldn't remove their handlers 303 // DOMWindows may outlive their documents, so we shouldn't remove their
304 // here. 304 // handlers here.
305 } else { 305 } else {
306 ASSERT_NOT_REACHED(); 306 ASSERT_NOT_REACHED();
307 } 307 }
308 } 308 }
309 for (size_t i = 0; i < targetsToRemove.size(); ++i) 309 for (size_t i = 0; i < targetsToRemove.size(); ++i)
310 updateEventHandlerInternal(RemoveAll, handlerClass, targetsToRemove[i]); 310 updateEventHandlerInternal(RemoveAll, handlerClass, targetsToRemove[i]);
311 } 311 }
312 } 312 }
313 313
314 void EventHandlerRegistry::checkConsistency() const { 314 void EventHandlerRegistry::checkConsistency() const {
315 #if ENABLE(ASSERT) 315 #if ENABLE(ASSERT)
316 for (size_t i = 0; i < EventHandlerClassCount; ++i) { 316 for (size_t i = 0; i < EventHandlerClassCount; ++i) {
317 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); 317 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
318 const EventTargetSet* targets = &m_targets[handlerClass]; 318 const EventTargetSet* targets = &m_targets[handlerClass];
319 for (const auto& eventTarget : *targets) { 319 for (const auto& eventTarget : *targets) {
320 if (Node* node = eventTarget.key->toNode()) { 320 if (Node* node = eventTarget.key->toNode()) {
321 // See the comment for |documentDetached| if either of these assertions fails. 321 // See the comment for |documentDetached| if either of these assertions
322 // fails.
322 ASSERT(node->document().frameHost()); 323 ASSERT(node->document().frameHost());
323 ASSERT(node->document().frameHost() == m_frameHost); 324 ASSERT(node->document().frameHost() == m_frameHost);
324 } else if (LocalDOMWindow* window = eventTarget.key->toLocalDOMWindow()) { 325 } else if (LocalDOMWindow* window = eventTarget.key->toLocalDOMWindow()) {
325 // If any of these assertions fail, LocalDOMWindow failed to unregister its handlers 326 // If any of these assertions fail, LocalDOMWindow failed to unregister
326 // properly. 327 // its handlers properly.
327 ASSERT(window->frame()); 328 ASSERT(window->frame());
328 ASSERT(window->frame()->host()); 329 ASSERT(window->frame()->host());
329 ASSERT(window->frame()->host() == m_frameHost); 330 ASSERT(window->frame()->host() == m_frameHost);
330 } 331 }
331 } 332 }
332 } 333 }
333 #endif // ENABLE(ASSERT) 334 #endif // ENABLE(ASSERT)
334 } 335 }
335 336
336 } // namespace blink 337 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/EventHandlerRegistry.h ('k') | third_party/WebKit/Source/core/frame/Frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698