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 19 matching lines...) Expand all Loading... |
30 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} sho
wSourceLineDelegate | 30 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} sho
wSourceLineDelegate |
31 */ | 31 */ |
32 WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, show
SourceLineDelegate) | 32 WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, show
SourceLineDelegate) |
33 { | 33 { |
34 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); | 34 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); |
35 this.registerRequiredCSS("breakpointsList.css"); | 35 this.registerRequiredCSS("breakpointsList.css"); |
36 | 36 |
37 this._breakpointManager = breakpointManager; | 37 this._breakpointManager = breakpointManager; |
38 this._showSourceLineDelegate = showSourceLineDelegate; | 38 this._showSourceLineDelegate = showSourceLineDelegate; |
39 | 39 |
40 this.listElement = document.createElementWithClass("ol", "breakpoint-list"); | 40 this.listElement = createElementWithClass("ol", "breakpoint-list"); |
41 | 41 |
42 this.emptyElement = this.bodyElement.createChild("div", "info"); | 42 this.emptyElement = this.bodyElement.createChild("div", "info"); |
43 this.emptyElement.textContent = WebInspector.UIString("No Breakpoints"); | 43 this.emptyElement.textContent = WebInspector.UIString("No Breakpoints"); |
44 | 44 |
45 this._items = new Map(); | 45 this._items = new Map(); |
46 | 46 |
47 var breakpointLocations = this._breakpointManager.allBreakpointLocations(); | 47 var breakpointLocations = this._breakpointManager.allBreakpointLocations(); |
48 for (var i = 0; i < breakpointLocations.length; ++i) | 48 for (var i = 0; i < breakpointLocations.length; ++i) |
49 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio
ns[i].uiLocation); | 49 this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocatio
ns[i].uiLocation); |
50 | 50 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiL
ocation); | 85 var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiL
ocation); |
86 this._addBreakpoint(breakpoint, uiLocation); | 86 this._addBreakpoint(breakpoint, uiLocation); |
87 }, | 87 }, |
88 | 88 |
89 /** | 89 /** |
90 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint | 90 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint |
91 * @param {!WebInspector.UILocation} uiLocation | 91 * @param {!WebInspector.UILocation} uiLocation |
92 */ | 92 */ |
93 _addBreakpoint: function(breakpoint, uiLocation) | 93 _addBreakpoint: function(breakpoint, uiLocation) |
94 { | 94 { |
95 var element = document.createElementWithClass("li", "cursor-pointer"); | 95 var element = createElementWithClass("li", "cursor-pointer"); |
96 element.addEventListener("contextmenu", this._breakpointContextMenu.bind
(this, breakpoint), true); | 96 element.addEventListener("contextmenu", this._breakpointContextMenu.bind
(this, breakpoint), true); |
97 element.addEventListener("click", this._breakpointClicked.bind(this, uiL
ocation), false); | 97 element.addEventListener("click", this._breakpointClicked.bind(this, uiL
ocation), false); |
98 | 98 |
99 var checkbox = element.createChild("input", "checkbox-elem"); | 99 var checkbox = element.createChild("input", "checkbox-elem"); |
100 checkbox.type = "checkbox"; | 100 checkbox.type = "checkbox"; |
101 checkbox.checked = breakpoint.enabled(); | 101 checkbox.checked = breakpoint.enabled(); |
102 checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(
this, breakpoint), false); | 102 checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(
this, breakpoint), false); |
103 | 103 |
104 element.createTextChild(uiLocation.linkText()); | 104 element.createTextChild(uiLocation.linkText()); |
105 | 105 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 contextMenu.show(); | 317 contextMenu.show(); |
318 }, | 318 }, |
319 | 319 |
320 _addButtonClicked: function(event) | 320 _addButtonClicked: function(event) |
321 { | 321 { |
322 if (event) | 322 if (event) |
323 event.consume(); | 323 event.consume(); |
324 | 324 |
325 this.expand(); | 325 this.expand(); |
326 | 326 |
327 var inputElementContainer = document.createElementWithClass("p", "breakp
oint-condition"); | 327 var inputElementContainer = createElementWithClass("p", "breakpoint-cond
ition"); |
328 inputElementContainer.textContent = WebInspector.UIString("Break when UR
L contains:"); | 328 inputElementContainer.textContent = WebInspector.UIString("Break when UR
L contains:"); |
329 | 329 |
330 var inputElement = inputElementContainer.createChild("span", "editing"); | 330 var inputElement = inputElementContainer.createChild("span", "editing"); |
331 inputElement.id = "breakpoint-condition-input"; | 331 inputElement.id = "breakpoint-condition-input"; |
332 this.addListElement(inputElementContainer, /** @type {?Element} */ (this
.listElement.firstChild)); | 332 this.addListElement(inputElementContainer, /** @type {?Element} */ (this
.listElement.firstChild)); |
333 | 333 |
334 /** | 334 /** |
335 * @param {boolean} accept | 335 * @param {boolean} accept |
336 * @param {!Element} e | 336 * @param {!Element} e |
337 * @param {string} text | 337 * @param {string} text |
(...skipping 18 matching lines...) Expand all Loading... |
356 * @param {!WebInspector.Target=} target | 356 * @param {!WebInspector.Target=} target |
357 */ | 357 */ |
358 _setBreakpoint: function(url, enabled, target) | 358 _setBreakpoint: function(url, enabled, target) |
359 { | 359 { |
360 if (enabled) | 360 if (enabled) |
361 this._updateBreakpointOnTarget(url, true, target); | 361 this._updateBreakpointOnTarget(url, true, target); |
362 | 362 |
363 if (url in this._breakpointElements) | 363 if (url in this._breakpointElements) |
364 return; | 364 return; |
365 | 365 |
366 var element = document.createElement("li"); | 366 var element = createElement("li"); |
367 element._url = url; | 367 element._url = url; |
368 element.addEventListener("contextmenu", this._contextMenu.bind(this, url
), true); | 368 element.addEventListener("contextmenu", this._contextMenu.bind(this, url
), true); |
369 | 369 |
370 var checkboxElement = element.createChild("input", "checkbox-elem"); | 370 var checkboxElement = element.createChild("input", "checkbox-elem"); |
371 checkboxElement.type = "checkbox"; | 371 checkboxElement.type = "checkbox"; |
372 checkboxElement.checked = enabled; | 372 checkboxElement.checked = enabled; |
373 checkboxElement.addEventListener("click", this._checkboxClicked.bind(thi
s, url), false); | 373 checkboxElement.addEventListener("click", this._checkboxClicked.bind(thi
s, url), false); |
374 element._checkboxElement = checkboxElement; | 374 element._checkboxElement = checkboxElement; |
375 | 375 |
376 var labelElement = element.createChild("span", "cursor-auto"); | 376 var labelElement = element.createChild("span", "cursor-auto"); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 454 |
455 _checkboxClicked: function(url, event) | 455 _checkboxClicked: function(url, event) |
456 { | 456 { |
457 this._updateBreakpointOnTarget(url, event.target.checked); | 457 this._updateBreakpointOnTarget(url, event.target.checked); |
458 this._saveBreakpoints(); | 458 this._saveBreakpoints(); |
459 }, | 459 }, |
460 | 460 |
461 _labelClicked: function(url) | 461 _labelClicked: function(url) |
462 { | 462 { |
463 var element = this._breakpointElements[url]; | 463 var element = this._breakpointElements[url]; |
464 var inputElement = document.createElementWithClass("span", "breakpoint-c
ondition editing"); | 464 var inputElement = createElementWithClass("span", "breakpoint-condition
editing"); |
465 inputElement.textContent = url; | 465 inputElement.textContent = url; |
466 this.listElement.insertBefore(inputElement, element); | 466 this.listElement.insertBefore(inputElement, element); |
467 element.classList.add("hidden"); | 467 element.classList.add("hidden"); |
468 | 468 |
469 /** | 469 /** |
470 * @param {boolean} accept | 470 * @param {boolean} accept |
471 * @param {!Element} e | 471 * @param {!Element} e |
472 * @param {string} text | 472 * @param {string} text |
473 * @this {WebInspector.XHRBreakpointsSidebarPane} | 473 * @this {WebInspector.XHRBreakpointsSidebarPane} |
474 */ | 474 */ |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 targetRemoved: function(target) { }, | 618 targetRemoved: function(target) { }, |
619 | 619 |
620 /** | 620 /** |
621 * @param {string} name | 621 * @param {string} name |
622 * @param {!Array.<string>} eventNames | 622 * @param {!Array.<string>} eventNames |
623 * @param {boolean=} isInstrumentationEvent | 623 * @param {boolean=} isInstrumentationEvent |
624 * @param {!Array.<string>=} targetNames | 624 * @param {!Array.<string>=} targetNames |
625 */ | 625 */ |
626 _createCategory: function(name, eventNames, isInstrumentationEvent, targetNa
mes) | 626 _createCategory: function(name, eventNames, isInstrumentationEvent, targetNa
mes) |
627 { | 627 { |
628 var labelNode = document.createElement("label"); | 628 var labelNode = createElement("label"); |
629 labelNode.textContent = name; | 629 labelNode.textContent = name; |
630 | 630 |
631 var categoryItem = {}; | 631 var categoryItem = {}; |
632 categoryItem.element = new TreeElement(labelNode); | 632 categoryItem.element = new TreeElement(labelNode); |
633 this.categoriesTreeOutline.appendChild(categoryItem.element); | 633 this.categoriesTreeOutline.appendChild(categoryItem.element); |
634 categoryItem.element.listItemElement.classList.add("event-category"); | 634 categoryItem.element.listItemElement.classList.add("event-category"); |
635 categoryItem.element.selectable = true; | 635 categoryItem.element.selectable = true; |
636 | 636 |
637 categoryItem.checkbox = this._createCheckbox(labelNode); | 637 categoryItem.checkbox = this._createCheckbox(labelNode); |
638 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl
icked.bind(this, categoryItem), true); | 638 categoryItem.checkbox.addEventListener("click", this._categoryCheckboxCl
icked.bind(this, categoryItem), true); |
639 | 639 |
640 categoryItem.targetNames = this._stringArrayToLowerCase(targetNames || [
WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny]); | 640 categoryItem.targetNames = this._stringArrayToLowerCase(targetNames || [
WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny]); |
641 categoryItem.children = {}; | 641 categoryItem.children = {}; |
642 var category = (isInstrumentationEvent ? WebInspector.EventListenerBreak
pointsSidebarPane.categoryInstrumentation : WebInspector.EventListenerBreakpoin
tsSidebarPane.categoryListener); | 642 var category = (isInstrumentationEvent ? WebInspector.EventListenerBreak
pointsSidebarPane.categoryInstrumentation : WebInspector.EventListenerBreakpoin
tsSidebarPane.categoryListener); |
643 for (var i = 0; i < eventNames.length; ++i) { | 643 for (var i = 0; i < eventNames.length; ++i) { |
644 var eventName = category + eventNames[i]; | 644 var eventName = category + eventNames[i]; |
645 | 645 |
646 var breakpointItem = {}; | 646 var breakpointItem = {}; |
647 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa
meForUI(eventName); | 647 var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNa
meForUI(eventName); |
648 | 648 |
649 labelNode = document.createElement("label"); | 649 labelNode = createElement("label"); |
650 labelNode.textContent = title; | 650 labelNode.textContent = title; |
651 | 651 |
652 breakpointItem.element = new TreeElement(labelNode); | 652 breakpointItem.element = new TreeElement(labelNode); |
653 categoryItem.element.appendChild(breakpointItem.element); | 653 categoryItem.element.appendChild(breakpointItem.element); |
654 | 654 |
655 breakpointItem.element.listItemElement.createChild("div", "breakpoin
t-hit-marker"); | 655 breakpointItem.element.listItemElement.createChild("div", "breakpoin
t-hit-marker"); |
656 breakpointItem.element.listItemElement.classList.add("source-code"); | 656 breakpointItem.element.listItemElement.classList.add("source-code"); |
657 breakpointItem.element.selectable = false; | 657 breakpointItem.element.selectable = false; |
658 | 658 |
659 breakpointItem.checkbox = this._createCheckbox(labelNode); | 659 breakpointItem.checkbox = this._createCheckbox(labelNode); |
(...skipping 15 matching lines...) Expand all Loading... |
675 return value.toLowerCase(); | 675 return value.toLowerCase(); |
676 }); | 676 }); |
677 }, | 677 }, |
678 | 678 |
679 /** | 679 /** |
680 * @param {!Element} labelNode | 680 * @param {!Element} labelNode |
681 * @return {!Element} | 681 * @return {!Element} |
682 */ | 682 */ |
683 _createCheckbox: function(labelNode) | 683 _createCheckbox: function(labelNode) |
684 { | 684 { |
685 var checkbox = document.createElementWithClass("input", "checkbox-elem")
; | 685 var checkbox = createElementWithClass("input", "checkbox-elem"); |
686 checkbox.type = "checkbox"; | 686 checkbox.type = "checkbox"; |
687 labelNode.insertBefore(checkbox, labelNode.firstChild); | 687 labelNode.insertBefore(checkbox, labelNode.firstChild); |
688 return checkbox; | 688 return checkbox; |
689 }, | 689 }, |
690 | 690 |
691 _categoryCheckboxClicked: function(categoryItem) | 691 _categoryCheckboxClicked: function(categoryItem) |
692 { | 692 { |
693 var checked = categoryItem.checkbox.checked; | 693 var checked = categoryItem.checkbox.checked; |
694 for (var eventName in categoryItem.children) { | 694 for (var eventName in categoryItem.children) { |
695 var breakpointItem = categoryItem.children[eventName]; | 695 var breakpointItem = categoryItem.children[eventName]; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); | 870 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); |
871 for (var i = 0; i < breakpoints.length; ++i) { | 871 for (var i = 0; i < breakpoints.length; ++i) { |
872 var breakpoint = breakpoints[i]; | 872 var breakpoint = breakpoints[i]; |
873 if (breakpoint && typeof breakpoint.eventName === "string") | 873 if (breakpoint && typeof breakpoint.eventName === "string") |
874 this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames
, target); | 874 this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames
, target); |
875 } | 875 } |
876 }, | 876 }, |
877 | 877 |
878 __proto__: WebInspector.SidebarPane.prototype | 878 __proto__: WebInspector.SidebarPane.prototype |
879 } | 879 } |
OLD | NEW |