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

Side by Side Diff: Source/devtools/front_end/main/RenderingOptions.js

Issue 385173007: DevTools: move UI components to target observers in preparation to early UI initialization. (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
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/main/module.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.TargetManager.Observer}
34 */
35 WebInspector.RenderingOptions = function()
36 {
37 /**
38 * @type {!Map.<!WebInspector.Setting, string>}
39 */
40 this._setterNames = new Map();
41 this._mapSettingToSetter(WebInspector.settings.showPaintRects, "setShowPaint Rects");
42 this._mapSettingToSetter(WebInspector.settings.showDebugBorders, "setShowDeb ugBorders");
43 this._mapSettingToSetter(WebInspector.settings.showFPSCounter, "setShowFPSCo unter");
44 this._mapSettingToSetter(WebInspector.settings.continuousPainting, "setConti nuousPaintingEnabled");
45 this._mapSettingToSetter(WebInspector.settings.showScrollBottleneckRects, "s etShowScrollBottleneckRects");
46
47 WebInspector.targetManager.observeTargets(this);
48 }
49
50 WebInspector.RenderingOptions.prototype = {
51 /**
52 * @param {!WebInspector.Target} target
53 */
54 targetAdded: function(target)
55 {
56 var settings = this._setterNames.keys();
57 for (var i = 0; i < settings.length; ++i) {
58 var setting = settings[i];
59 if (setting.get()) {
60 var setterName = this._setterNames.get(setting);
61 target.pageAgent()[setterName](true);
62 }
63 }
64 },
65
66 /**
67 * @param {!WebInspector.Target} target
68 */
69 targetRemoved: function(target)
70 {
71 },
72
73 /**
74 * @param {!WebInspector.Setting} setting
75 * @param {string} setterName
76 */
77 _mapSettingToSetter: function(setting, setterName)
78 {
79 this._setterNames.put(setting, setterName);
80 setting.addChangeListener(changeListener);
81
82 function changeListener()
83 {
84 var targets = WebInspector.targetManager.targets();
85 for (var i = 0; i < targets.length; ++i)
86 targets[i].pageAgent()[setterName](setting.get());
87 }
88 }
89 }
90
91 /**
92 * @constructor
33 * @extends {WebInspector.VBox} 93 * @extends {WebInspector.VBox}
34 */ 94 */
35 WebInspector.RenderingOptionsView = function() 95 WebInspector.RenderingOptions.View = function()
36 { 96 {
37 WebInspector.VBox.call(this); 97 WebInspector.VBox.call(this);
38 this.registerRequiredCSS("helpScreen.css"); 98 this.registerRequiredCSS("helpScreen.css");
39 this.element.classList.add("help-indent-labels"); 99 this.element.classList.add("help-indent-labels");
40 100
41 var div = this.element.createChild("div", "settings-tab help-content help-co ntainer help-no-columns"); 101 var div = this.element.createChild("div", "settings-tab help-content help-co ntainer help-no-columns");
42 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show paint rectangles"), WebInspector.settings.showPaintRects)); 102 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show paint rectangles"), WebInspector.settings.showPaintRects));
43 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show composited layer borders"), WebInspector.settings.showDebugBorders )); 103 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show composited layer borders"), WebInspector.settings.showDebugBorders ));
44 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show FPS meter"), WebInspector.settings.showFPSCounter)); 104 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show FPS meter"), WebInspector.settings.showFPSCounter));
45 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Enable continuous page repainting"), WebInspector.settings.continuousPa inting)); 105 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Enable continuous page repainting"), WebInspector.settings.continuousPa inting));
46 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStr ing("Show potential scroll bottlenecks"), WebInspector.settings.showScrollBottle neckRects); 106 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStr ing("Show potential scroll bottlenecks"), WebInspector.settings.showScrollBottle neckRects);
47 child.title = WebInspector.UIString("Shows areas of the page that slow down scrolling:\nTouch and mousewheel event listeners can delay scrolling.\nSome area s need to repaint their content when scrolled."); 107 child.title = WebInspector.UIString("Shows areas of the page that slow down scrolling:\nTouch and mousewheel event listeners can delay scrolling.\nSome area s need to repaint their content when scrolled.");
48 div.appendChild(child); 108 div.appendChild(child);
49 } 109 }
50 110
51 WebInspector.RenderingOptionsView.prototype = { 111 WebInspector.RenderingOptions.View.prototype = {
52 __proto__: WebInspector.VBox.prototype 112 __proto__: WebInspector.VBox.prototype
53 } 113 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/main/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698