Chromium Code Reviews| 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"), |
|
lushnikov
2016/04/20 23:50:32
why do we drop this? Lets' still show this on hove
luoe
2016/04/22 00:44:50
Done.
| |
| 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 } | |
| 65 ]; | |
| 66 for (var i = 0; i < options.length; i++) | |
| 67 this._appendCheckbox(options[i].label, options[i].setterName, options[i] .subtitle); | |
| 49 | 68 |
| 50 // CSS media. | 69 this.contentElement.createChild("div").classList.add("panel-section-separato r"); |
| 51 var mediaRow = this.contentElement.createChild("div", "media-row"); | 70 |
| 52 var checkboxLabel = createCheckboxLabel(WebInspector.UIString("Emulate media "), false); | 71 var cssMediaSubtitle = WebInspector.UIString("Forces media type for testing print and screen styles"); |
| 72 var checkboxLabel = createCheckboxLabel(WebInspector.UIString("Emulate CSS M edia"), false, cssMediaSubtitle); | |
| 53 this._mediaCheckbox = checkboxLabel.checkboxElement; | 73 this._mediaCheckbox = checkboxLabel.checkboxElement; |
| 54 this._mediaCheckbox.addEventListener("click", this._mediaToggled.bind(this), false); | 74 this._mediaCheckbox.addEventListener("click", this._mediaToggled.bind(this), false); |
| 55 mediaRow.appendChild(checkboxLabel); | 75 this.contentElement.appendChild(checkboxLabel); |
| 76 | |
| 77 var mediaRow = this.contentElement.createChild("div", "media-row"); | |
| 56 this._mediaSelect = mediaRow.createChild("select", "chrome-select"); | 78 this._mediaSelect = mediaRow.createChild("select", "chrome-select"); |
| 57 this._mediaSelect.appendChild(new Option(WebInspector.UIString("print"), "pr int")); | 79 this._mediaSelect.appendChild(new Option(WebInspector.UIString("print"), "pr int")); |
| 58 this._mediaSelect.appendChild(new Option(WebInspector.UIString("screen"), "s creen")); | 80 this._mediaSelect.appendChild(new Option(WebInspector.UIString("screen"), "s creen")); |
| 59 this._mediaSelect.addEventListener("change", this._mediaToggled.bind(this), false); | 81 this._mediaSelect.addEventListener("change", this._mediaToggled.bind(this), false); |
| 60 this._mediaSelect.disabled = true; | 82 this._mediaSelect.disabled = true; |
| 61 | 83 |
| 62 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Pag e); | 84 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Pag e); |
| 63 } | 85 } |
| 64 | 86 |
| 65 WebInspector.RenderingOptionsView.prototype = { | 87 WebInspector.RenderingOptionsView.prototype = { |
| 66 /** | 88 /** |
| 67 * @param {string} label | 89 * @param {string} label |
| 68 * @param {string} setterName | 90 * @param {string} setterName |
| 69 * @param {string=} title | 91 * @param {string=} subtitle |
| 70 */ | 92 */ |
| 71 _appendCheckbox: function(label, setterName, title) | 93 _appendCheckbox: function(label, setterName, subtitle) |
| 72 { | 94 { |
| 73 var checkboxLabel = createCheckboxLabel(label, false); | 95 var checkboxLabel = createCheckboxLabel(label, false, subtitle); |
| 74 this._settings.set(setterName, checkboxLabel.checkboxElement); | 96 this._settings.set(setterName, checkboxLabel.checkboxElement); |
| 75 checkboxLabel.checkboxElement.addEventListener("click", this._settingTog gled.bind(this, setterName)); | 97 checkboxLabel.checkboxElement.addEventListener("click", this._settingTog gled.bind(this, setterName)); |
| 76 if (title) | |
| 77 checkboxLabel.title = title; | |
| 78 this.contentElement.appendChild(checkboxLabel); | 98 this.contentElement.appendChild(checkboxLabel); |
| 79 }, | 99 }, |
| 80 | 100 |
| 81 /** | 101 /** |
| 82 * @param {string} setterName | 102 * @param {string} setterName |
| 83 */ | 103 */ |
| 84 _settingToggled: function(setterName) | 104 _settingToggled: function(setterName) |
| 85 { | 105 { |
| 86 var enabled = this._settings.get(setterName).checked; | 106 var enabled = this._settings.get(setterName).checked; |
| 87 var targets = WebInspector.targetManager.targets(WebInspector.Target.Typ e.Page); | 107 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 | 177 * @param {!WebInspector.Context} context |
| 158 * @param {string} actionId | 178 * @param {string} actionId |
| 159 * @return {boolean} | 179 * @return {boolean} |
| 160 */ | 180 */ |
| 161 handleAction: function(context, actionId) | 181 handleAction: function(context, actionId) |
| 162 { | 182 { |
| 163 WebInspector.inspectorView.showViewInDrawer("rendering"); | 183 WebInspector.inspectorView.showViewInDrawer("rendering"); |
| 164 return true; | 184 return true; |
| 165 } | 185 } |
| 166 } | 186 } |
| OLD | NEW |