| 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 24 matching lines...) Expand all Loading... |
| 35 constructor() { | 35 constructor() { |
| 36 super(true); | 36 super(true); |
| 37 this.registerRequiredCSS('main/renderingOptions.css'); | 37 this.registerRequiredCSS('main/renderingOptions.css'); |
| 38 | 38 |
| 39 /** @type {!Map.<string, !Element>} */ | 39 /** @type {!Map.<string, !Element>} */ |
| 40 this._settings = new Map(); | 40 this._settings = new Map(); |
| 41 | 41 |
| 42 var options = [ | 42 var options = [ |
| 43 { | 43 { |
| 44 label: Common.UIString('Paint Flashing'), | 44 label: Common.UIString('Paint Flashing'), |
| 45 subtitle: Common.UIString('Highlights areas of the page that need to be
repainted'), | 45 subtitle: Common.UIString('Highlights areas of the page (green) that nee
d to be repainted'), |
| 46 setterName: 'setShowPaintRects' | 46 setterName: 'setShowPaintRects' |
| 47 }, | 47 }, |
| 48 { | 48 { |
| 49 label: Common.UIString('Layer Borders'), | 49 label: Common.UIString('Layer Borders'), |
| 50 subtitle: Common.UIString('Shows layer borders (orange/olive) and tiles
(cyan)'), | 50 subtitle: Common.UIString('Shows layer borders (orange/olive) and tiles
(cyan)'), |
| 51 setterName: 'setShowDebugBorders' | 51 setterName: 'setShowDebugBorders' |
| 52 }, | 52 }, |
| 53 { | 53 { |
| 54 label: Common.UIString('FPS Meter'), | 54 label: Common.UIString('FPS Meter'), |
| 55 subtitle: Common.UIString('Plots frames per second, frame rate distribut
ion, and GPU memory'), | 55 subtitle: Common.UIString('Plots frames per second, frame rate distribut
ion, and GPU memory'), |
| 56 setterName: 'setShowFPSCounter' | 56 setterName: 'setShowFPSCounter' |
| 57 }, | 57 }, |
| 58 { | 58 { |
| 59 label: Common.UIString('Scrolling Performance Issues'), | 59 label: Common.UIString('Scrolling Performance Issues'), |
| 60 subtitle: Common.UIString('Shows areas of the page that slow down scroll
ing'), | 60 subtitle: Common.UIString('Highlights elements (teal) that can slow down
scrolling, including touch & wheel event handlers and other main-thread scrolli
ng situations.'), |
| 61 setterName: 'setShowScrollBottleneckRects', | 61 setterName: 'setShowScrollBottleneckRects' |
| 62 tooltip: | |
| 63 'Touch and mousewheel event listeners can delay scrolling.\nSome are
as need to repaint their content when scrolled.' | |
| 64 } | 62 } |
| 65 ]; | 63 ]; |
| 66 for (var i = 0; i < options.length; i++) | 64 for (var i = 0; i < options.length; i++) |
| 67 this._appendCheckbox(options[i].label, options[i].setterName, options[i].s
ubtitle, options[i].tooltip); | 65 this._appendCheckbox(options[i].label, options[i].setterName, options[i].s
ubtitle); |
| 68 | 66 |
| 69 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); | 67 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); |
| 70 | 68 |
| 71 var cssMediaSubtitle = Common.UIString('Forces media type for testing print
and screen styles'); | 69 var cssMediaSubtitle = Common.UIString('Forces media type for testing print
and screen styles'); |
| 72 var checkboxLabel = createCheckboxLabel(Common.UIString('Emulate CSS Media')
, false, cssMediaSubtitle); | 70 var checkboxLabel = createCheckboxLabel(Common.UIString('Emulate CSS Media')
, false, cssMediaSubtitle); |
| 73 this._mediaCheckbox = checkboxLabel.checkboxElement; | 71 this._mediaCheckbox = checkboxLabel.checkboxElement; |
| 74 this._mediaCheckbox.addEventListener('click', this._mediaToggled.bind(this),
false); | 72 this._mediaCheckbox.addEventListener('click', this._mediaToggled.bind(this),
false); |
| 75 this.contentElement.appendChild(checkboxLabel); | 73 this.contentElement.appendChild(checkboxLabel); |
| 76 | 74 |
| 77 var mediaRow = this.contentElement.createChild('div', 'media-row'); | 75 var mediaRow = this.contentElement.createChild('div', 'media-row'); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 90 static instance() { | 88 static instance() { |
| 91 if (!Main.RenderingOptionsView._instanceObject) | 89 if (!Main.RenderingOptionsView._instanceObject) |
| 92 Main.RenderingOptionsView._instanceObject = new Main.RenderingOptionsView(
); | 90 Main.RenderingOptionsView._instanceObject = new Main.RenderingOptionsView(
); |
| 93 return Main.RenderingOptionsView._instanceObject; | 91 return Main.RenderingOptionsView._instanceObject; |
| 94 } | 92 } |
| 95 | 93 |
| 96 /** | 94 /** |
| 97 * @param {string} label | 95 * @param {string} label |
| 98 * @param {string} setterName | 96 * @param {string} setterName |
| 99 * @param {string=} subtitle | 97 * @param {string=} subtitle |
| 100 * @param {string=} tooltip | |
| 101 */ | 98 */ |
| 102 _appendCheckbox(label, setterName, subtitle, tooltip) { | 99 _appendCheckbox(label, setterName, subtitle) { |
| 103 var checkboxLabel = createCheckboxLabel(label, false, subtitle); | 100 var checkboxLabel = createCheckboxLabel(label, false, subtitle); |
| 104 this._settings.set(setterName, checkboxLabel.checkboxElement); | 101 this._settings.set(setterName, checkboxLabel.checkboxElement); |
| 105 checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled
.bind(this, setterName)); | 102 checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled
.bind(this, setterName)); |
| 106 if (tooltip) | |
| 107 checkboxLabel.title = tooltip; | |
| 108 this.contentElement.appendChild(checkboxLabel); | 103 this.contentElement.appendChild(checkboxLabel); |
| 109 } | 104 } |
| 110 | 105 |
| 111 /** | 106 /** |
| 112 * @param {string} setterName | 107 * @param {string} setterName |
| 113 */ | 108 */ |
| 114 _settingToggled(setterName) { | 109 _settingToggled(setterName) { |
| 115 var enabled = this._settings.get(setterName).checked; | 110 var enabled = this._settings.get(setterName).checked; |
| 116 for (var target of SDK.targetManager.targets(SDK.Target.Capability.Browser)) | 111 for (var target of SDK.targetManager.targets(SDK.Target.Capability.Browser)) |
| 117 target.renderingAgent()[setterName](enabled); | 112 target.renderingAgent()[setterName](enabled); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 147 cssModel.mediaQueryResultChanged(); | 142 cssModel.mediaQueryResultChanged(); |
| 148 } | 143 } |
| 149 | 144 |
| 150 /** | 145 /** |
| 151 * @override | 146 * @override |
| 152 * @param {!SDK.Target} target | 147 * @param {!SDK.Target} target |
| 153 */ | 148 */ |
| 154 targetRemoved(target) { | 149 targetRemoved(target) { |
| 155 } | 150 } |
| 156 }; | 151 }; |
| OLD | NEW |