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"], null); |
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"], null); |
yurys
2014/06/11 12:31:23
It was more clear with boolean isDOMEvent, may be
aandrey
2014/06/11 12:49:17
Done.
| |
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"], ["XMLHttpR equest", "XMLHttpRequestUpload"]); |
540 this._createCategory(WebInspector.UIString("WebGL"), ["webglErrorFired", "we bglWarningFired"], null); | |
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 {?Array.<string>=} targetNames | |
584 */ | |
585 _createCategory: function(name, eventNames, targetNames) | |
579 { | 586 { |
580 var labelNode = document.createElement("label"); | 587 var labelNode = document.createElement("label"); |
581 labelNode.textContent = name; | 588 labelNode.textContent = name; |
582 | 589 |
583 var categoryItem = {}; | 590 var categoryItem = {}; |
584 categoryItem.element = new TreeElement(labelNode); | 591 categoryItem.element = new TreeElement(labelNode); |
585 this.categoriesTreeOutline.appendChild(categoryItem.element); | 592 this.categoriesTreeOutline.appendChild(categoryItem.element); |
586 categoryItem.element.listItemElement.classList.add("event-category"); | 593 categoryItem.element.listItemElement.classList.add("event-category"); |
587 categoryItem.element.selectable = true; | 594 categoryItem.element.selectable = true; |
588 | 595 |
589 categoryItem.checkbox = this._createCheckbox(labelNode); | 596 categoryItem.checkbox = this._createCheckbox(labelNode); |
590 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl icked.bind(this, categoryItem), true); | 597 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl icked.bind(this, categoryItem), true); |
591 | 598 |
599 categoryItem.targetNames = this._stringArrayToLowerCase(targetNames || [ WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny]); | |
592 categoryItem.children = {}; | 600 categoryItem.children = {}; |
593 for (var i = 0; i < eventNames.length; ++i) { | 601 for (var i = 0; i < eventNames.length; ++i) { |
594 var eventName = (isDOMEvent ? WebInspector.EventListenerBreakpointsS idebarPane.categotyListener : WebInspector.EventListenerBreakpointsSidebarPane. categotyInstrumentation) + eventNames[i]; | 602 var eventName = (targetNames === null ? WebInspector.EventListenerBr eakpointsSidebarPane.categoryInstrumentation : WebInspector.EventListenerBreakp ointsSidebarPane.categoryListener) + eventNames[i]; |
yurys
2014/06/11 12:31:23
Category evaluation can be moved out of the loop b
aandrey
2014/06/11 12:49:17
Done.
| |
595 | 603 |
596 var breakpointItem = {}; | 604 var breakpointItem = {}; |
597 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa meForUI(eventName); | 605 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa meForUI(eventName); |
598 | 606 |
599 labelNode = document.createElement("label"); | 607 labelNode = document.createElement("label"); |
600 labelNode.textContent = title; | 608 labelNode.textContent = title; |
601 | 609 |
602 breakpointItem.element = new TreeElement(labelNode); | 610 breakpointItem.element = new TreeElement(labelNode); |
603 categoryItem.element.appendChild(breakpointItem.element); | 611 categoryItem.element.appendChild(breakpointItem.element); |
604 | 612 |
605 var hitMarker = document.createElement("div"); | 613 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"); | 614 breakpointItem.element.listItemElement.classList.add("source-code"); |
609 breakpointItem.element.selectable = false; | 615 breakpointItem.element.selectable = false; |
610 | 616 |
611 breakpointItem.checkbox = this._createCheckbox(labelNode); | 617 breakpointItem.checkbox = this._createCheckbox(labelNode); |
612 breakpointItem.checkbox.addEventListener("click", this._breakpointCh eckboxClicked.bind(this, eventName), true); | 618 breakpointItem.checkbox.addEventListener("click", this._breakpointCh eckboxClicked.bind(this, eventName, categoryItem.targetNames), true); |
613 breakpointItem.parent = categoryItem; | 619 breakpointItem.parent = categoryItem; |
614 | 620 |
615 this._breakpointItems[eventName] = breakpointItem; | |
616 categoryItem.children[eventName] = breakpointItem; | 621 categoryItem.children[eventName] = breakpointItem; |
617 } | 622 } |
623 this._categoryItems.push(categoryItem); | |
618 }, | 624 }, |
619 | 625 |
626 /** | |
627 * @param {!Array.<string>} array | |
628 * @return {!Array.<string>} | |
629 */ | |
630 _stringArrayToLowerCase: function(array) | |
631 { | |
632 return array.map(function(value) { | |
633 return value.toLowerCase(); | |
634 }); | |
635 }, | |
636 | |
637 /** | |
638 * @param {!Element} labelNode | |
639 * @return {!Element} | |
640 */ | |
620 _createCheckbox: function(labelNode) | 641 _createCheckbox: function(labelNode) |
621 { | 642 { |
622 var checkbox = document.createElement("input"); | 643 var checkbox = document.createElement("input"); |
623 checkbox.className = "checkbox-elem"; | 644 checkbox.className = "checkbox-elem"; |
624 checkbox.type = "checkbox"; | 645 checkbox.type = "checkbox"; |
625 | 646 |
626 labelNode.insertBefore(checkbox, labelNode.firstChild); | 647 labelNode.insertBefore(checkbox, labelNode.firstChild); |
627 return checkbox; | 648 return checkbox; |
628 }, | 649 }, |
629 | 650 |
630 _categoryCheckboxClicked: function(categoryItem) | 651 _categoryCheckboxClicked: function(categoryItem) |
631 { | 652 { |
632 var checked = categoryItem.checkbox.checked; | 653 var checked = categoryItem.checkbox.checked; |
633 for (var eventName in categoryItem.children) { | 654 for (var eventName in categoryItem.children) { |
634 var breakpointItem = categoryItem.children[eventName]; | 655 var breakpointItem = categoryItem.children[eventName]; |
635 if (breakpointItem.checkbox.checked === checked) | 656 if (breakpointItem.checkbox.checked === checked) |
636 continue; | 657 continue; |
637 if (checked) | 658 if (checked) |
638 this._setBreakpoint(eventName); | 659 this._setBreakpoint(eventName, categoryItem.targetNames); |
639 else | 660 else |
640 this._removeBreakpoint(eventName); | 661 this._removeBreakpoint(eventName, categoryItem.targetNames); |
641 } | 662 } |
642 this._saveBreakpoints(); | 663 this._saveBreakpoints(); |
643 }, | 664 }, |
644 | 665 |
645 _breakpointCheckboxClicked: function(eventName, event) | 666 /** |
667 * @param {string} eventName | |
668 * @param {!Array.<string>} targetNames | |
669 * @param {?Event} event | |
670 */ | |
671 _breakpointCheckboxClicked: function(eventName, targetNames, event) | |
646 { | 672 { |
647 if (event.target.checked) | 673 if (event.target.checked) |
648 this._setBreakpoint(eventName); | 674 this._setBreakpoint(eventName, targetNames); |
649 else | 675 else |
650 this._removeBreakpoint(eventName); | 676 this._removeBreakpoint(eventName, targetNames); |
651 this._saveBreakpoints(); | 677 this._saveBreakpoints(); |
652 }, | 678 }, |
653 | 679 |
654 _setBreakpoint: function(eventName) | 680 /** |
681 * @param {string} eventName | |
682 * @param {?Array.<string>=} targetNames | |
683 */ | |
684 _setBreakpoint: function(eventName, targetNames) | |
655 { | 685 { |
656 var breakpointItem = this._breakpointItems[eventName]; | 686 targetNames = targetNames || [WebInspector.EventListenerBreakpointsSideb arPane.eventTargetAny]; |
657 if (!breakpointItem) | 687 for (var i = 0; i < targetNames.length; ++i) { |
658 return; | 688 var targetName = targetNames[i]; |
659 breakpointItem.checkbox.checked = true; | 689 var breakpointItem = this._findBreakpointItem(eventName, targetName) ; |
660 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPan e.categotyListener)) | 690 if (!breakpointItem) |
661 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebI nspector.EventListenerBreakpointsSidebarPane.categotyListener.length)); | 691 continue; |
662 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideb arPane.categotyInstrumentation)) | 692 breakpointItem.checkbox.checked = true; |
663 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(We bInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length)); | 693 breakpointItem.parent.dirtyCheckbox = true; |
664 this._updateCategoryCheckbox(breakpointItem.parent); | 694 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideba rPane.categoryListener)) |
695 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring( WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length), targe tName); | |
696 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsS idebarPane.categoryInstrumentation)) | |
697 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substrin g(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.lengt h)); | |
698 } | |
699 this._updateCategoryCheckboxes(); | |
665 }, | 700 }, |
666 | 701 |
667 _removeBreakpoint: function(eventName) | 702 /** |
703 * @param {string} eventName | |
704 * @param {?Array.<string>=} targetNames | |
705 */ | |
706 _removeBreakpoint: function(eventName, targetNames) | |
668 { | 707 { |
669 var breakpointItem = this._breakpointItems[eventName]; | 708 targetNames = targetNames || [WebInspector.EventListenerBreakpointsSideb arPane.eventTargetAny]; |
670 if (!breakpointItem) | 709 for (var i = 0; i < targetNames.length; ++i) { |
671 return; | 710 var targetName = targetNames[i]; |
672 breakpointItem.checkbox.checked = false; | 711 var breakpointItem = this._findBreakpointItem(eventName, targetName) ; |
673 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPan e.categotyListener)) | 712 if (!breakpointItem) |
674 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(W ebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length)); | 713 continue; |
675 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideb arPane.categotyInstrumentation)) | 714 breakpointItem.checkbox.checked = false; |
676 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring (WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length )); | 715 breakpointItem.parent.dirtyCheckbox = true; |
677 this._updateCategoryCheckbox(breakpointItem.parent); | 716 if (eventName.startsWith(WebInspector.EventListenerBreakpointsSideba rPane.categoryListener)) |
717 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substri ng(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length), ta rgetName); | |
718 else if (eventName.startsWith(WebInspector.EventListenerBreakpointsS idebarPane.categoryInstrumentation)) | |
719 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.subst ring(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.le ngth)); | |
720 } | |
721 this._updateCategoryCheckboxes(); | |
678 }, | 722 }, |
679 | 723 |
680 _updateCategoryCheckbox: function(categoryItem) | 724 _updateCategoryCheckboxes: function() |
681 { | 725 { |
682 var hasEnabled = false, hasDisabled = false; | 726 for (var i = 0; i < this._categoryItems.length; ++i) { |
683 for (var eventName in categoryItem.children) { | 727 var categoryItem = this._categoryItems[i]; |
684 var breakpointItem = categoryItem.children[eventName]; | 728 if (!categoryItem.dirtyCheckbox) |
685 if (breakpointItem.checkbox.checked) | 729 continue; |
686 hasEnabled = true; | 730 delete categoryItem.dirtyCheckbox; |
687 else | 731 var hasEnabled = false, hasDisabled = false; |
688 hasDisabled = true; | 732 for (var eventName in categoryItem.children) { |
733 var breakpointItem = categoryItem.children[eventName]; | |
734 if (breakpointItem.checkbox.checked) | |
735 hasEnabled = true; | |
736 else | |
737 hasDisabled = true; | |
738 } | |
739 categoryItem.checkbox.checked = hasEnabled; | |
740 categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled; | |
689 } | 741 } |
690 categoryItem.checkbox.checked = hasEnabled; | |
691 categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled; | |
692 }, | 742 }, |
693 | 743 |
694 highlightBreakpoint: function(eventName) | 744 /** |
745 * @param {string} eventName | |
746 * @param {string=} targetName | |
747 * @return {?Object} | |
748 */ | |
749 _findBreakpointItem: function(eventName, targetName) | |
695 { | 750 { |
696 var breakpointItem = this._breakpointItems[eventName]; | 751 targetName = (targetName || WebInspector.EventListenerBreakpointsSidebar Pane.eventTargetAny).toLowerCase(); |
752 for (var i = 0; i < this._categoryItems.length; ++i) { | |
753 var categoryItem = this._categoryItems[i]; | |
754 if (categoryItem.targetNames.indexOf(targetName) === -1) | |
755 continue; | |
756 var breakpointItem = categoryItem.children[eventName]; | |
757 if (breakpointItem) | |
758 return breakpointItem; | |
759 } | |
760 return null; | |
761 }, | |
762 | |
763 /** | |
764 * @param {string} eventName | |
765 * @param {string=} targetName | |
766 */ | |
767 highlightBreakpoint: function(eventName, targetName) | |
768 { | |
769 var breakpointItem = this._findBreakpointItem(eventName, targetName); | |
770 if (!breakpointItem || !breakpointItem.checkbox.checked) | |
771 breakpointItem = this._findBreakpointItem(eventName, WebInspector.Ev entListenerBreakpointsSidebarPane.eventTargetAny); | |
697 if (!breakpointItem) | 772 if (!breakpointItem) |
698 return; | 773 return; |
699 this.expand(); | 774 this.expand(); |
700 breakpointItem.parent.element.expand(); | 775 breakpointItem.parent.element.expand(); |
701 breakpointItem.element.listItemElement.classList.add("breakpoint-hit"); | 776 breakpointItem.element.listItemElement.classList.add("breakpoint-hit"); |
702 this._highlightedElement = breakpointItem.element.listItemElement; | 777 this._highlightedElement = breakpointItem.element.listItemElement; |
703 }, | 778 }, |
704 | 779 |
705 clearBreakpointHighlight: function() | 780 clearBreakpointHighlight: function() |
706 { | 781 { |
707 if (this._highlightedElement) { | 782 if (this._highlightedElement) { |
708 this._highlightedElement.classList.remove("breakpoint-hit"); | 783 this._highlightedElement.classList.remove("breakpoint-hit"); |
709 delete this._highlightedElement; | 784 delete this._highlightedElement; |
710 } | 785 } |
711 }, | 786 }, |
712 | 787 |
713 _saveBreakpoints: function() | 788 _saveBreakpoints: function() |
714 { | 789 { |
715 var breakpoints = []; | 790 var breakpoints = []; |
716 for (var eventName in this._breakpointItems) { | 791 for (var i = 0; i < this._categoryItems.length; ++i) { |
717 if (this._breakpointItems[eventName].checkbox.checked) | 792 var categoryItem = this._categoryItems[i]; |
718 breakpoints.push({ eventName: eventName }); | 793 for (var eventName in categoryItem.children) { |
794 var breakpointItem = categoryItem.children[eventName]; | |
795 if (breakpointItem.checkbox.checked) | |
796 breakpoints.push({ eventName: eventName, targetNames: catego ryItem.targetNames }); | |
797 } | |
719 } | 798 } |
720 WebInspector.settings.eventListenerBreakpoints.set(breakpoints); | 799 WebInspector.settings.eventListenerBreakpoints.set(breakpoints); |
721 }, | 800 }, |
722 | 801 |
723 _restoreBreakpoints: function() | 802 _restoreBreakpoints: function() |
724 { | 803 { |
725 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); | 804 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); |
726 for (var i = 0; i < breakpoints.length; ++i) { | 805 for (var i = 0; i < breakpoints.length; ++i) { |
727 var breakpoint = breakpoints[i]; | 806 var breakpoint = breakpoints[i]; |
728 if (breakpoint && typeof breakpoint.eventName === "string") | 807 if (breakpoint && typeof breakpoint.eventName === "string") |
729 this._setBreakpoint(breakpoint.eventName); | 808 this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames ); |
730 } | 809 } |
731 }, | 810 }, |
732 | 811 |
733 __proto__: WebInspector.SidebarPane.prototype | 812 __proto__: WebInspector.SidebarPane.prototype |
734 } | 813 } |
OLD | NEW |