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

Unified Diff: third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js

Issue 1641003003: [DevTools] Small cleanup after device mode v2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@device-mode-cleanup-split
Patch Set: Created 4 years, 11 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/emulation/MediaQueryInspector.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js b/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js
index ad59526596d6683965d87dadb881ddc9f50a0909..198b67ba7c4d8ca0d0d92cf4f955969045c78c8d 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js
@@ -13,7 +13,7 @@ WebInspector.MediaQueryInspector = function(getWidthCallback, setWidthCallback)
{
WebInspector.Widget.call(this, true);
this.registerRequiredCSS("emulation/mediaQueryInspector.css");
- this.contentElement.classList.add("media-inspector-view", "media-inspector-view-empty");
+ this.contentElement.classList.add("media-inspector-view");
this.contentElement.addEventListener("click", this._onMediaQueryClicked.bind(this), false);
this.contentElement.addEventListener("contextmenu", this._onContextMenu.bind(this), false);
this._mediaThrottler = new WebInspector.Throttler(0);
@@ -22,10 +22,8 @@ WebInspector.MediaQueryInspector = function(getWidthCallback, setWidthCallback)
this._setWidthCallback = setWidthCallback;
this._offset = 0;
this._scale = 1;
- this._lastReportedCount = 0;
WebInspector.targetManager.observeTargets(this);
-
WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._renderMediaQueries.bind(this), this);
}
@@ -38,10 +36,6 @@ WebInspector.MediaQueryInspector.Section = {
Min: 2
}
-WebInspector.MediaQueryInspector.Events = {
- CountUpdated: "CountUpdated"
-}
-
WebInspector.MediaQueryInspector.prototype = {
/**
* @override
@@ -90,15 +84,6 @@ WebInspector.MediaQueryInspector.prototype = {
},
/**
- * @param {boolean} enabled
- */
- setEnabled: function(enabled)
- {
- this._enabled = enabled;
- this._scheduleMediaQueriesUpdate();
- },
-
- /**
* @param {!Event} event
*/
_onMediaQueryClicked: function(event)
@@ -165,14 +150,14 @@ WebInspector.MediaQueryInspector.prototype = {
_scheduleMediaQueriesUpdate: function()
{
- if (!this._enabled)
+ if (!this.isShowing())
return;
this._mediaThrottler.schedule(this._refetchMediaQueries.bind(this));
},
_refetchMediaQueries: function()
{
- if (!this._enabled || !this._cssModel)
+ if (!this.isShowing() || !this._cssModel)
return Promise.resolve();
return this._cssModel.mediaQueriesPromise()
@@ -235,7 +220,7 @@ WebInspector.MediaQueryInspector.prototype = {
_renderMediaQueries: function()
{
- if (!this._cachedQueryModels)
+ if (!this._cachedQueryModels || !this.isShowing())
return;
var markers = [];
@@ -255,15 +240,6 @@ WebInspector.MediaQueryInspector.prototype = {
}
}
- if (markers.length !== this._lastReportedCount) {
- this._lastReportedCount = markers.length;
- this.dispatchEventToListeners(WebInspector.MediaQueryInspector.Events.CountUpdated, markers.length);
- }
-
- if (!this.isShowing())
- return;
-
- var oldChildrenCount = this.contentElement.children.length;
this.contentElement.removeChildren();
var container = null;
@@ -289,7 +265,7 @@ WebInspector.MediaQueryInspector.prototype = {
wasShown: function()
{
- this._renderMediaQueries();
+ this._scheduleMediaQueriesUpdate();
},
/**

Powered by Google App Engine
This is Rietveld 408576698