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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Br
eakpoints")); | 514 WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Br
eakpoints")); |
515 this.registerRequiredCSS("breakpointsList.css"); | 515 this.registerRequiredCSS("breakpointsList.css"); |
516 | 516 |
517 this.categoriesElement = document.createElement("ol"); | 517 this.categoriesElement = document.createElement("ol"); |
518 this.categoriesElement.tabIndex = 0; | 518 this.categoriesElement.tabIndex = 0; |
519 this.categoriesElement.classList.add("properties-tree"); | 519 this.categoriesElement.classList.add("properties-tree"); |
520 this.categoriesElement.classList.add("event-listener-breakpoints"); | 520 this.categoriesElement.classList.add("event-listener-breakpoints"); |
521 this.categoriesTreeOutline = new TreeOutline(this.categoriesElement); | 521 this.categoriesTreeOutline = new TreeOutline(this.categoriesElement); |
522 this.bodyElement.appendChild(this.categoriesElement); | 522 this.bodyElement.appendChild(this.categoriesElement); |
523 | 523 |
524 this._breakpointItems = {}; | 524 this._categoryItems = []; |
525 // FIXME: uncomment following once inspector stops being drop targer in majo
r ports. | 525 // FIXME: uncomment following once inspector stops being drop targer in majo
r ports. |
526 // Otherwise, inspector page reacts on drop event and tries to load the even
t data. | 526 // Otherwise, inspector page reacts on drop event and tries to load the even
t data. |
527 // this._createCategory(WebInspector.UIString("Drag"), true, ["drag", "drop"
, "dragstart", "dragend", "dragenter", "dragleave", "dragover"]); | 527 // this._createCategory(WebInspector.UIString("Drag"), ["drag", "drop", "dra
gstart", "dragend", "dragenter", "dragleave", "dragover"]); |
528 this._createCategory(WebInspector.UIString("Animation"), false, ["requestAni
mationFrame", "cancelAnimationFrame", "animationFrameFired"]); | 528 this._createCategory(WebInspector.UIString("Animation"), ["requestAnimationF
rame", "cancelAnimationFrame", "animationFrameFired"], true); |
529 this._createCategory(WebInspector.UIString("Control"), true, ["resize", "scr
oll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]); | 529 this._createCategory(WebInspector.UIString("Control"), ["resize", "scroll",
"zoom", "focus", "blur", "select", "change", "submit", "reset"]); |
530 this._createCategory(WebInspector.UIString("Clipboard"), true, ["copy", "cut
", "paste", "beforecopy", "beforecut", "beforepaste"]); | 530 this._createCategory(WebInspector.UIString("Clipboard"), ["copy", "cut", "pa
ste", "beforecopy", "beforecut", "beforepaste"]); |
531 this._createCategory(WebInspector.UIString("DOM Mutation"), true, ["DOMActiv
ate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified"
, "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRe
movedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]); | 531 this._createCategory(WebInspector.UIString("DOM Mutation"), ["DOMActivate",
"DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOM
NodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedF
romDocument", "DOMSubtreeModified", "DOMContentLoaded"]); |
532 this._createCategory(WebInspector.UIString("Device"), true, ["deviceorientat
ion", "devicemotion"]); | 532 this._createCategory(WebInspector.UIString("Device"), ["deviceorientation",
"devicemotion"]); |
533 this._createCategory(WebInspector.UIString("Drag / drop"), true, ["dragenter
", "dragover", "dragleave", "drop"]); | 533 this._createCategory(WebInspector.UIString("Drag / drop"), ["dragenter", "dr
agover", "dragleave", "drop"]); |
534 this._createCategory(WebInspector.UIString("Keyboard"), true, ["keydown", "k
eyup", "keypress", "input"]); | 534 this._createCategory(WebInspector.UIString("Keyboard"), ["keydown", "keyup",
"keypress", "input"]); |
535 this._createCategory(WebInspector.UIString("Load"), true, ["load", "beforeun
load", "unload", "abort", "error", "hashchange", "popstate"]); | 535 this._createCategory(WebInspector.UIString("Load"), ["load", "beforeunload",
"unload", "abort", "error", "hashchange", "popstate"]); |
536 this._createCategory(WebInspector.UIString("Mouse"), true, ["click", "dblcli
ck", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel",
"wheel"]); | 536 this._createCategory(WebInspector.UIString("Mouse"), ["click", "dblclick", "
mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel", "whee
l"]); |
537 this._createCategory(WebInspector.UIString("Timer"), false, ["setTimer", "cl
earTimer", "timerFired"]); | 537 this._createCategory(WebInspector.UIString("Timer"), ["setTimer", "clearTime
r", "timerFired"], true); |
538 this._createCategory(WebInspector.UIString("Touch"), true, ["touchstart", "t
ouchmove", "touchend", "touchcancel"]); | 538 this._createCategory(WebInspector.UIString("Touch"), ["touchstart", "touchmo
ve", "touchend", "touchcancel"]); |
539 this._createCategory(WebInspector.UIString("WebGL"), false, ["webglErrorFire
d", "webglWarningFired"]); | 539 this._createCategory(WebInspector.UIString("XHR"), ["readystatechange", "loa
d", "loadstart", "loadend", "abort", "error", "progress", "timeout"], false, ["X
MLHttpRequest", "XMLHttpRequestUpload"]); |
| 540 this._createCategory(WebInspector.UIString("WebGL"), ["webglErrorFired", "we
bglWarningFired"], true); |
540 | 541 |
541 this._restoreBreakpoints(); | 542 this._restoreBreakpoints(); |
542 } | 543 } |
543 | 544 |
544 WebInspector.EventListenerBreakpointsSidebarPane.categotyListener = "listener:"; | 545 WebInspector.EventListenerBreakpointsSidebarPane.categoryListener = "listener:"; |
545 WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation = "inst
rumentation:"; | 546 WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation = "inst
rumentation:"; |
| 547 WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny = "*"; |
546 | 548 |
547 /** | 549 /** |
548 * @param {string} eventName | 550 * @param {string} eventName |
549 * @param {!Object=} auxData | 551 * @param {!Object=} auxData |
550 * @return {string} | 552 * @return {string} |
551 */ | 553 */ |
552 WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(event
Name, auxData) | 554 WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(event
Name, auxData) |
553 { | 555 { |
554 if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) { | 556 if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) { |
555 WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI = { | 557 WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI = { |
(...skipping 12 matching lines...) Expand all Loading... |
568 var errorName = auxData["webglErrorName"]; | 570 var errorName = auxData["webglErrorName"]; |
569 // If there is a hex code of the error, display only this. | 571 // If there is a hex code of the error, display only this. |
570 errorName = errorName.replace(/^.*(0x[0-9a-f]+).*$/i, "$1"); | 572 errorName = errorName.replace(/^.*(0x[0-9a-f]+).*$/i, "$1"); |
571 return WebInspector.UIString("WebGL Error Fired (%s)", errorName); | 573 return WebInspector.UIString("WebGL Error Fired (%s)", errorName); |
572 } | 574 } |
573 } | 575 } |
574 return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eve
ntName] || eventName.substring(eventName.indexOf(":") + 1); | 576 return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eve
ntName] || eventName.substring(eventName.indexOf(":") + 1); |
575 } | 577 } |
576 | 578 |
577 WebInspector.EventListenerBreakpointsSidebarPane.prototype = { | 579 WebInspector.EventListenerBreakpointsSidebarPane.prototype = { |
578 _createCategory: function(name, isDOMEvent, eventNames) | 580 /** |
| 581 * @param {string} name |
| 582 * @param {!Array.<string>} eventNames |
| 583 * @param {boolean=} isInstrumentationEvent |
| 584 * @param {!Array.<string>=} targetNames |
| 585 */ |
| 586 _createCategory: function(name, eventNames, isInstrumentationEvent, targetNa
mes) |
579 { | 587 { |
580 var labelNode = document.createElement("label"); | 588 var labelNode = document.createElement("label"); |
581 labelNode.textContent = name; | 589 labelNode.textContent = name; |
582 | 590 |
583 var categoryItem = {}; | 591 var categoryItem = {}; |
584 categoryItem.element = new TreeElement(labelNode); | 592 categoryItem.element = new TreeElement(labelNode); |
585 this.categoriesTreeOutline.appendChild(categoryItem.element); | 593 this.categoriesTreeOutline.appendChild(categoryItem.element); |
586 categoryItem.element.listItemElement.classList.add("event-category"); | 594 categoryItem.element.listItemElement.classList.add("event-category"); |
587 categoryItem.element.selectable = true; | 595 categoryItem.element.selectable = true; |
588 | 596 |
589 categoryItem.checkbox = this._createCheckbox(labelNode); | 597 categoryItem.checkbox = this._createCheckbox(labelNode); |
590 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl
icked.bind(this, categoryItem), true); | 598 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl
icked.bind(this, categoryItem), true); |
591 | 599 |
| 600 categoryItem.targetNames = this._stringArrayToLowerCase(targetNames || [
WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny]); |
592 categoryItem.children = {}; | 601 categoryItem.children = {}; |
| 602 var category = (isInstrumentationEvent ? WebInspector.EventListenerBreak
pointsSidebarPane.categoryInstrumentation : WebInspector.EventListenerBreakpoin
tsSidebarPane.categoryListener); |
593 for (var i = 0; i < eventNames.length; ++i) { | 603 for (var i = 0; i < eventNames.length; ++i) { |
594 var eventName = (isDOMEvent ? WebInspector.EventListenerBreakpointsS
idebarPane.categotyListener : WebInspector.EventListenerBreakpointsSidebarPane.
categotyInstrumentation) + eventNames[i]; | 604 var eventName = category + eventNames[i]; |
595 | 605 |
596 var breakpointItem = {}; | 606 var breakpointItem = {}; |
597 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa
meForUI(eventName); | 607 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa
meForUI(eventName); |
598 | 608 |
599 labelNode = document.createElement("label"); | 609 labelNode = document.createElement("label"); |
600 labelNode.textContent = title; | 610 labelNode.textContent = title; |
601 | 611 |
602 breakpointItem.element = new TreeElement(labelNode); | 612 breakpointItem.element = new TreeElement(labelNode); |
603 categoryItem.element.appendChild(breakpointItem.element); | 613 categoryItem.element.appendChild(breakpointItem.element); |
604 | 614 |
605 var hitMarker = document.createElement("div"); | 615 breakpointItem.element.listItemElement.createChild("div", "breakpoin
t-hit-marker"); |
606 hitMarker.className = "breakpoint-hit-marker"; | |
607 breakpointItem.element.listItemElement.appendChild(hitMarker); | |
608 breakpointItem.element.listItemElement.classList.add("source-code"); | 616 breakpointItem.element.listItemElement.classList.add("source-code"); |
609 breakpointItem.element.selectable = false; | 617 breakpointItem.element.selectable = false; |
610 | 618 |
611 breakpointItem.checkbox = this._createCheckbox(labelNode); | 619 breakpointItem.checkbox = this._createCheckbox(labelNode); |
612 breakpointItem.checkbox.addEventListener("click", this._breakpointCh
eckboxClicked.bind(this, eventName), true); | 620 breakpointItem.checkbox.addEventListener("click", this._breakpointCh
eckboxClicked.bind(this, eventName, categoryItem.targetNames), true); |
613 breakpointItem.parent = categoryItem; | 621 breakpointItem.parent = categoryItem; |
614 | 622 |
615 this._breakpointItems[eventName] = breakpointItem; | |
616 categoryItem.children[eventName] = breakpointItem; | 623 categoryItem.children[eventName] = breakpointItem; |
617 } | 624 } |
| 625 this._categoryItems.push(categoryItem); |
618 }, | 626 }, |
619 | 627 |
| 628 /** |
| 629 * @param {!Array.<string>} array |
| 630 * @return {!Array.<string>} |
| 631 */ |
| 632 _stringArrayToLowerCase: function(array) |
| 633 { |
| 634 return array.map(function(value) { |
| 635 return value.toLowerCase(); |
| 636 }); |
| 637 }, |
| 638 |
| 639 /** |
| 640 * @param {!Element} labelNode |
| 641 * @return {!Element} |
| 642 */ |
620 _createCheckbox: function(labelNode) | 643 _createCheckbox: function(labelNode) |
621 { | 644 { |
622 var checkbox = document.createElement("input"); | 645 var checkbox = document.createElement("input"); |
623 checkbox.className = "checkbox-elem"; | 646 checkbox.className = "checkbox-elem"; |
624 checkbox.type = "checkbox"; | 647 checkbox.type = "checkbox"; |
625 | 648 |
626 labelNode.insertBefore(checkbox, labelNode.firstChild); | 649 labelNode.insertBefore(checkbox, labelNode.firstChild); |
627 return checkbox; | 650 return checkbox; |
628 }, | 651 }, |
629 | 652 |
630 _categoryCheckboxClicked: function(categoryItem) | 653 _categoryCheckboxClicked: function(categoryItem) |
631 { | 654 { |
632 var checked = categoryItem.checkbox.checked; | 655 var checked = categoryItem.checkbox.checked; |
633 for (var eventName in categoryItem.children) { | 656 for (var eventName in categoryItem.children) { |
634 var breakpointItem = categoryItem.children[eventName]; | 657 var breakpointItem = categoryItem.children[eventName]; |
635 if (breakpointItem.checkbox.checked === checked) | 658 if (breakpointItem.checkbox.checked === checked) |
636 continue; | 659 continue; |
637 if (checked) | 660 if (checked) |
638 this._setBreakpoint(eventName); | 661 this._setBreakpoint(eventName, categoryItem.targetNames); |
639 else | 662 else |
640 this._removeBreakpoint(eventName); | 663 this._removeBreakpoint(eventName, categoryItem.targetNames); |
641 } | 664 } |
642 this._saveBreakpoints(); | 665 this._saveBreakpoints(); |
643 }, | 666 }, |
644 | 667 |
645 _breakpointCheckboxClicked: function(eventName, event) | 668 /** |
| 669 * @param {string} eventName |
| 670 * @param {!Array.<string>} targetNames |
| 671 * @param {?Event} event |
| 672 */ |
| 673 _breakpointCheckboxClicked: function(eventName, targetNames, event) |
646 { | 674 { |
647 if (event.target.checked) | 675 if (event.target.checked) |
648 this._setBreakpoint(eventName); | 676 this._setBreakpoint(eventName, targetNames); |
649 else | 677 else |
650 this._removeBreakpoint(eventName); | 678 this._removeBreakpoint(eventName, targetNames); |
651 this._saveBreakpoints(); | 679 this._saveBreakpoints(); |
652 }, | 680 }, |
653 | 681 |
654 _setBreakpoint: function(eventName) | 682 /** |
| 683 * @param {string} eventName |
| 684 * @param {?Array.<string>=} targetNames |
| 685 */ |
| 686 _setBreakpoint: function(eventName, targetNames) |
655 { | 687 { |
656 var breakpointItem = this._breakpointItems[eventName]; | 688 targetNames = targetNames || [WebInspector.EventListenerBreakpointsSideb
arPane.eventTargetAny]; |
657 if (!breakpointItem) | 689 for (var i = 0; i < targetNames.length; ++i) { |
658 return; | 690 var targetName = targetNames[i]; |
659 breakpointItem.checkbox.checked = true; | 691 var breakpointItem = this._findBreakpointItem(eventName, targetName)
; |
660 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPan
e.categotyListener)) | 692 if (!breakpointItem) |
661 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebI
nspector.EventListenerBreakpointsSidebarPane.categotyListener.length)); | 693 continue; |
662 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideb
arPane.categotyInstrumentation)) | 694 breakpointItem.checkbox.checked = true; |
663 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(We
bInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length)); | 695 breakpointItem.parent.dirtyCheckbox = true; |
664 this._updateCategoryCheckbox(breakpointItem.parent); | 696 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideba
rPane.categoryListener)) |
| 697 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(
WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length), targe
tName); |
| 698 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsS
idebarPane.categoryInstrumentation)) |
| 699 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substrin
g(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.lengt
h)); |
| 700 } |
| 701 this._updateCategoryCheckboxes(); |
665 }, | 702 }, |
666 | 703 |
667 _removeBreakpoint: function(eventName) | 704 /** |
| 705 * @param {string} eventName |
| 706 * @param {?Array.<string>=} targetNames |
| 707 */ |
| 708 _removeBreakpoint: function(eventName, targetNames) |
668 { | 709 { |
669 var breakpointItem = this._breakpointItems[eventName]; | 710 targetNames = targetNames || [WebInspector.EventListenerBreakpointsSideb
arPane.eventTargetAny]; |
670 if (!breakpointItem) | 711 for (var i = 0; i < targetNames.length; ++i) { |
671 return; | 712 var targetName = targetNames[i]; |
672 breakpointItem.checkbox.checked = false; | 713 var breakpointItem = this._findBreakpointItem(eventName, targetName)
; |
673 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPan
e.categotyListener)) | 714 if (!breakpointItem) |
674 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(W
ebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length)); | 715 continue; |
675 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideb
arPane.categotyInstrumentation)) | 716 breakpointItem.checkbox.checked = false; |
676 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring
(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length
)); | 717 breakpointItem.parent.dirtyCheckbox = true; |
677 this._updateCategoryCheckbox(breakpointItem.parent); | 718 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideba
rPane.categoryListener)) |
| 719 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substri
ng(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length), ta
rgetName); |
| 720 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsS
idebarPane.categoryInstrumentation)) |
| 721 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.subst
ring(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.le
ngth)); |
| 722 } |
| 723 this._updateCategoryCheckboxes(); |
678 }, | 724 }, |
679 | 725 |
680 _updateCategoryCheckbox: function(categoryItem) | 726 _updateCategoryCheckboxes: function() |
681 { | 727 { |
682 var hasEnabled = false, hasDisabled = false; | 728 for (var i = 0; i < this._categoryItems.length; ++i) { |
683 for (var eventName in categoryItem.children) { | 729 var categoryItem = this._categoryItems[i]; |
684 var breakpointItem = categoryItem.children[eventName]; | 730 if (!categoryItem.dirtyCheckbox) |
685 if (breakpointItem.checkbox.checked) | 731 continue; |
686 hasEnabled = true; | 732 categoryItem.dirtyCheckbox = false; |
687 else | 733 var hasEnabled = false; |
688 hasDisabled = true; | 734 var hasDisabled = false; |
| 735 for (var eventName in categoryItem.children) { |
| 736 var breakpointItem = categoryItem.children[eventName]; |
| 737 if (breakpointItem.checkbox.checked) |
| 738 hasEnabled = true; |
| 739 else |
| 740 hasDisabled = true; |
| 741 } |
| 742 categoryItem.checkbox.checked = hasEnabled; |
| 743 categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled; |
689 } | 744 } |
690 categoryItem.checkbox.checked = hasEnabled; | |
691 categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled; | |
692 }, | 745 }, |
693 | 746 |
694 highlightBreakpoint: function(eventName) | 747 /** |
| 748 * @param {string} eventName |
| 749 * @param {string=} targetName |
| 750 * @return {?Object} |
| 751 */ |
| 752 _findBreakpointItem: function(eventName, targetName) |
695 { | 753 { |
696 var breakpointItem = this._breakpointItems[eventName]; | 754 targetName = (targetName || WebInspector.EventListenerBreakpointsSidebar
Pane.eventTargetAny).toLowerCase(); |
| 755 for (var i = 0; i < this._categoryItems.length; ++i) { |
| 756 var categoryItem = this._categoryItems[i]; |
| 757 if (categoryItem.targetNames.indexOf(targetName) === -1) |
| 758 continue; |
| 759 var breakpointItem = categoryItem.children[eventName]; |
| 760 if (breakpointItem) |
| 761 return breakpointItem; |
| 762 } |
| 763 return null; |
| 764 }, |
| 765 |
| 766 /** |
| 767 * @param {string} eventName |
| 768 * @param {string=} targetName |
| 769 */ |
| 770 highlightBreakpoint: function(eventName, targetName) |
| 771 { |
| 772 var breakpointItem = this._findBreakpointItem(eventName, targetName); |
| 773 if (!breakpointItem || !breakpointItem.checkbox.checked) |
| 774 breakpointItem = this._findBreakpointItem(eventName, WebInspector.Ev
entListenerBreakpointsSidebarPane.eventTargetAny); |
697 if (!breakpointItem) | 775 if (!breakpointItem) |
698 return; | 776 return; |
699 this.expand(); | 777 this.expand(); |
700 breakpointItem.parent.element.expand(); | 778 breakpointItem.parent.element.expand(); |
701 breakpointItem.element.listItemElement.classList.add("breakpoint-hit"); | 779 breakpointItem.element.listItemElement.classList.add("breakpoint-hit"); |
702 this._highlightedElement = breakpointItem.element.listItemElement; | 780 this._highlightedElement = breakpointItem.element.listItemElement; |
703 }, | 781 }, |
704 | 782 |
705 clearBreakpointHighlight: function() | 783 clearBreakpointHighlight: function() |
706 { | 784 { |
707 if (this._highlightedElement) { | 785 if (this._highlightedElement) { |
708 this._highlightedElement.classList.remove("breakpoint-hit"); | 786 this._highlightedElement.classList.remove("breakpoint-hit"); |
709 delete this._highlightedElement; | 787 delete this._highlightedElement; |
710 } | 788 } |
711 }, | 789 }, |
712 | 790 |
713 _saveBreakpoints: function() | 791 _saveBreakpoints: function() |
714 { | 792 { |
715 var breakpoints = []; | 793 var breakpoints = []; |
716 for (var eventName in this._breakpointItems) { | 794 for (var i = 0; i < this._categoryItems.length; ++i) { |
717 if (this._breakpointItems[eventName].checkbox.checked) | 795 var categoryItem = this._categoryItems[i]; |
718 breakpoints.push({ eventName: eventName }); | 796 for (var eventName in categoryItem.children) { |
| 797 var breakpointItem = categoryItem.children[eventName]; |
| 798 if (breakpointItem.checkbox.checked) |
| 799 breakpoints.push({ eventName: eventName, targetNames: catego
ryItem.targetNames }); |
| 800 } |
719 } | 801 } |
720 WebInspector.settings.eventListenerBreakpoints.set(breakpoints); | 802 WebInspector.settings.eventListenerBreakpoints.set(breakpoints); |
721 }, | 803 }, |
722 | 804 |
723 _restoreBreakpoints: function() | 805 _restoreBreakpoints: function() |
724 { | 806 { |
725 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); | 807 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); |
726 for (var i = 0; i < breakpoints.length; ++i) { | 808 for (var i = 0; i < breakpoints.length; ++i) { |
727 var breakpoint = breakpoints[i]; | 809 var breakpoint = breakpoints[i]; |
728 if (breakpoint && typeof breakpoint.eventName === "string") | 810 if (breakpoint && typeof breakpoint.eventName === "string") |
729 this._setBreakpoint(breakpoint.eventName); | 811 this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames
); |
730 } | 812 } |
731 }, | 813 }, |
732 | 814 |
733 __proto__: WebInspector.SidebarPane.prototype | 815 __proto__: WebInspector.SidebarPane.prototype |
734 } | 816 } |
OLD | NEW |