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

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

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: One more unneeded include. Created 6 years, 8 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('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) 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "core/css/resolver/StyleResolver.h" 50 #include "core/css/resolver/StyleResolver.h"
51 #include "core/css/resolver/StyleResolverStats.h" 51 #include "core/css/resolver/StyleResolverStats.h"
52 #include "core/css/resolver/ViewportStyleResolver.h" 52 #include "core/css/resolver/ViewportStyleResolver.h"
53 #include "core/dom/ClientRect.h" 53 #include "core/dom/ClientRect.h"
54 #include "core/dom/ClientRectList.h" 54 #include "core/dom/ClientRectList.h"
55 #include "core/dom/DOMStringList.h" 55 #include "core/dom/DOMStringList.h"
56 #include "core/dom/Document.h" 56 #include "core/dom/Document.h"
57 #include "core/dom/DocumentMarker.h" 57 #include "core/dom/DocumentMarker.h"
58 #include "core/dom/DocumentMarkerController.h" 58 #include "core/dom/DocumentMarkerController.h"
59 #include "core/dom/Element.h" 59 #include "core/dom/Element.h"
60 #include "core/dom/EventHandlerRegistry.h"
60 #include "core/dom/ExceptionCode.h" 61 #include "core/dom/ExceptionCode.h"
61 #include "core/dom/FullscreenElementStack.h" 62 #include "core/dom/FullscreenElementStack.h"
62 #include "core/dom/NodeRenderStyle.h" 63 #include "core/dom/NodeRenderStyle.h"
63 #include "core/dom/PseudoElement.h" 64 #include "core/dom/PseudoElement.h"
64 #include "core/dom/Range.h" 65 #include "core/dom/Range.h"
65 #include "core/dom/StaticNodeList.h" 66 #include "core/dom/StaticNodeList.h"
66 #include "core/dom/TreeScope.h" 67 #include "core/dom/TreeScope.h"
67 #include "core/dom/ViewportDescription.h" 68 #include "core/dom/ViewportDescription.h"
68 #include "core/dom/WheelController.h" 69 #include "core/dom/WheelController.h"
69 #include "core/dom/shadow/ComposedTreeWalker.h" 70 #include "core/dom/shadow/ComposedTreeWalker.h"
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 unsigned Internals::activeDOMObjectCount(Document* document, ExceptionState& exc eptionState) 1272 unsigned Internals::activeDOMObjectCount(Document* document, ExceptionState& exc eptionState)
1272 { 1273 {
1273 if (!document) { 1274 if (!document) {
1274 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available."); 1275 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available.");
1275 return 0; 1276 return 0;
1276 } 1277 }
1277 1278
1278 return document->activeDOMObjectCount(); 1279 return document->activeDOMObjectCount();
1279 } 1280 }
1280 1281
1282 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass)
1283 {
1284 EventHandlerRegistry* registry = EventHandlerRegistry::from(document);
1285 unsigned count = 0;
1286 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass);
1287 if (targets) {
1288 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter)
1289 count += iter->value;
1290 }
1291 return count;
1292 }
1293
1281 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e xceptionState) 1294 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e xceptionState)
1282 { 1295 {
1283 if (!document) { 1296 if (!document) {
1284 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available."); 1297 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available.");
1285 return 0; 1298 return 0;
1286 } 1299 }
1287 1300
1288 return WheelController::from(*document)->wheelEventHandlerCount(); 1301 return WheelController::from(*document)->wheelEventHandlerCount();
1289 } 1302 }
1290 1303
1304 unsigned Internals::scrollEventHandlerCount(Document* document, ExceptionState& exceptionState)
1305 {
1306 if (!document) {
1307 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available.");
1308 return 0;
1309 }
1310
1311 return eventHandlerCount(*document, EventHandlerRegistry::ScrollEvent);
1312 }
1313
1291 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e xceptionState) 1314 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e xceptionState)
1292 { 1315 {
1293 if (!document) { 1316 if (!document) {
1294 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available."); 1317 exceptionState.throwDOMException(InvalidAccessError, "No context documen t is available.");
1295 return 0; 1318 return 0;
1296 } 1319 }
1297 1320
1298 const TouchEventTargetSet* touchHandlers = document->touchEventTargets(); 1321 const TouchEventTargetSet* touchHandlers = document->touchEventTargets();
1299 if (!touchHandlers) 1322 if (!touchHandlers)
1300 return 0; 1323 return 0;
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2493 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2471 { 2494 {
2472 if (!node) 2495 if (!node)
2473 return String(); 2496 return String();
2474 blink::WebPoint point(x, y); 2497 blink::WebPoint point(x, y);
2475 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2498 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2476 return surroundingText.content(); 2499 return surroundingText.content();
2477 } 2500 }
2478 2501
2479 } 2502 }
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698