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

Side by Side Diff: Source/devtools/front_end/settings/SettingsScreen.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 WebInspector.SettingsScreen = function(onHide) 36 WebInspector.SettingsScreen = function(onHide)
37 { 37 {
38 WebInspector.HelpScreen.call(this); 38 WebInspector.HelpScreen.call(this);
39 this.element.id = "settings-screen"; 39 this.element.id = "settings-screen";
40 40
41 /** @type {function()} */ 41 /** @type {function()} */
42 this._onHide = onHide; 42 this._onHide = onHide;
43 43
44 this._tabbedPane = new WebInspector.TabbedPane(); 44 this._tabbedPane = new WebInspector.TabbedPane();
45 this._tabbedPane.element.classList.add("help-window-main"); 45 this._tabbedPane.element.classList.add("help-window-main");
46 var settingsLabelElement = document.createElementWithClass("div", "help-wind ow-label"); 46 var settingsLabelElement = createElementWithClass("div", "help-window-label" );
47 settingsLabelElement.createTextChild(WebInspector.UIString("Settings")); 47 settingsLabelElement.createTextChild(WebInspector.UIString("Settings"));
48 this._tabbedPane.element.insertBefore(settingsLabelElement, this._tabbedPane .element.firstChild); 48 this._tabbedPane.element.insertBefore(settingsLabelElement, this._tabbedPane .element.firstChild);
49 this._tabbedPane.element.appendChild(this._createCloseButton()); 49 this._tabbedPane.element.appendChild(this._createCloseButton());
50 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.General, WebInsp ector.UIString("General"), new WebInspector.GenericSettingsTab()); 50 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.General, WebInsp ector.UIString("General"), new WebInspector.GenericSettingsTab());
51 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Workspace, WebIn spector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab()); 51 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Workspace, WebIn spector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab());
52 if (Runtime.experiments.supportEnabled()) 52 if (Runtime.experiments.supportEnabled())
53 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Experiments, WebInspector.UIString("Experiments"), new WebInspector.ExperimentsSettingsTab() ); 53 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Experiments, WebInspector.UIString("Experiments"), new WebInspector.ExperimentsSettingsTab() );
54 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebIn spector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabVi ew()); 54 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebIn spector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabVi ew());
55 this._tabbedPane.shrinkableTabs = false; 55 this._tabbedPane.shrinkableTabs = false;
56 this._tabbedPane.verticalTabLayout = true; 56 this._tabbedPane.verticalTabLayout = true;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 _appendSection: function(name) 171 _appendSection: function(name)
172 { 172 {
173 var block = this.containerElement.createChild("div", "help-block"); 173 var block = this.containerElement.createChild("div", "help-block");
174 if (name) 174 if (name)
175 block.createChild("div", "help-section-title").textContent = name; 175 block.createChild("div", "help-section-title").textContent = name;
176 return block; 176 return block;
177 }, 177 },
178 178
179 _createSelectSetting: function(name, options, setting) 179 _createSelectSetting: function(name, options, setting)
180 { 180 {
181 var p = document.createElement("p"); 181 var p = createElement("p");
182 p.createChild("label").textContent = name; 182 p.createChild("label").textContent = name;
183 183
184 var select = p.createChild("select", "chrome-select"); 184 var select = p.createChild("select", "chrome-select");
185 var settingValue = setting.get(); 185 var settingValue = setting.get();
186 186
187 for (var i = 0; i < options.length; ++i) { 187 for (var i = 0; i < options.length; ++i) {
188 var option = options[i]; 188 var option = options[i];
189 select.add(new Option(option[0], option[1])); 189 select.add(new Option(option[0], option[1]));
190 if (settingValue === option[1]) 190 if (settingValue === option[1])
191 select.selectedIndex = i; 191 select.selectedIndex = i;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 WebInspector.UISettingDelegate.call(this); 366 WebInspector.UISettingDelegate.call(this);
367 } 367 }
368 368
369 WebInspector.SettingsScreen.SkipStackFramePatternSettingDelegate.prototype = { 369 WebInspector.SettingsScreen.SkipStackFramePatternSettingDelegate.prototype = {
370 /** 370 /**
371 * @override 371 * @override
372 * @return {!Element} 372 * @return {!Element}
373 */ 373 */
374 settingElement: function() 374 settingElement: function()
375 { 375 {
376 var button = document.createElementWithClass("input", "text-button"); 376 var button = createElementWithClass("input", "text-button");
377 button.type = "button"; 377 button.type = "button";
378 button.value = WebInspector.manageBlackboxingButtonLabel(); 378 button.value = WebInspector.manageBlackboxingButtonLabel();
379 button.title = WebInspector.UIString("Skip stepping through sources with particular names"); 379 button.title = WebInspector.UIString("Skip stepping through sources with particular names");
380 button.addEventListener("click", this._onManageButtonClick.bind(this), f alse); 380 button.addEventListener("click", this._onManageButtonClick.bind(this), f alse);
381 return button; 381 return button;
382 }, 382 },
383 383
384 _onManageButtonClick: function() 384 _onManageButtonClick: function()
385 { 385 {
386 WebInspector.FrameworkBlackboxDialog.show(WebInspector.inspectorView.ele ment); 386 WebInspector.FrameworkBlackboxDialog.show(WebInspector.inspectorView.ele ment);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 experimentsSection.appendChild(this._createExperimentCheckbox(experi ments[i])); 582 experimentsSection.appendChild(this._createExperimentCheckbox(experi ments[i]));
583 } 583 }
584 } 584 }
585 585
586 WebInspector.ExperimentsSettingsTab.prototype = { 586 WebInspector.ExperimentsSettingsTab.prototype = {
587 /** 587 /**
588 * @return {!Element} element 588 * @return {!Element} element
589 */ 589 */
590 _createExperimentsWarningSubsection: function() 590 _createExperimentsWarningSubsection: function()
591 { 591 {
592 var subsection = document.createElement("div"); 592 var subsection = createElement("div");
593 var warning = subsection.createChild("span", "settings-experiments-warni ng-subsection-warning"); 593 var warning = subsection.createChild("span", "settings-experiments-warni ng-subsection-warning");
594 warning.textContent = WebInspector.UIString("WARNING:"); 594 warning.textContent = WebInspector.UIString("WARNING:");
595 subsection.createTextChild(" "); 595 subsection.createTextChild(" ");
596 var message = subsection.createChild("span", "settings-experiments-warni ng-subsection-message"); 596 var message = subsection.createChild("span", "settings-experiments-warni ng-subsection-message");
597 message.textContent = WebInspector.UIString("These experiments could be dangerous and may require restart."); 597 message.textContent = WebInspector.UIString("These experiments could be dangerous and may require restart.");
598 return subsection; 598 return subsection;
599 }, 599 },
600 600
601 _createExperimentCheckbox: function(experiment) 601 _createExperimentCheckbox: function(experiment)
602 { 602 {
603 var input = document.createElement("input"); 603 var input = createElement("input");
604 input.type = "checkbox"; 604 input.type = "checkbox";
605 input.name = experiment.name; 605 input.name = experiment.name;
606 input.checked = experiment.isEnabled(); 606 input.checked = experiment.isEnabled();
607 function listener() 607 function listener()
608 { 608 {
609 experiment.setEnabled(input.checked); 609 experiment.setEnabled(input.checked);
610 } 610 }
611 input.addEventListener("click", listener, false); 611 input.addEventListener("click", listener, false);
612 612
613 var p = document.createElement("p"); 613 var p = createElement("p");
614 p.className = experiment.hidden && !experiment.isEnabled() ? "settings-e xperiment-hidden" : ""; 614 p.className = experiment.hidden && !experiment.isEnabled() ? "settings-e xperiment-hidden" : "";
615 var label = p.createChild("label"); 615 var label = p.createChild("label");
616 label.appendChild(input); 616 label.appendChild(input);
617 label.createTextChild(WebInspector.UIString(experiment.title)); 617 label.createTextChild(WebInspector.UIString(experiment.title));
618 p.appendChild(label); 618 p.appendChild(label);
619 return p; 619 return p;
620 }, 620 },
621 621
622 __proto__: WebInspector.SettingsTab.prototype 622 __proto__: WebInspector.SettingsTab.prototype
623 } 623 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 /** 681 /**
682 * @constructor 682 * @constructor
683 * @extends {WebInspector.Object} 683 * @extends {WebInspector.Object}
684 * @param {!Array.<{id: string, placeholder: (string|undefined), options: (!Arra y.<string>|undefined)}>} columns 684 * @param {!Array.<{id: string, placeholder: (string|undefined), options: (!Arra y.<string>|undefined)}>} columns
685 * @param {function(!Element, {id: string, placeholder: (string|undefined), opti ons: (!Array.<string>|undefined)}, ?string)} itemRenderer 685 * @param {function(!Element, {id: string, placeholder: (string|undefined), opti ons: (!Array.<string>|undefined)}, ?string)} itemRenderer
686 */ 686 */
687 WebInspector.SettingsList = function(columns, itemRenderer) 687 WebInspector.SettingsList = function(columns, itemRenderer)
688 { 688 {
689 this.element = document.createElementWithClass("div", "settings-list"); 689 this.element = createElementWithClass("div", "settings-list");
690 this.element.tabIndex = -1; 690 this.element.tabIndex = -1;
691 this._itemRenderer = itemRenderer; 691 this._itemRenderer = itemRenderer;
692 /** @type {!StringMap.<!Element>} */ 692 /** @type {!StringMap.<!Element>} */
693 this._listItems = new StringMap(); 693 this._listItems = new StringMap();
694 /** @type {!Array.<?string>} */ 694 /** @type {!Array.<?string>} */
695 this._ids = []; 695 this._ids = [];
696 this._columns = columns; 696 this._columns = columns;
697 } 697 }
698 698
699 WebInspector.SettingsList.Events = { 699 WebInspector.SettingsList.Events = {
700 Selected: "Selected", 700 Selected: "Selected",
701 Removed: "Removed", 701 Removed: "Removed",
702 DoubleClicked: "DoubleClicked", 702 DoubleClicked: "DoubleClicked",
703 } 703 }
704 704
705 WebInspector.SettingsList.prototype = { 705 WebInspector.SettingsList.prototype = {
706 /** 706 /**
707 * @param {?string} itemId 707 * @param {?string} itemId
708 * @param {?string=} beforeId 708 * @param {?string=} beforeId
709 * @return {!Element} 709 * @return {!Element}
710 */ 710 */
711 addItem: function(itemId, beforeId) 711 addItem: function(itemId, beforeId)
712 { 712 {
713 var listItem = document.createElementWithClass("div", "settings-list-ite m"); 713 var listItem = createElementWithClass("div", "settings-list-item");
714 listItem._id = itemId; 714 listItem._id = itemId;
715 if (typeof beforeId !== "undefined") 715 if (typeof beforeId !== "undefined")
716 this.element.insertBefore(listItem, this.itemForId(beforeId)); 716 this.element.insertBefore(listItem, this.itemForId(beforeId));
717 else 717 else
718 this.element.appendChild(listItem); 718 this.element.appendChild(listItem);
719 719
720 var listItemContents = listItem.createChild("div", "settings-list-item-c ontents"); 720 var listItemContents = listItem.createChild("div", "settings-list-item-c ontents");
721 var listItemColumnsElement = listItemContents.createChild("div", "settin gs-list-item-columns"); 721 var listItemColumnsElement = listItemContents.createChild("div", "settin gs-list-item-columns");
722 722
723 listItem.columnElements = {}; 723 listItem.columnElements = {};
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 if (event) 836 if (event)
837 event.consume(); 837 event.consume();
838 }, 838 },
839 839
840 /** 840 /**
841 * @param {function(!Event)} handler 841 * @param {function(!Event)} handler
842 * @return {!Element} 842 * @return {!Element}
843 */ 843 */
844 _createRemoveButton: function(handler) 844 _createRemoveButton: function(handler)
845 { 845 {
846 var removeButton = document.createElementWithClass("div", "remove-item-b utton"); 846 var removeButton = createElementWithClass("div", "remove-item-button");
847 removeButton.addEventListener("click", handler, false); 847 removeButton.addEventListener("click", handler, false);
848 return removeButton; 848 return removeButton;
849 }, 849 },
850 850
851 __proto__: WebInspector.Object.prototype 851 __proto__: WebInspector.Object.prototype
852 } 852 }
853 853
854 /** 854 /**
855 * @constructor 855 * @constructor
856 * @extends {WebInspector.SettingsList} 856 * @extends {WebInspector.SettingsList}
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 var columnId = columns[i]; 1153 var columnId = columns[i];
1154 var editElement = this._addInputElements.get(columnId); 1154 var editElement = this._addInputElements.get(columnId);
1155 this._setEditElementValue(editElement, ""); 1155 this._setEditElementValue(editElement, "");
1156 } 1156 }
1157 }, 1157 },
1158 1158
1159 __proto__: WebInspector.SettingsList.prototype 1159 __proto__: WebInspector.SettingsList.prototype
1160 } 1160 }
1161 1161
1162 WebInspector._settingsController = new WebInspector.SettingsController(); 1162 WebInspector._settingsController = new WebInspector.SettingsController();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698