| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 * @implements {WebInspector.TargetManager.Observer} | 34 * @implements {WebInspector.TargetManager.Observer} |
| 35 */ | 35 */ |
| 36 WebInspector.RenderingOptionsView = function() | 36 WebInspector.RenderingOptionsView = function() |
| 37 { | 37 { |
| 38 WebInspector.VBox.call(this, true); | 38 WebInspector.VBox.call(this, true); |
| 39 this.registerRequiredCSS("main/renderingOptions.css"); | 39 this.registerRequiredCSS("main/renderingOptions.css"); |
| 40 | 40 |
| 41 /** @type {!Map.<string, !Element>} */ | 41 /** @type {!Map.<string, !Element>} */ |
| 42 this._settings = new Map(); | 42 this._settings = new Map(); |
| 43 | 43 |
| 44 this._appendCheckbox(WebInspector.UIString("Enable paint flashing"), "setSho
wPaintRects"); | 44 var options = [ |
| 45 this._appendCheckbox(WebInspector.UIString("Show layer borders"), "setShowDe
bugBorders"); | 45 { |
| 46 this._appendCheckbox(WebInspector.UIString("Show FPS meter"), "setShowFPSCou
nter"); | 46 label: WebInspector.UIString("Paint Flashing"), |
| 47 var scrollingTitle = WebInspector.UIString("Shows areas of the page that slo
w down scrolling:\nTouch and mousewheel event listeners can delay scrolling.\nSo
me areas need to repaint their content when scrolled."); | 47 subtitle: WebInspector.UIString("Highlights areas of the page that n
eed to be repainted"), |
| 48 this._appendCheckbox(WebInspector.UIString("Show scrolling perf issues"), "s
etShowScrollBottleneckRects", scrollingTitle); | 48 setterName: "setShowPaintRects" |
| 49 }, |
| 50 { |
| 51 label: WebInspector.UIString("Layer Borders"), |
| 52 subtitle: WebInspector.UIString("Shows layer borders (orange/olive)
and tiles (cyan)"), |
| 53 setterName: "setShowDebugBorders" |
| 54 }, |
| 55 { |
| 56 label: WebInspector.UIString("FPS Meter"), |
| 57 subtitle: WebInspector.UIString("Plots frames per second, frame rate
distribution, and GPU memory"), |
| 58 setterName: "setShowFPSCounter" |
| 59 }, |
| 60 { |
| 61 label: WebInspector.UIString("Scrolling Performance Issues"), |
| 62 subtitle: WebInspector.UIString("Shows areas of the page that slow d
own scrolling"), |
| 63 setterName: "setShowScrollBottleneckRects", |
| 64 tooltip: "Touch and mousewheel event listeners can delay scrolling.\
nSome areas need to repaint their content when scrolled." |
| 65 } |
| 66 ]; |
| 67 for (var i = 0; i < options.length; i++) |
| 68 this._appendCheckbox(options[i].label, options[i].setterName, options[i]
.subtitle, options[i].tooltip); |
| 49 | 69 |
| 50 // CSS media. | 70 this.contentElement.createChild("div").classList.add("panel-section-separato
r"); |
| 51 var mediaRow = this.contentElement.createChild("div", "media-row"); | 71 |
| 52 var checkboxLabel = createCheckboxLabel(WebInspector.UIString("Emulate media
"), false); | 72 var cssMediaSubtitle = WebInspector.UIString("Forces media type for testing
print and screen styles"); |
| 73 var checkboxLabel = createCheckboxLabel(WebInspector.UIString("Emulate CSS M
edia"), false, cssMediaSubtitle); |
| 53 this._mediaCheckbox = checkboxLabel.checkboxElement; | 74 this._mediaCheckbox = checkboxLabel.checkboxElement; |
| 54 this._mediaCheckbox.addEventListener("click", this._mediaToggled.bind(this),
false); | 75 this._mediaCheckbox.addEventListener("click", this._mediaToggled.bind(this),
false); |
| 55 mediaRow.appendChild(checkboxLabel); | 76 this.contentElement.appendChild(checkboxLabel); |
| 77 |
| 78 var mediaRow = this.contentElement.createChild("div", "media-row"); |
| 56 this._mediaSelect = mediaRow.createChild("select", "chrome-select"); | 79 this._mediaSelect = mediaRow.createChild("select", "chrome-select"); |
| 57 this._mediaSelect.appendChild(new Option(WebInspector.UIString("print"), "pr
int")); | 80 this._mediaSelect.appendChild(new Option(WebInspector.UIString("print"), "pr
int")); |
| 58 this._mediaSelect.appendChild(new Option(WebInspector.UIString("screen"), "s
creen")); | 81 this._mediaSelect.appendChild(new Option(WebInspector.UIString("screen"), "s
creen")); |
| 59 this._mediaSelect.addEventListener("change", this._mediaToggled.bind(this),
false); | 82 this._mediaSelect.addEventListener("change", this._mediaToggled.bind(this),
false); |
| 60 this._mediaSelect.disabled = true; | 83 this._mediaSelect.disabled = true; |
| 61 | 84 |
| 62 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Pag
e); | 85 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Pag
e); |
| 63 } | 86 } |
| 64 | 87 |
| 65 WebInspector.RenderingOptionsView.prototype = { | 88 WebInspector.RenderingOptionsView.prototype = { |
| 66 /** | 89 /** |
| 67 * @param {string} label | 90 * @param {string} label |
| 68 * @param {string} setterName | 91 * @param {string} setterName |
| 69 * @param {string=} title | 92 * @param {string=} subtitle |
| 93 * @param {string=} tooltip |
| 70 */ | 94 */ |
| 71 _appendCheckbox: function(label, setterName, title) | 95 _appendCheckbox: function(label, setterName, subtitle, tooltip) |
| 72 { | 96 { |
| 73 var checkboxLabel = createCheckboxLabel(label, false); | 97 var checkboxLabel = createCheckboxLabel(label, false, subtitle); |
| 74 this._settings.set(setterName, checkboxLabel.checkboxElement); | 98 this._settings.set(setterName, checkboxLabel.checkboxElement); |
| 75 checkboxLabel.checkboxElement.addEventListener("click", this._settingTog
gled.bind(this, setterName)); | 99 checkboxLabel.checkboxElement.addEventListener("click", this._settingTog
gled.bind(this, setterName)); |
| 76 if (title) | 100 if (tooltip) |
| 77 checkboxLabel.title = title; | 101 checkboxLabel.title = tooltip; |
| 78 this.contentElement.appendChild(checkboxLabel); | 102 this.contentElement.appendChild(checkboxLabel); |
| 79 }, | 103 }, |
| 80 | 104 |
| 81 /** | 105 /** |
| 82 * @param {string} setterName | 106 * @param {string} setterName |
| 83 */ | 107 */ |
| 84 _settingToggled: function(setterName) | 108 _settingToggled: function(setterName) |
| 85 { | 109 { |
| 86 var enabled = this._settings.get(setterName).checked; | 110 var enabled = this._settings.get(setterName).checked; |
| 87 var targets = WebInspector.targetManager.targets(WebInspector.Target.Typ
e.Page); | 111 var targets = WebInspector.targetManager.targets(WebInspector.Target.Typ
e.Page); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 * @param {!WebInspector.Context} context | 181 * @param {!WebInspector.Context} context |
| 158 * @param {string} actionId | 182 * @param {string} actionId |
| 159 * @return {boolean} | 183 * @return {boolean} |
| 160 */ | 184 */ |
| 161 handleAction: function(context, actionId) | 185 handleAction: function(context, actionId) |
| 162 { | 186 { |
| 163 WebInspector.inspectorView.showViewInDrawer("rendering"); | 187 WebInspector.inspectorView.showViewInDrawer("rendering"); |
| 164 return true; | 188 return true; |
| 165 } | 189 } |
| 166 } | 190 } |
| OLD | NEW |