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

Side by Side Diff: Source/devtools/front_end/sources/SourcesPanel.js

Issue 362273002: DevTools: Reduce code via using document.createElementWithClass and document.createChild. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint s-list-deactivated", !active); 708 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint s-list-deactivated", !active);
709 this._sourcesView.toggleBreakpointsActiveState(active); 709 this._sourcesView.toggleBreakpointsActiveState(active);
710 if (active) 710 if (active)
711 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactiv ate breakpoints."); 711 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactiv ate breakpoints.");
712 else 712 else
713 this._toggleBreakpointsButton.title = WebInspector.UIString("Activat e breakpoints."); 713 this._toggleBreakpointsButton.title = WebInspector.UIString("Activat e breakpoints.");
714 }, 714 },
715 715
716 _createDebugToolbar: function() 716 _createDebugToolbar: function()
717 { 717 {
718 var debugToolbar = document.createElement("div"); 718 var debugToolbar = document.createElementWithClass("div", "scripts-debug -toolbar");
719 debugToolbar.className = "scripts-debug-toolbar";
720 719
721 var title, handler; 720 var title, handler;
722 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C trlOrMeta; 721 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C trlOrMeta;
723 722
724 // Run snippet. 723 // Run snippet.
725 title = WebInspector.UIString("Run snippet (%s)."); 724 title = WebInspector.UIString("Run snippet (%s).");
726 handler = this._runSnippet.bind(this); 725 handler = this._runSnippet.bind(this);
727 this._runSnippetButton = this._createButtonAndRegisterShortcuts("scripts -run-snippet", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcut s.RunSnippet); 726 this._runSnippetButton = this._createButtonAndRegisterShortcuts("scripts -run-snippet", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcut s.RunSnippet);
728 debugToolbar.appendChild(this._runSnippetButton.element); 727 debugToolbar.appendChild(this._runSnippetButton.element);
729 this._runSnippetButton.element.classList.add("hidden"); 728 this._runSnippetButton.element.classList.add("hidden");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 // Pause on Exception 764 // Pause on Exception
766 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr ipts-pause-on-exceptions-status-bar-item"); 765 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr ipts-pause-on-exceptions-status-bar-item");
767 this._pauseOnExceptionButton.addEventListener("click", this._togglePause OnExceptions, this); 766 this._pauseOnExceptionButton.addEventListener("click", this._togglePause OnExceptions, this);
768 debugToolbar.appendChild(this._pauseOnExceptionButton.element); 767 debugToolbar.appendChild(this._pauseOnExceptionButton.element);
769 768
770 return debugToolbar; 769 return debugToolbar;
771 }, 770 },
772 771
773 _createDebugToolbarDrawer: function() 772 _createDebugToolbarDrawer: function()
774 { 773 {
775 var debugToolbarDrawer = document.createElement("div"); 774 var debugToolbarDrawer = document.createElementWithClass("div", "scripts -debug-toolbar-drawer");
776 debugToolbarDrawer.className = "scripts-debug-toolbar-drawer";
777 775
778 var label = WebInspector.UIString("Pause On Caught Exceptions"); 776 var label = WebInspector.UIString("Pause On Caught Exceptions");
779 var setting = WebInspector.settings.pauseOnCaughtException; 777 var setting = WebInspector.settings.pauseOnCaughtException;
780 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingChec kbox(label, setting, true)); 778 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingChec kbox(label, setting, true));
781 779
782 return debugToolbarDrawer; 780 return debugToolbarDrawer;
783 }, 781 },
784 782
785 /** 783 /**
786 * @param {!WebInspector.StatusBarButton} button 784 * @param {!WebInspector.StatusBarButton} button
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 */ 1473 */
1476 handleAction: function() 1474 handleAction: function()
1477 { 1475 {
1478 var panel = /** @type {?WebInspector.SourcesPanel} */ (WebInspector.insp ectorView.showPanel("sources")); 1476 var panel = /** @type {?WebInspector.SourcesPanel} */ (WebInspector.insp ectorView.showPanel("sources"));
1479 if (!panel) 1477 if (!panel)
1480 return false; 1478 return false;
1481 panel.togglePause(); 1479 panel.togglePause();
1482 return true; 1480 return true;
1483 } 1481 }
1484 } 1482 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/NavigatorView.js ('k') | Source/devtools/front_end/sources/SourcesView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698