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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 225823007: Migrate wheel events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/dom/DocumentMarkerController.h" 57 #include "core/dom/DocumentMarkerController.h"
58 #include "core/dom/Element.h" 58 #include "core/dom/Element.h"
59 #include "core/dom/ExceptionCode.h" 59 #include "core/dom/ExceptionCode.h"
60 #include "core/dom/FullscreenElementStack.h" 60 #include "core/dom/FullscreenElementStack.h"
61 #include "core/dom/NodeRenderStyle.h" 61 #include "core/dom/NodeRenderStyle.h"
62 #include "core/dom/PseudoElement.h" 62 #include "core/dom/PseudoElement.h"
63 #include "core/dom/Range.h" 63 #include "core/dom/Range.h"
64 #include "core/dom/StaticNodeList.h" 64 #include "core/dom/StaticNodeList.h"
65 #include "core/dom/TreeScope.h" 65 #include "core/dom/TreeScope.h"
66 #include "core/dom/ViewportDescription.h" 66 #include "core/dom/ViewportDescription.h"
67 #include "core/dom/WheelController.h"
68 #include "core/dom/shadow/ComposedTreeWalker.h" 67 #include "core/dom/shadow/ComposedTreeWalker.h"
69 #include "core/dom/shadow/ElementShadow.h" 68 #include "core/dom/shadow/ElementShadow.h"
70 #include "core/dom/shadow/SelectRuleFeatureSet.h" 69 #include "core/dom/shadow/SelectRuleFeatureSet.h"
71 #include "core/dom/shadow/ShadowRoot.h" 70 #include "core/dom/shadow/ShadowRoot.h"
72 #include "core/editing/Editor.h" 71 #include "core/editing/Editor.h"
73 #include "core/editing/PlainTextRange.h" 72 #include "core/editing/PlainTextRange.h"
74 #include "core/editing/SpellCheckRequester.h" 73 #include "core/editing/SpellCheckRequester.h"
75 #include "core/editing/SpellChecker.h" 74 #include "core/editing/SpellChecker.h"
76 #include "core/editing/SurroundingText.h" 75 #include "core/editing/SurroundingText.h"
77 #include "core/editing/TextIterator.h" 76 #include "core/editing/TextIterator.h"
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 } 1245 }
1247 1246
1248 return document->activeDOMObjectCount(); 1247 return document->activeDOMObjectCount();
1249 } 1248 }
1250 1249
1251 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass) 1250 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass)
1252 { 1251 {
1253 if (!document.frameHost()) 1252 if (!document.frameHost())
1254 return 0; 1253 return 0;
1255 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry (); 1254 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry ();
1256 unsigned count = 0; 1255 unsigned count = registry->externalEventHandlerCount(handlerClass);
1257 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass); 1256 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass);
1258 if (targets) { 1257 if (targets) {
1259 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) 1258 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter)
1260 count += iter->value; 1259 count += iter->value;
1261 } 1260 }
1262 return count; 1261 return count;
1263 } 1262 }
1264 1263
1265 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e xceptionState) 1264 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e xceptionState)
1266 { 1265 {
1267 if (!document) { 1266 if (!document) {
1268 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available."); 1267 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available.");
1269 return 0; 1268 return 0;
1270 } 1269 }
1271 1270
1272 return WheelController::from(*document)->wheelEventHandlerCount(); 1271 return eventHandlerCount(*document, EventHandlerRegistry::WheelEvent);
1273 } 1272 }
1274 1273
1275 unsigned Internals::scrollEventHandlerCount(Document* document, ExceptionState& exceptionState) 1274 unsigned Internals::scrollEventHandlerCount(Document* document, ExceptionState& exceptionState)
1276 { 1275 {
1277 if (!document) { 1276 if (!document) {
1278 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available."); 1277 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available.");
1279 return 0; 1278 return 0;
1280 } 1279 }
1281 1280
1282 return eventHandlerCount(*document, EventHandlerRegistry::ScrollEvent); 1281 return eventHandlerCount(*document, EventHandlerRegistry::ScrollEvent);
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 } else if (type == "none") { 2362 } else if (type == "none") {
2364 webtype = blink::ConnectionTypeNone; 2363 webtype = blink::ConnectionTypeNone;
2365 } else { 2364 } else {
2366 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type)); 2365 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type));
2367 return; 2366 return;
2368 } 2367 }
2369 networkStateNotifier().setWebConnectionTypeForTest(webtype); 2368 networkStateNotifier().setWebConnectionTypeForTest(webtype);
2370 } 2369 }
2371 2370
2372 } // namespace WebCore 2371 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698