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

Side by Side Diff: Source/devtools/front_end/ResponsiveDesignView.js

Issue 306123005: [DevTools] Fix responsive design UI issues. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Source/devtools/front_end/sdk/OverridesSupport.js » ('j') | 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.VBox} 7 * @extends {WebInspector.VBox}
8 * @implements {WebInspector.OverridesSupport.PageResizer} 8 * @implements {WebInspector.OverridesSupport.PageResizer}
9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder 9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder
10 */ 10 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 WebInspector.overridesSupport.settings.emulateViewport.addChangeListener(thi s._maybeEnableResponsiveDesign, this); 51 WebInspector.overridesSupport.settings.emulateViewport.addChangeListener(thi s._maybeEnableResponsiveDesign, this);
52 WebInspector.overridesSupport.settings.emulateTouchEvents.addChangeListener( this._maybeEnableResponsiveDesign, this); 52 WebInspector.overridesSupport.settings.emulateTouchEvents.addChangeListener( this._maybeEnableResponsiveDesign, this);
53 WebInspector.overridesSupport.settings.overrideDeviceResolution.addChangeLis tener(this._maybeEnableResponsiveDesign, this); 53 WebInspector.overridesSupport.settings.overrideDeviceResolution.addChangeLis tener(this._maybeEnableResponsiveDesign, this);
54 54
55 this._updateOverridesSupportOnDockSideChange(); 55 this._updateOverridesSupportOnDockSideChange();
56 }; 56 };
57 57
58 // Measured in DIP. 58 // Measured in DIP.
59 WebInspector.ResponsiveDesignView.SliderWidth = 19; 59 WebInspector.ResponsiveDesignView.SliderWidth = 19;
60 WebInspector.ResponsiveDesignView.RulerWidth = 20; 60 WebInspector.ResponsiveDesignView.RulerWidth = 20;
61 WebInspector.ResponsiveDesignView.ToolbarHeight = 24; 61 WebInspector.ResponsiveDesignView.ToolbarHeight = 23;
62 62
63 WebInspector.ResponsiveDesignView.prototype = { 63 WebInspector.ResponsiveDesignView.prototype = {
64 _maybeEnableResponsiveDesign: function() 64 _maybeEnableResponsiveDesign: function()
65 { 65 {
66 if (this._enabled) 66 if (this._enabled)
67 return; 67 return;
68 if (WebInspector.overridesSupport.settings.emulateViewport.get() || 68 if (WebInspector.overridesSupport.settings.emulateViewport.get() ||
69 WebInspector.overridesSupport.settings.emulateTouchEvents.get() || 69 WebInspector.overridesSupport.settings.emulateTouchEvents.get() ||
70 WebInspector.overridesSupport.settings.overrideDeviceResolution. get()) { 70 WebInspector.overridesSupport.settings.overrideDeviceResolution. get()) {
71 WebInspector.settings.responsiveDesignMode.set(true); 71 WebInspector.settings.responsiveDesignMode.set(true);
72 } 72 }
73 }, 73 },
74 74
75 _responsiveDesignModeChanged: function() 75 _responsiveDesignModeChanged: function()
76 { 76 {
77 if (WebInspector.dockController.dockSide() === WebInspector.DockControll er.State.Undocked) {
78 WebInspector.overridesSupport.setPageResizer(null);
79 return;
80 }
81
82 delete this._cachedScale; 77 delete this._cachedScale;
83 delete this._cachedCssCanvasWidth; 78 delete this._cachedCssCanvasWidth;
84 delete this._cachedCssCanvasHeight; 79 delete this._cachedCssCanvasHeight;
85 delete this._cachedCssHeight; 80 delete this._cachedCssHeight;
86 delete this._cachedCssWidth; 81 delete this._cachedCssWidth;
87 delete this._cachedZoomFactor; 82 delete this._cachedZoomFactor;
88 delete this._availableSize; 83 delete this._availableSize;
89 84
90 var enabled = WebInspector.settings.responsiveDesignMode.get(); 85 var enabled = WebInspector.settings.responsiveDesignMode.get() && WebIns pector.dockController.dockSide() !== WebInspector.DockController.State.Undocked;
91 if (enabled && !this._enabled) { 86 if (enabled && !this._enabled) {
92 this._ignoreResize = true; 87 this._ignoreResize = true;
93 this._enabled = true; 88 this._enabled = true;
94 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); 89 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
95 this._inspectedPagePlaceholder.show(this._pageContainer); 90 this._inspectedPagePlaceholder.show(this._pageContainer);
96 this._responsiveDesignContainer.show(this.element); 91 this._responsiveDesignContainer.show(this.element);
97 WebInspector.overridesSupport.setPageResizer(this); 92 WebInspector.overridesSupport.setPageResizer(this);
98 delete this._ignoreResize; 93 delete this._ignoreResize;
99 } 94 }
100 95
101 if (!enabled && this._enabled) { 96 if (!enabled && this._enabled) {
apavlov 2014/05/30 15:42:14 "else if" ?
dgozman 2014/05/31 05:48:18 I'll do this in next CL.
102 this._ignoreResize = true; 97 this._ignoreResize = true;
103 this._enabled = false; 98 this._enabled = false;
104 this._scale = 0; 99 this._scale = 0;
105 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); 100 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
106 this._responsiveDesignContainer.detach(); 101 this._responsiveDesignContainer.detach();
107 this._inspectedPagePlaceholder.show(this.element); 102 this._inspectedPagePlaceholder.show(this.element);
108 WebInspector.overridesSupport.setPageResizer(null); 103 WebInspector.overridesSupport.setPageResizer(null);
109 delete this._ignoreResize; 104 delete this._ignoreResize;
110 } 105 }
111 }, 106 },
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 if (this._warningMessage.textContent === message) 461 if (this._warningMessage.textContent === message)
467 return; 462 return;
468 this._warningMessage.classList.toggle("hidden", !message); 463 this._warningMessage.classList.toggle("hidden", !message);
469 this._warningMessage.textContent = message; 464 this._warningMessage.textContent = message;
470 this._responsiveDesignModeChanged(); 465 this._responsiveDesignModeChanged();
471 this.onResize(); 466 this.onResize();
472 }, 467 },
473 468
474 __proto__: WebInspector.VBox.prototype 469 __proto__: WebInspector.VBox.prototype
475 }; 470 };
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/sdk/OverridesSupport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698