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

Unified Diff: third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js b/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
index f909785db92d7893b3cd91f85b03ca5e99746566..b86cd39d5b1ec543c66050d596b966f5976925eb 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
@@ -27,141 +27,132 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
/**
- * @constructor
- * @extends {WebInspector.VBox}
* @implements {WebInspector.TargetManager.Observer}
+ * @unrestricted
*/
-WebInspector.RenderingOptionsView = function()
-{
- WebInspector.VBox.call(this, true);
- this.registerRequiredCSS("main/renderingOptions.css");
+WebInspector.RenderingOptionsView = class extends WebInspector.VBox {
+ constructor() {
+ super(true);
+ this.registerRequiredCSS('main/renderingOptions.css');
/** @type {!Map.<string, !Element>} */
this._settings = new Map();
var options = [
- {
- label: WebInspector.UIString("Paint Flashing"),
- subtitle: WebInspector.UIString("Highlights areas of the page that need to be repainted"),
- setterName: "setShowPaintRects"
- },
- {
- label: WebInspector.UIString("Layer Borders"),
- subtitle: WebInspector.UIString("Shows layer borders (orange/olive) and tiles (cyan)"),
- setterName: "setShowDebugBorders"
- },
- {
- label: WebInspector.UIString("FPS Meter"),
- subtitle: WebInspector.UIString("Plots frames per second, frame rate distribution, and GPU memory"),
- setterName: "setShowFPSCounter"
- },
- {
- label: WebInspector.UIString("Scrolling Performance Issues"),
- subtitle: WebInspector.UIString("Shows areas of the page that slow down scrolling"),
- setterName: "setShowScrollBottleneckRects",
- tooltip: "Touch and mousewheel event listeners can delay scrolling.\nSome areas need to repaint their content when scrolled."
- }
+ {
+ label: WebInspector.UIString('Paint Flashing'),
+ subtitle: WebInspector.UIString('Highlights areas of the page that need to be repainted'),
+ setterName: 'setShowPaintRects'
+ },
+ {
+ label: WebInspector.UIString('Layer Borders'),
+ subtitle: WebInspector.UIString('Shows layer borders (orange/olive) and tiles (cyan)'),
+ setterName: 'setShowDebugBorders'
+ },
+ {
+ label: WebInspector.UIString('FPS Meter'),
+ subtitle: WebInspector.UIString('Plots frames per second, frame rate distribution, and GPU memory'),
+ setterName: 'setShowFPSCounter'
+ },
+ {
+ label: WebInspector.UIString('Scrolling Performance Issues'),
+ subtitle: WebInspector.UIString('Shows areas of the page that slow down scrolling'),
+ setterName: 'setShowScrollBottleneckRects',
+ tooltip:
+ 'Touch and mousewheel event listeners can delay scrolling.\nSome areas need to repaint their content when scrolled.'
+ }
];
for (var i = 0; i < options.length; i++)
- this._appendCheckbox(options[i].label, options[i].setterName, options[i].subtitle, options[i].tooltip);
+ this._appendCheckbox(options[i].label, options[i].setterName, options[i].subtitle, options[i].tooltip);
- this.contentElement.createChild("div").classList.add("panel-section-separator");
+ this.contentElement.createChild('div').classList.add('panel-section-separator');
- var cssMediaSubtitle = WebInspector.UIString("Forces media type for testing print and screen styles");
- var checkboxLabel = createCheckboxLabel(WebInspector.UIString("Emulate CSS Media"), false, cssMediaSubtitle);
+ var cssMediaSubtitle = WebInspector.UIString('Forces media type for testing print and screen styles');
+ var checkboxLabel = createCheckboxLabel(WebInspector.UIString('Emulate CSS Media'), false, cssMediaSubtitle);
this._mediaCheckbox = checkboxLabel.checkboxElement;
- this._mediaCheckbox.addEventListener("click", this._mediaToggled.bind(this), false);
+ this._mediaCheckbox.addEventListener('click', this._mediaToggled.bind(this), false);
this.contentElement.appendChild(checkboxLabel);
- var mediaRow = this.contentElement.createChild("div", "media-row");
- this._mediaSelect = mediaRow.createChild("select", "chrome-select");
- this._mediaSelect.appendChild(new Option(WebInspector.UIString("print"), "print"));
- this._mediaSelect.appendChild(new Option(WebInspector.UIString("screen"), "screen"));
- this._mediaSelect.addEventListener("change", this._mediaToggled.bind(this), false);
+ var mediaRow = this.contentElement.createChild('div', 'media-row');
+ this._mediaSelect = mediaRow.createChild('select', 'chrome-select');
+ this._mediaSelect.appendChild(new Option(WebInspector.UIString('print'), 'print'));
+ this._mediaSelect.appendChild(new Option(WebInspector.UIString('screen'), 'screen'));
+ this._mediaSelect.addEventListener('change', this._mediaToggled.bind(this), false);
this._mediaSelect.disabled = true;
WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Browser);
-};
+ }
-WebInspector.RenderingOptionsView.prototype = {
- /**
- * @param {string} label
- * @param {string} setterName
- * @param {string=} subtitle
- * @param {string=} tooltip
- */
- _appendCheckbox: function(label, setterName, subtitle, tooltip)
- {
- var checkboxLabel = createCheckboxLabel(label, false, subtitle);
- this._settings.set(setterName, checkboxLabel.checkboxElement);
- checkboxLabel.checkboxElement.addEventListener("click", this._settingToggled.bind(this, setterName));
- if (tooltip)
- checkboxLabel.title = tooltip;
- this.contentElement.appendChild(checkboxLabel);
- },
+ /**
+ * @return {!WebInspector.RenderingOptionsView}
+ */
+ static instance() {
+ if (!WebInspector.RenderingOptionsView._instanceObject)
+ WebInspector.RenderingOptionsView._instanceObject = new WebInspector.RenderingOptionsView();
+ return WebInspector.RenderingOptionsView._instanceObject;
+ }
- /**
- * @param {string} setterName
- */
- _settingToggled: function(setterName)
- {
- var enabled = this._settings.get(setterName).checked;
- for (var target of WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser))
- target.renderingAgent()[setterName](enabled);
- },
+ /**
+ * @param {string} label
+ * @param {string} setterName
+ * @param {string=} subtitle
+ * @param {string=} tooltip
+ */
+ _appendCheckbox(label, setterName, subtitle, tooltip) {
+ var checkboxLabel = createCheckboxLabel(label, false, subtitle);
+ this._settings.set(setterName, checkboxLabel.checkboxElement);
+ checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled.bind(this, setterName));
+ if (tooltip)
+ checkboxLabel.title = tooltip;
+ this.contentElement.appendChild(checkboxLabel);
+ }
- /**
- * @override
- * @param {!WebInspector.Target} target
- */
- targetAdded: function(target)
- {
- for (var setterName of this._settings.keysArray()) {
- if (this._settings.get(setterName).checked)
- target.renderingAgent()[setterName](true);
- }
- if (this._mediaCheckbox.checked)
- this._applyPrintMediaOverride(target);
- },
+ /**
+ * @param {string} setterName
+ */
+ _settingToggled(setterName) {
+ var enabled = this._settings.get(setterName).checked;
+ for (var target of WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser))
+ target.renderingAgent()[setterName](enabled);
+ }
- _mediaToggled: function()
- {
- this._mediaSelect.disabled = !this._mediaCheckbox.checked;
- var targets = WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser);
- for (var target of targets)
- this._applyPrintMediaOverride(target);
- },
+ /**
+ * @override
+ * @param {!WebInspector.Target} target
+ */
+ targetAdded(target) {
+ for (var setterName of this._settings.keysArray()) {
+ if (this._settings.get(setterName).checked)
+ target.renderingAgent()[setterName](true);
+ }
+ if (this._mediaCheckbox.checked)
+ this._applyPrintMediaOverride(target);
+ }
- /**
- * @param {!WebInspector.Target} target
- */
- _applyPrintMediaOverride: function(target)
- {
- target.emulationAgent().setEmulatedMedia(this._mediaCheckbox.checked ? this._mediaSelect.value : "");
- var cssModel = WebInspector.CSSModel.fromTarget(target);
- if (cssModel)
- cssModel.mediaQueryResultChanged();
- },
+ _mediaToggled() {
+ this._mediaSelect.disabled = !this._mediaCheckbox.checked;
+ var targets = WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser);
+ for (var target of targets)
+ this._applyPrintMediaOverride(target);
+ }
- /**
- * @override
- * @param {!WebInspector.Target} target
- */
- targetRemoved: function(target)
- {
- },
+ /**
+ * @param {!WebInspector.Target} target
+ */
+ _applyPrintMediaOverride(target) {
+ target.emulationAgent().setEmulatedMedia(this._mediaCheckbox.checked ? this._mediaSelect.value : '');
+ var cssModel = WebInspector.CSSModel.fromTarget(target);
+ if (cssModel)
+ cssModel.mediaQueryResultChanged();
+ }
- __proto__: WebInspector.VBox.prototype
+ /**
+ * @override
+ * @param {!WebInspector.Target} target
+ */
+ targetRemoved(target) {
+ }
};
-/**
- * @return {!WebInspector.RenderingOptionsView}
- */
-WebInspector.RenderingOptionsView.instance = function()
-{
- if (!WebInspector.RenderingOptionsView._instanceObject)
- WebInspector.RenderingOptionsView._instanceObject = new WebInspector.RenderingOptionsView();
- return WebInspector.RenderingOptionsView._instanceObject;
-};
+

Powered by Google App Engine
This is Rietveld 408576698