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

Side by Side Diff: Source/devtools/front_end/toolbox/MediaQueryInspector.js

Issue 399883002: DevTools: Make sure media query inspector is updated when it is enabled. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.View} 7 * @extends {WebInspector.View}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.MediaQueryInspector = function() 10 WebInspector.MediaQueryInspector = function()
11 { 11 {
12 WebInspector.View.call(this); 12 WebInspector.View.call(this);
13 this.element.classList.add("media-inspector-view", "media-inspector-view-emp ty"); 13 this.element.classList.add("media-inspector-view", "media-inspector-view-emp ty");
14 this.element.addEventListener("click", this._onMediaQueryClicked.bind(this), false); 14 this.element.addEventListener("click", this._onMediaQueryClicked.bind(this), false);
15 this.element.addEventListener("contextmenu", this._onContextMenu.bind(this), false); 15 this.element.addEventListener("contextmenu", this._onContextMenu.bind(this), false);
16 this.element.addEventListener("webkitAnimationEnd", this._onAnimationEnd.bin d(this), false); 16 this.element.addEventListener("webkitAnimationEnd", this._onAnimationEnd.bin d(this), false);
17 this._mediaThrottler = new WebInspector.Throttler(100); 17 this._mediaThrottler = new WebInspector.Throttler(100);
18 18
19 this._translateZero = 0; 19 this._translateZero = 0;
20 this._offset = 0; 20 this._offset = 0;
21 this._scale = 1; 21 this._scale = 1;
22 22
23 this._rulerDecorationLayer = document.createElementWithClass("div", "fill"); 23 this._rulerDecorationLayer = document.createElementWithClass("div", "fill");
24 this._rulerDecorationLayer.classList.add("media-inspector-ruler-decoration") ; 24 this._rulerDecorationLayer.classList.add("media-inspector-ruler-decoration") ;
25 this._rulerDecorationLayer.addEventListener("click", this._onRulerDecoration Clicked.bind(this), false); 25 this._rulerDecorationLayer.addEventListener("click", this._onRulerDecoration Clicked.bind(this), false);
26 26
27 WebInspector.targetManager.observeTargets(this); 27 WebInspector.targetManager.observeTargets(this);
28 28
29 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._renderMediaQueries.bind(this), this); 29 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._renderMediaQueries.bind(this), this);
30 this._scheduleMediaQueriesUpdate();
31 } 30 }
32 31
33 /** 32 /**
34 * @enum {number} 33 * @enum {number}
35 */ 34 */
36 WebInspector.MediaQueryInspector.Section = { 35 WebInspector.MediaQueryInspector.Section = {
37 Max: 0, 36 Max: 0,
38 MinMax: 1, 37 MinMax: 1,
39 Min: 2 38 Min: 2
40 } 39 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 this._scale = scale; 145 this._scale = scale;
147 this._renderMediaQueries(); 146 this._renderMediaQueries();
148 }, 147 },
149 148
150 /** 149 /**
151 * @param {boolean} enabled 150 * @param {boolean} enabled
152 */ 151 */
153 setEnabled: function(enabled) 152 setEnabled: function(enabled)
154 { 153 {
155 this._enabled = enabled; 154 this._enabled = enabled;
155 this._scheduleMediaQueriesUpdate();
156 }, 156 },
157 157
158 /** 158 /**
159 * @param {?Event} event 159 * @param {?Event} event
160 */ 160 */
161 _onMediaQueryClicked: function(event) 161 _onMediaQueryClicked: function(event)
162 { 162 {
163 var mediaQueryMarkerContainer = event.target.enclosingNodeOrSelfWithClas s("media-inspector-marker-container"); 163 var mediaQueryMarkerContainer = event.target.enclosingNodeOrSelfWithClas s("media-inspector-marker-container");
164 if (!mediaQueryMarkerContainer) 164 if (!mediaQueryMarkerContainer)
165 return; 165 return;
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 }, 547 },
548 548
549 /** 549 /**
550 * @return {?WebInspector.CSSMediaQueryExpression} 550 * @return {?WebInspector.CSSMediaQueryExpression}
551 */ 551 */
552 maxWidthExpression: function() 552 maxWidthExpression: function()
553 { 553 {
554 return this._maxWidthExpression; 554 return this._maxWidthExpression;
555 } 555 }
556 } 556 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698