OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Br
eakpoints")); | 454 WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Br
eakpoints")); |
455 | 455 |
456 this.categoriesElement = document.createElement("ol"); | 456 this.categoriesElement = document.createElement("ol"); |
457 this.categoriesElement.tabIndex = 0; | 457 this.categoriesElement.tabIndex = 0; |
458 this.categoriesElement.addStyleClass("properties-tree"); | 458 this.categoriesElement.addStyleClass("properties-tree"); |
459 this.categoriesElement.addStyleClass("event-listener-breakpoints"); | 459 this.categoriesElement.addStyleClass("event-listener-breakpoints"); |
460 this.categoriesTreeOutline = new TreeOutline(this.categoriesElement); | 460 this.categoriesTreeOutline = new TreeOutline(this.categoriesElement); |
461 this.bodyElement.appendChild(this.categoriesElement); | 461 this.bodyElement.appendChild(this.categoriesElement); |
462 | 462 |
463 this._breakpointItems = {}; | 463 this._breakpointItems = {}; |
464 this._createCategory(WebInspector.UIString("Keyboard"), "listener", ["keydow
n", "keyup", "keypress", "textInput"]); | 464 this._createCategory(WebInspector.UIString("Keyboard"), true, ["keydown", "k
eyup", "keypress", "textInput"]); |
465 this._createCategory(WebInspector.UIString("Mouse"), "listener", ["click", "
dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousew
heel"]); | 465 this._createCategory(WebInspector.UIString("Mouse"), true, ["click", "dblcli
ck", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]
); |
466 // FIXME: uncomment following once inspector stops being drop targer in majo
r ports. | 466 // FIXME: uncomment following once inspector stops being drop targer in majo
r ports. |
467 // Otherwise, inspector page reacts on drop event and tries to load the even
t data. | 467 // Otherwise, inspector page reacts on drop event and tries to load the even
t data. |
468 // this._createCategory(WebInspector.UIString("Drag"), "listener", ["drag",
"drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]); | 468 // this._createCategory(WebInspector.UIString("Drag"), true, ["drag", "drop"
, "dragstart", "dragend", "dragenter", "dragleave", "dragover"]); |
469 this._createCategory(WebInspector.UIString("Control"), "listener", ["resize"
, "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]); | 469 this._createCategory(WebInspector.UIString("Control"), true, ["resize", "scr
oll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]); |
470 this._createCategory(WebInspector.UIString("Clipboard"), "listener", ["copy"
, "cut", "paste", "beforecopy", "beforecut", "beforepaste"]); | 470 this._createCategory(WebInspector.UIString("Clipboard"), true, ["copy", "cut
", "paste", "beforecopy", "beforecut", "beforepaste"]); |
471 this._createCategory(WebInspector.UIString("Load"), "listener", ["load", "un
load", "abort", "error"]); | 471 this._createCategory(WebInspector.UIString("Load"), true, ["load", "unload",
"abort", "error"]); |
472 this._createCategory(WebInspector.UIString("DOM Mutation"), "listener", ["DO
MActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataMod
ified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOM
NodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]); | 472 this._createCategory(WebInspector.UIString("DOM Mutation"), true, ["DOMActiv
ate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified"
, "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRe
movedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]); |
473 this._createCategory(WebInspector.UIString("Device"), "listener", ["deviceor
ientation", "devicemotion"]); | 473 this._createCategory(WebInspector.UIString("Device"), true, ["deviceorientat
ion", "devicemotion"]); |
474 this._createCategory(WebInspector.UIString("Timer"), "instrumentation", ["se
tTimer", "clearTimer", "timerFired"]); | 474 this._createCategory(WebInspector.UIString("Timer"), false, ["setTimer", "cl
earTimer", "timerFired"]); |
475 this._createCategory(WebInspector.UIString("Touch"), "listener", ["touchstar
t", "touchmove", "touchend", "touchcancel"]); | 475 this._createCategory(WebInspector.UIString("Touch"), true, ["touchstart", "t
ouchmove", "touchend", "touchcancel"]); |
476 | 476 |
477 this._restoreBreakpoints(); | 477 this._restoreBreakpoints(); |
478 } | 478 } |
479 | 479 |
| 480 WebInspector.EventListenerBreakpointsSidebarPane.categotyListener = "listener:"; |
| 481 WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation = "inst
rumentation:"; |
| 482 |
480 WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(event
Name) | 483 WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(event
Name) |
481 { | 484 { |
482 if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) { | 485 if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) { |
483 WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI = { | 486 WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI = { |
484 "instrumentation:setTimer": WebInspector.UIString("Set Timer"), | 487 "instrumentation:setTimer": WebInspector.UIString("Set Timer"), |
485 "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"), | 488 "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"), |
486 "instrumentation:timerFired": WebInspector.UIString("Timer Fired") | 489 "instrumentation:timerFired": WebInspector.UIString("Timer Fired") |
487 }; | 490 }; |
488 } | 491 } |
489 return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eve
ntName] || eventName.substring(eventName.indexOf(":") + 1); | 492 return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eve
ntName] || eventName.substring(eventName.indexOf(":") + 1); |
490 } | 493 } |
491 | 494 |
492 WebInspector.EventListenerBreakpointsSidebarPane.prototype = { | 495 WebInspector.EventListenerBreakpointsSidebarPane.prototype = { |
493 _createCategory: function(name, type, eventNames) | 496 _createCategory: function(name, isDOMEvent, eventNames) |
494 { | 497 { |
495 var categoryItem = {}; | 498 var categoryItem = {}; |
496 categoryItem.element = new TreeElement(name); | 499 categoryItem.element = new TreeElement(name); |
497 this.categoriesTreeOutline.appendChild(categoryItem.element); | 500 this.categoriesTreeOutline.appendChild(categoryItem.element); |
498 categoryItem.element.listItemElement.addStyleClass("event-category"); | 501 categoryItem.element.listItemElement.addStyleClass("event-category"); |
499 categoryItem.element.selectable = true; | 502 categoryItem.element.selectable = true; |
500 | 503 |
501 categoryItem.checkbox = this._createCheckbox(categoryItem.element); | 504 categoryItem.checkbox = this._createCheckbox(categoryItem.element); |
502 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl
icked.bind(this, categoryItem), true); | 505 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl
icked.bind(this, categoryItem), true); |
503 | 506 |
504 categoryItem.children = {}; | 507 categoryItem.children = {}; |
505 for (var i = 0; i < eventNames.length; ++i) { | 508 for (var i = 0; i < eventNames.length; ++i) { |
506 var eventName = type + ":" + eventNames[i]; | 509 var eventName = (isDOMEvent ? WebInspector.EventListenerBreakpointsS
idebarPane.categotyListener : WebInspector.EventListenerBreakpointsSidebarPane.
categotyInstrumentation) + eventNames[i]; |
507 | 510 |
508 var breakpointItem = {}; | 511 var breakpointItem = {}; |
509 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa
meForUI(eventName); | 512 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa
meForUI(eventName); |
510 breakpointItem.element = new TreeElement(title); | 513 breakpointItem.element = new TreeElement(title); |
511 categoryItem.element.appendChild(breakpointItem.element); | 514 categoryItem.element.appendChild(breakpointItem.element); |
512 var hitMarker = document.createElement("div"); | 515 var hitMarker = document.createElement("div"); |
513 hitMarker.className = "breakpoint-hit-marker"; | 516 hitMarker.className = "breakpoint-hit-marker"; |
514 breakpointItem.element.listItemElement.appendChild(hitMarker); | 517 breakpointItem.element.listItemElement.appendChild(hitMarker); |
515 breakpointItem.element.listItemElement.addStyleClass("source-code"); | 518 breakpointItem.element.listItemElement.addStyleClass("source-code"); |
516 breakpointItem.element.selectable = true; | 519 breakpointItem.element.selectable = true; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 this._removeBreakpoint(eventName); | 559 this._removeBreakpoint(eventName); |
557 this._saveBreakpoints(); | 560 this._saveBreakpoints(); |
558 }, | 561 }, |
559 | 562 |
560 _setBreakpoint: function(eventName) | 563 _setBreakpoint: function(eventName) |
561 { | 564 { |
562 var breakpointItem = this._breakpointItems[eventName]; | 565 var breakpointItem = this._breakpointItems[eventName]; |
563 if (!breakpointItem) | 566 if (!breakpointItem) |
564 return; | 567 return; |
565 breakpointItem.checkbox.checked = true; | 568 breakpointItem.checkbox.checked = true; |
566 DOMDebuggerAgent.setEventListenerBreakpoint(eventName); | 569 if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.c
ategotyListener) === 0) |
| 570 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebI
nspector.EventListenerBreakpointsSidebarPane.categotyListener.length)); |
| 571 else if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarP
ane.categotyInstrumentation) === 0) |
| 572 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(We
bInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length)); |
567 this._updateCategoryCheckbox(breakpointItem.parent); | 573 this._updateCategoryCheckbox(breakpointItem.parent); |
568 }, | 574 }, |
569 | 575 |
570 _removeBreakpoint: function(eventName) | 576 _removeBreakpoint: function(eventName) |
571 { | 577 { |
572 var breakpointItem = this._breakpointItems[eventName]; | 578 var breakpointItem = this._breakpointItems[eventName]; |
573 if (!breakpointItem) | 579 if (!breakpointItem) |
574 return; | 580 return; |
575 breakpointItem.checkbox.checked = false; | 581 breakpointItem.checkbox.checked = false; |
576 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName); | 582 if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.c
ategotyListener) === 0) |
| 583 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(W
ebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length)); |
| 584 else if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarP
ane.categotyInstrumentation) === 0) |
| 585 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring
(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length
)); |
577 this._updateCategoryCheckbox(breakpointItem.parent); | 586 this._updateCategoryCheckbox(breakpointItem.parent); |
578 }, | 587 }, |
579 | 588 |
580 _updateCategoryCheckbox: function(categoryItem) | 589 _updateCategoryCheckbox: function(categoryItem) |
581 { | 590 { |
582 var hasEnabled = false, hasDisabled = false; | 591 var hasEnabled = false, hasDisabled = false; |
583 for (var eventName in categoryItem.children) { | 592 for (var eventName in categoryItem.children) { |
584 var breakpointItem = categoryItem.children[eventName]; | 593 var breakpointItem = categoryItem.children[eventName]; |
585 if (breakpointItem.checkbox.checked) | 594 if (breakpointItem.checkbox.checked) |
586 hasEnabled = true; | 595 hasEnabled = true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); | 634 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); |
626 for (var i = 0; i < breakpoints.length; ++i) { | 635 for (var i = 0; i < breakpoints.length; ++i) { |
627 var breakpoint = breakpoints[i]; | 636 var breakpoint = breakpoints[i]; |
628 if (breakpoint && typeof breakpoint.eventName === "string") | 637 if (breakpoint && typeof breakpoint.eventName === "string") |
629 this._setBreakpoint(breakpoint.eventName); | 638 this._setBreakpoint(breakpoint.eventName); |
630 } | 639 } |
631 } | 640 } |
632 } | 641 } |
633 | 642 |
634 WebInspector.EventListenerBreakpointsSidebarPane.prototype.__proto__ = WebInspec
tor.SidebarPane.prototype; | 643 WebInspector.EventListenerBreakpointsSidebarPane.prototype.__proto__ = WebInspec
tor.SidebarPane.prototype; |
OLD | NEW |