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

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

Issue 2819183002: [DevTools] Consolidate overlay-related functionality in Overlay domain (Closed)
Patch Set: rebased bad merge Created 3 years, 8 months 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 8613deca5f52f392c6529fb223993d88717dfe82..521a8a804c6730f84f6b71f691e28b6fa0beaaf7 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
@@ -36,35 +36,22 @@ Main.RenderingOptionsView = class extends UI.VBox {
super(true);
this.registerRequiredCSS('main/renderingOptions.css');
- /** @type {!Map.<string, !Element>} */
- this._settings = new Map();
-
- var options = [
- {
- label: Common.UIString('Paint Flashing'),
- subtitle: Common.UIString('Highlights areas of the page (green) that need to be repainted'),
- setterName: 'setShowPaintRects'
- },
- {
- label: Common.UIString('Layer Borders'),
- subtitle: Common.UIString('Shows layer borders (orange/olive) and tiles (cyan)'),
- setterName: 'setShowDebugBorders'
- },
- {
- label: Common.UIString('FPS Meter'),
- subtitle: Common.UIString('Plots frames per second, frame rate distribution, and GPU memory'),
- setterName: 'setShowFPSCounter'
- },
- {
- label: Common.UIString('Scrolling Performance Issues'),
- subtitle: Common.UIString(
+ this._appendCheckbox(
+ Common.UIString('Paint Flashing'),
+ Common.UIString('Highlights areas of the page (green) that need to be repainted'),
+ Common.moduleSetting('showPaintRects'));
+ this._appendCheckbox(
+ Common.UIString('Layer Borders'), Common.UIString('Shows layer borders (orange/olive) and tiles (cyan)'),
+ Common.moduleSetting('showDebugBorders'));
+ this._appendCheckbox(
+ Common.UIString('FPS Meter'),
+ Common.UIString('Plots frames per second, frame rate distribution, and GPU memory'),
+ Common.moduleSetting('showFPSCounter'));
+ this._appendCheckbox(
+ Common.UIString('Scrolling Performance Issues'),
+ Common.UIString(
'Highlights elements (teal) that can slow down scrolling, including touch & wheel event handlers and other main-thread scrolling situations.'),
- setterName: 'setShowScrollBottleneckRects'
- }
- ];
- for (var i = 0; i < options.length; i++)
- this._appendCheckbox(options[i].label, options[i].setterName, options[i].subtitle);
-
+ Common.moduleSetting('showScrollBottleneckRects'));
this.contentElement.createChild('div').classList.add('panel-section-separator');
var cssMediaSubtitle = Common.UIString('Forces media type for testing print and screen styles');
@@ -80,7 +67,7 @@ Main.RenderingOptionsView = class extends UI.VBox {
this._mediaSelect.addEventListener('change', this._mediaToggled.bind(this), false);
this._mediaSelect.disabled = true;
- SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser);
+ SDK.targetManager.observeTargets(this);
}
/**
@@ -94,35 +81,21 @@ Main.RenderingOptionsView = class extends UI.VBox {
/**
* @param {string} label
- * @param {string} setterName
- * @param {string=} subtitle
+ * @param {string} subtitle
+ * @param {!Common.Setting} setting
*/
- _appendCheckbox(label, setterName, subtitle) {
+ _appendCheckbox(label, subtitle, setting) {
var checkboxLabel = UI.CheckboxLabel.create(label, false, subtitle);
- this._settings.set(setterName, checkboxLabel.checkboxElement);
- checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled.bind(this, setterName));
+ UI.SettingsUI.bindCheckbox(checkboxLabel.checkboxElement, setting);
this.contentElement.appendChild(checkboxLabel);
}
/**
- * @param {string} setterName
- */
- _settingToggled(setterName) {
- var enabled = this._settings.get(setterName).checked;
- for (var target of SDK.targetManager.targets(SDK.Target.Capability.Browser))
- target.renderingAgent()[setterName](enabled);
- }
-
- /**
* @override
* @param {!SDK.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)
+ if (this._mediaCheckbox.checked && target.hasBrowserCapability())
this._applyPrintMediaOverride(target);
}

Powered by Google App Engine
This is Rietveld 408576698