2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
33 * @implements {WebInspector.TargetManager.Observer}
35 WebInspector.RenderingOptions = function()
38 * @type {!Map.<!WebInspector.Setting, string>}
40 this._setterNames = new Map();
41 this._mapSettingToSetter(WebInspector.settings.showPaintRects, "setShowPaintRects");
42 this._mapSettingToSetter(WebInspector.settings.showDebugBorders, "setShowDebugBorders");
43 this._mapSettingToSetter(WebInspector.settings.showFPSCounter, "setShowFPSCounter");
44 this._mapSettingToSetter(WebInspector.settings.continuousPainting, "setContinuousPaintingEnabled");
45 this._mapSettingToSetter(WebInspector.settings.showScrollBottleneckRects, "setShowScrollBottleneckRects");
47 WebInspector.targetManager.observeTargets(this);
50 WebInspector.RenderingOptions.prototype = {
52 * @param {!WebInspector.Target} target
54 targetAdded: function(target)
56 var settings = this._setterNames.keysArray();
57 for (var i = 0; i < settings.length; ++i) {
58 var setting = settings[i];
60 var setterName = this._setterNames.get(setting);
61 target.pageAgent()[setterName](true);
67 * @param {!WebInspector.Target} target
69 targetRemoved: function(target)
74 * @param {!WebInspector.Setting} setting
75 * @param {string} setterName
77 _mapSettingToSetter: function(setting, setterName)
79 this._setterNames.set(setting, setterName);
80 setting.addChangeListener(changeListener);
82 function changeListener()
84 var targets = WebInspector.targetManager.targets();
85 for (var i = 0; i < targets.length; ++i)
86 targets[i].pageAgent()[setterName](setting.get());
93 * @extends {WebInspector.VBox}
95 WebInspector.RenderingOptions.View = function()
97 WebInspector.VBox.call(this);
98 this.registerRequiredCSS("components/helpScreen.css");
99 this.element.classList.add("help-indent-labels");
101 var div = this.element.createChild("div", "settings-tab help-content help-container help-no-columns");
102 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show paint rectangles"), WebInspector.settings.showPaintRects));
103 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show composited layer borders"), WebInspector.settings.showDebugBorders));
104 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show FPS meter"), WebInspector.settings.showFPSCounter));
105 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Enable continuous page repainting"), WebInspector.settings.continuousPainting));
106 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show potential scroll bottlenecks"), WebInspector.settings.showScrollBottleneckRects);
107 child.title = WebInspector.UIString("Shows areas of the page that slow down scrolling:\nTouch and mousewheel event listeners can delay scrolling.\nSome areas need to repaint their content when scrolled.");
108 div.appendChild(child);
111 WebInspector.RenderingOptions.View.prototype = {
112 __proto__: WebInspector.VBox.prototype