OLD | NEW |
---|---|
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 */ |
11 WebInspector.ResponsiveDesignView = function(inspectedPagePlaceholder) | 11 WebInspector.ResponsiveDesignView = function(inspectedPagePlaceholder) |
12 { | 12 { |
13 WebInspector.VBox.call(this); | 13 WebInspector.VBox.call(this); |
14 this.registerRequiredCSS("responsiveDesignView.css"); | 14 this.registerRequiredCSS("responsiveDesignView.css"); |
15 this.element.classList.add("overflow-hidden"); | |
15 | 16 |
16 this._responsiveDesignContainer = new WebInspector.VBox(); | 17 this._responsiveDesignContainer = new WebInspector.VBox(); |
17 | 18 |
18 this._createToolbar(); | 19 this._createToolbar(); |
19 this._warningMessage = this._responsiveDesignContainer.element.createChild(" div", "responsive-design-warning hidden"); | 20 this._warningMessage = this._responsiveDesignContainer.element.createChild(" div", "responsive-design-warning hidden"); |
20 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport .Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); | 21 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport .Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); |
21 | 22 |
22 this._canvasContainer = new WebInspector.View(); | 23 this._canvasContainer = new WebInspector.View(); |
23 this._canvasContainer.element.classList.add("responsive-design"); | 24 this._canvasContainer.element.classList.add("responsive-design"); |
24 this._canvasContainer.show(this._responsiveDesignContainer.element); | 25 this._canvasContainer.show(this._responsiveDesignContainer.element); |
(...skipping 14 matching lines...) Expand all Loading... | |
39 this._heightSlider.createChild("div", "responsive-design-thumb-handle"); | 40 this._heightSlider.createChild("div", "responsive-design-thumb-handle"); |
40 this._createResizer(this._heightSlider, true); | 41 this._createResizer(this._heightSlider, true); |
41 | 42 |
42 this._inspectedPagePlaceholder = inspectedPagePlaceholder; | 43 this._inspectedPagePlaceholder = inspectedPagePlaceholder; |
43 inspectedPagePlaceholder.show(this.element); | 44 inspectedPagePlaceholder.show(this.element); |
44 | 45 |
45 this._enabled = false; | 46 this._enabled = false; |
46 | 47 |
47 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._onZoomChanged, this); | 48 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._onZoomChanged, this); |
48 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._updateOverridesSupportOnDockSideChange, this); | 49 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._updateOverridesSupportOnDockSideChange, this); |
49 WebInspector.settings.responsiveDesignMode.addChangeListener(this._responsiv eDesignModeChanged, this); | 50 WebInspector.settings.responsiveDesign.enabled.addChangeListener(this._respo nsiveDesignEnabledChanged, this); |
50 | 51 |
51 WebInspector.overridesSupport.settings.emulateViewport.addChangeListener(thi s._maybeEnableResponsiveDesign, this); | 52 WebInspector.overridesSupport.settings.emulateViewport.addChangeListener(thi s._maybeEnableResponsiveDesign, this); |
52 WebInspector.overridesSupport.settings.emulateTouchEvents.addChangeListener( this._maybeEnableResponsiveDesign, this); | 53 WebInspector.overridesSupport.settings.emulateTouchEvents.addChangeListener( this._maybeEnableResponsiveDesign, this); |
53 WebInspector.overridesSupport.settings.overrideDeviceResolution.addChangeLis tener(this._maybeEnableResponsiveDesign, this); | 54 WebInspector.overridesSupport.settings.overrideDeviceResolution.addChangeLis tener(this._maybeEnableResponsiveDesign, this); |
54 | 55 |
55 this._updateOverridesSupportOnDockSideChange(); | 56 this._updateOverridesSupportOnDockSideChange(); |
56 }; | 57 }; |
57 | 58 |
58 // Measured in DIP. | 59 // Measured in DIP. |
59 WebInspector.ResponsiveDesignView.SliderWidth = 19; | 60 WebInspector.ResponsiveDesignView.SliderWidth = 19; |
60 WebInspector.ResponsiveDesignView.RulerWidth = 20; | 61 WebInspector.ResponsiveDesignView.RulerWidth = 20; |
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.responsiveDesign.enabled.set(true); |
72 } | 72 } |
73 }, | 73 }, |
74 | 74 |
75 _responsiveDesignModeChanged: function() | 75 _responsiveDesignEnabledChanged: function() |
76 { | 76 { |
77 delete this._cachedScale; | 77 delete this._cachedScale; |
78 delete this._cachedCssCanvasWidth; | 78 delete this._cachedCssCanvasWidth; |
79 delete this._cachedCssCanvasHeight; | 79 delete this._cachedCssCanvasHeight; |
80 delete this._cachedCssHeight; | 80 delete this._cachedCssHeight; |
81 delete this._cachedCssWidth; | 81 delete this._cachedCssWidth; |
82 delete this._cachedZoomFactor; | 82 delete this._cachedZoomFactor; |
83 delete this._availableSize; | 83 delete this._availableSize; |
84 | 84 |
85 var enabled = WebInspector.settings.responsiveDesignMode.get() && WebIns pector.dockController.dockSide() !== WebInspector.DockController.State.Undocked; | 85 var enabled = WebInspector.settings.responsiveDesign.enabled.get() && We bInspector.dockController.dockSide() !== WebInspector.DockController.State.Undoc ked; |
86 if (enabled && !this._enabled) { | 86 if (enabled && !this._enabled) { |
87 this._ignoreResize = true; | 87 this._ignoreResize = true; |
88 this._enabled = true; | 88 this._enabled = true; |
89 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); | 89 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); |
90 this._inspectedPagePlaceholder.show(this._pageContainer); | 90 this._inspectedPagePlaceholder.show(this._pageContainer); |
91 this._responsiveDesignContainer.show(this.element); | 91 this._responsiveDesignContainer.show(this.element); |
92 WebInspector.overridesSupport.setPageResizer(this); | 92 WebInspector.overridesSupport.setPageResizer(this); |
93 delete this._ignoreResize; | 93 delete this._ignoreResize; |
94 } | 94 } |
95 | 95 |
96 if (!enabled && this._enabled) { | 96 if (!enabled && this._enabled) { |
97 this._ignoreResize = true; | 97 this._ignoreResize = true; |
98 this._enabled = false; | 98 this._enabled = false; |
99 this._scale = 0; | 99 this._scale = 0; |
100 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); | 100 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); |
101 this._responsiveDesignContainer.detach(); | 101 this._responsiveDesignContainer.detach(); |
102 this._inspectedPagePlaceholder.show(this.element); | 102 this._inspectedPagePlaceholder.show(this.element); |
103 WebInspector.overridesSupport.setPageResizer(null); | 103 WebInspector.overridesSupport.setPageResizer(null); |
104 delete this._ignoreResize; | 104 delete this._ignoreResize; |
105 } | 105 } |
106 }, | 106 }, |
107 | 107 |
108 _updateOverridesSupportOnDockSideChange: function() | 108 _updateOverridesSupportOnDockSideChange: function() |
109 { | 109 { |
110 this._responsiveDesignModeChanged(); | 110 this._responsiveDesignEnabledChanged(); |
111 }, | 111 }, |
112 | 112 |
113 /** | 113 /** |
114 * WebInspector.OverridesSupport.PageResizer override. | 114 * WebInspector.OverridesSupport.PageResizer override. |
115 * @param {number} dipWidth | 115 * @param {number} dipWidth |
116 * @param {number} dipHeight | 116 * @param {number} dipHeight |
117 * @param {number} scale | 117 * @param {number} scale |
118 */ | 118 */ |
119 update: function(dipWidth, dipHeight, scale) | 119 update: function(dipWidth, dipHeight, scale) |
120 { | 120 { |
121 if (!this._enabled) | 121 if (!this._enabled) |
122 return; | 122 return; |
123 | 123 |
124 this._scale = scale; | 124 this._scale = scale; |
125 this._dipWidth = dipWidth; | 125 this._dipWidth = dipWidth; |
126 this._dipHeight = dipHeight; | 126 this._dipHeight = dipHeight; |
127 this._resolutionWidthLabel.textContent = dipWidth + "px"; | 127 this._resolutionWidthLabel.textContent = dipWidth + "px"; |
128 this._resolutionHeightLabel.textContent = dipHeight + "px"; | 128 this._resolutionHeightLabel.textContent = dipHeight + "px"; |
129 this._updateUI(); | 129 this._updateUI(); |
130 }, | 130 }, |
131 | 131 |
132 /** | 132 /** |
133 * WebInspector.OverridesSupport.PageResizer override. | 133 * WebInspector.OverridesSupport.PageResizer override. |
134 * @return {!Size} | 134 * @return {!Size} |
135 */ | 135 */ |
136 availableDipSize: function() | 136 availableDipSize: function() |
137 { | 137 { |
138 if (typeof this._availableSize === "undefined") { | 138 if (typeof this._availableSize === "undefined") { |
139 var zoomFactor = WebInspector.zoomManager.zoomFactor(); | 139 var zoomFactor = WebInspector.zoomManager.zoomFactor(); |
140 var rect = this.element.getBoundingClientRect(); | 140 var rect = this._canvasContainer.element.getBoundingClientRect(); |
141 this._availableSize = new Size(rect.width * zoomFactor - WebInspecto r.ResponsiveDesignView.RulerWidth, | 141 this._availableSize = new Size(rect.width * zoomFactor - WebInspecto r.ResponsiveDesignView.RulerWidth, |
142 rect.height * zoomFactor - WebInspect or.ResponsiveDesignView.RulerWidth - WebInspector.ResponsiveDesignView.ToolbarHe ight); | 142 rect.height * zoomFactor - WebInspect or.ResponsiveDesignView.RulerWidth); |
143 } | 143 } |
144 return this._availableSize; | 144 return this._availableSize; |
145 }, | 145 }, |
146 | 146 |
147 /** | 147 /** |
148 * @param {!Element} element | 148 * @param {!Element} element |
149 * @param {boolean} vertical | 149 * @param {boolean} vertical |
150 * @return {!WebInspector.ResizerWidget} | 150 * @return {!WebInspector.ResizerWidget} |
151 */ | 151 */ |
152 _createResizer: function(element, vertical) | 152 _createResizer: function(element, vertical) |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 this._updateUI(); | 379 this._updateUI(); |
380 }, | 380 }, |
381 | 381 |
382 _onZoomChanged: function() | 382 _onZoomChanged: function() |
383 { | 383 { |
384 this._updateUI(); | 384 this._updateUI(); |
385 }, | 385 }, |
386 | 386 |
387 _createToolbar: function() | 387 _createToolbar: function() |
388 { | 388 { |
389 this._toolbarElement = this._responsiveDesignContainer.element.createChi ld("div", "responsive-design-toolbar"); | 389 var toolbarElement = this._responsiveDesignContainer.element.createChild ("div", "responsive-design-toolbar"); |
390 this._toolbarSection = toolbarElement.createChild("div", "responsive-des ign-composite-section hbox"); | |
391 | |
392 this._expandedDeviceSection = document.createElementWithClass("div", "re sponsive-design-composite-section vbox"); | |
393 this._expandedScreenTouchSection = document.createElementWithClass("div" , "responsive-design-composite-section hbox"); | |
394 | |
395 this._expandSection = document.createElementWithClass("div", "responsive -design-section vbox"); | |
396 WebInspector.settings.responsiveDesign.toolbarExpanded = WebInspector.se ttings.createSetting("responsiveDesign.toolbarExpanded", false); | |
397 this._expandButton = this._expandSection.createChild("div", "responsive- design-expand"); | |
398 this._expandButton.createChild("div", "responsive-design-icon responsive -design-icon-expand"); | |
399 this._expandButton.createChild("span"); | |
400 this._expandButton.addEventListener("click", this._toggleToolbarExpanded .bind(this)); | |
401 WebInspector.settings.responsiveDesign.toolbarExpanded.addChangeListener (this._toolbarExpandedChanged, this); | |
390 | 402 |
391 // Device | 403 // Device |
392 var sectionElement = this._toolbarElement.createChild("div", "responsive -design-section"); | 404 this._deviceSection = document.createElementWithClass("div", "responsive -design-section"); |
393 var deviceLabel = sectionElement.createChild("label"); | 405 var deviceLabel = this._deviceSection.createChild("label"); |
394 var deviceCheckbox = deviceLabel.createChild("input"); | 406 var deviceCheckbox = deviceLabel.createChild("input"); |
395 deviceCheckbox.type = "checkbox"; | 407 deviceCheckbox.type = "checkbox"; |
396 deviceLabel.createTextChild(WebInspector.UIString("Device")); | 408 deviceLabel.createTextChild(WebInspector.UIString("Device")); |
397 deviceLabel.title = WebInspector.UIString("Emulate device"); | 409 deviceLabel.title = WebInspector.UIString("Emulate device"); |
398 deviceCheckbox.addEventListener("change", deviceChecked, false); | 410 deviceCheckbox.addEventListener("change", deviceChecked, false); |
399 | 411 |
400 function deviceChecked() | 412 function deviceChecked() |
401 { | 413 { |
402 if (deviceCheckbox.checked) { | 414 if (deviceCheckbox.checked) { |
403 var option = deviceSelect.options[deviceSelect.selectedIndex]; | 415 var option = deviceSelect.options[deviceSelect.selectedIndex]; |
404 WebInspector.overridesSupport.emulateDevice(option.metrics, opti on.userAgent); | 416 WebInspector.overridesSupport.emulateDevice(option.metrics, opti on.userAgent); |
405 } else { | 417 } else { |
406 WebInspector.overridesSupport.resetEmulatedDevice(); | 418 WebInspector.overridesSupport.resetEmulatedDevice(); |
407 } | 419 } |
408 } | 420 } |
409 | 421 |
410 var deviceSelect = WebInspector.overridesSupport.createDeviceSelect(docu ment); | 422 var deviceSelect = WebInspector.overridesSupport.createDeviceSelect(docu ment); |
411 sectionElement.appendChild(deviceSelect); | 423 this._deviceSection.appendChild(deviceSelect); |
412 deviceSelect.addEventListener("change", emulateDevice, false); | 424 deviceSelect.addEventListener("change", emulateDevice, false); |
413 | 425 |
414 function emulateDevice() | 426 function emulateDevice() |
415 { | 427 { |
416 var option = deviceSelect.options[deviceSelect.selectedIndex]; | 428 var option = deviceSelect.options[deviceSelect.selectedIndex]; |
417 WebInspector.overridesSupport.emulateDevice(option.metrics, option.u serAgent); | 429 WebInspector.overridesSupport.emulateDevice(option.metrics, option.u serAgent); |
418 } | 430 } |
419 | 431 |
420 updateDeviceCheckboxStatus(); | 432 updateDeviceCheckboxStatus(); |
421 | 433 |
422 WebInspector.overridesSupport.settings.emulateViewport.addChangeListener (updateDeviceCheckboxStatus); | 434 WebInspector.overridesSupport.settings.emulateViewport.addChangeListener (updateDeviceCheckboxStatus); |
423 WebInspector.overridesSupport.settings.emulateTouchEvents.addChangeListe ner(updateDeviceCheckboxStatus); | 435 WebInspector.overridesSupport.settings.emulateTouchEvents.addChangeListe ner(updateDeviceCheckboxStatus); |
424 WebInspector.overridesSupport.settings.overrideDeviceResolution.addChang eListener(updateDeviceCheckboxStatus); | 436 WebInspector.overridesSupport.settings.overrideDeviceResolution.addChang eListener(updateDeviceCheckboxStatus); |
425 | 437 |
426 function updateDeviceCheckboxStatus() | 438 function updateDeviceCheckboxStatus() |
427 { | 439 { |
428 deviceCheckbox.checked = WebInspector.overridesSupport.settings.emul ateViewport.get() && | 440 deviceCheckbox.checked = WebInspector.overridesSupport.settings.emul ateViewport.get() && |
429 WebInspector.overridesSupport.settings.emulateTouchEvents.get() && | 441 WebInspector.overridesSupport.settings.emulateTouchEvents.get() && |
430 WebInspector.overridesSupport.settings.overrideDeviceResolution. get(); | 442 WebInspector.overridesSupport.settings.overrideDeviceResolution. get(); |
431 } | 443 } |
432 | 444 |
433 // Screen | 445 // Screen |
434 sectionElement = this._toolbarElement.createChild("div", "responsive-des ign-section"); | 446 this._screenSection = document.createElementWithClass("div", "responsive -design-section"); |
435 sectionElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox ("Screen", WebInspector.overridesSupport.settings.overrideDeviceResolution, true )); | 447 this._screenSection.appendChild(WebInspector.SettingsUI.createSettingChe ckbox("Screen", WebInspector.overridesSupport.settings.overrideDeviceResolution, true)); |
436 | 448 |
437 var fieldsetElement = WebInspector.SettingsUI.createSettingFieldset(WebI nspector.overridesSupport.settings.overrideDeviceResolution); | 449 var fieldsetElement = WebInspector.SettingsUI.createSettingFieldset(WebI nspector.overridesSupport.settings.overrideDeviceResolution); |
438 sectionElement.appendChild(fieldsetElement); | 450 this._screenSection.appendChild(fieldsetElement); |
439 fieldsetElement.createChild("div", "responsive-design-icon responsive-de sign-icon-resolution").title = WebInspector.UIString("Screen resolution"); | 451 fieldsetElement.createChild("div", "responsive-design-icon responsive-de sign-icon-resolution").title = WebInspector.UIString("Screen resolution"); |
440 | 452 |
441 fieldsetElement.appendChild(WebInspector.SettingsUI.createSettingInputFi eld("", WebInspector.overridesSupport.settings.deviceWidth, true, 4, "3em", WebI nspector.OverridesSupport.inputValidator, true)); | 453 fieldsetElement.appendChild(WebInspector.SettingsUI.createSettingInputFi eld("", WebInspector.overridesSupport.settings.deviceWidth, true, 4, "3em", WebI nspector.OverridesSupport.inputValidator, true)); |
442 fieldsetElement.appendChild(document.createTextNode(" \u00D7 ")); | 454 fieldsetElement.appendChild(document.createTextNode(" \u00D7 ")); |
443 fieldsetElement.appendChild(WebInspector.SettingsUI.createSettingInputFi eld("", WebInspector.overridesSupport.settings.deviceHeight, true, 4, "3em", Web Inspector.OverridesSupport.inputValidator, true)); | 455 fieldsetElement.appendChild(WebInspector.SettingsUI.createSettingInputFi eld("", WebInspector.overridesSupport.settings.deviceHeight, true, 4, "3em", Web Inspector.OverridesSupport.inputValidator, true)); |
444 | 456 |
445 this._swapDimensionsElement = fieldsetElement.createChild("button", "res ponsive-design-icon responsive-design-icon-swap"); | 457 this._swapDimensionsElement = fieldsetElement.createChild("button", "res ponsive-design-icon responsive-design-icon-swap"); |
446 this._swapDimensionsElement.title = WebInspector.UIString("Swap dimensio ns"); | 458 this._swapDimensionsElement.title = WebInspector.UIString("Swap dimensio ns"); |
447 this._swapDimensionsElement.addEventListener("click", WebInspector.overr idesSupport.swapDimensions.bind(WebInspector.overridesSupport), false); | 459 this._swapDimensionsElement.addEventListener("click", WebInspector.overr idesSupport.swapDimensions.bind(WebInspector.overridesSupport), false); |
448 | 460 |
449 fieldsetElement.createChild("div", "responsive-design-icon responsive-de sign-icon-dpr").title = WebInspector.UIString("Device pixel ratio"); | 461 fieldsetElement.createChild("div", "responsive-design-icon responsive-de sign-icon-dpr").title = WebInspector.UIString("Device pixel ratio"); |
450 fieldsetElement.appendChild(WebInspector.SettingsUI.createSettingInputFi eld("", WebInspector.overridesSupport.settings.deviceScaleFactor, true, 2, "2em" , WebInspector.OverridesSupport.inputValidator, true)); | 462 fieldsetElement.appendChild(WebInspector.SettingsUI.createSettingInputFi eld("", WebInspector.overridesSupport.settings.deviceScaleFactor, true, 2, "2em" , WebInspector.OverridesSupport.inputValidator, true)); |
451 | 463 |
452 // Touch and viewport | 464 // Touch and viewport |
453 sectionElement = this._toolbarElement.createChild("div", "responsive-des ign-section"); | 465 this._touchSection = document.createElementWithClass("div", "responsive- design-section"); |
454 sectionElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox (WebInspector.UIString("Touch"), WebInspector.overridesSupport.settings.emulateT ouchEvents, true)); | 466 this._touchSection.appendChild(WebInspector.SettingsUI.createSettingChec kbox(WebInspector.UIString("Touch"), WebInspector.overridesSupport.settings.emul ateTouchEvents, true)); |
455 sectionElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox (WebInspector.UIString("Viewport"), WebInspector.overridesSupport.settings.emula teViewport, true)); | 467 this._touchSection.appendChild(WebInspector.SettingsUI.createSettingChec kbox(WebInspector.UIString("Viewport"), WebInspector.overridesSupport.settings.e mulateViewport, true)); |
468 | |
469 // User agent. | |
470 this._userAgentSection = document.createElementWithClass("div", "respons ive-design-composite-section vbox solid"); | |
471 var userAgentRow = this._userAgentSection.createChild("div", "responsive -design-composite-section hbox solid"); | |
472 userAgentRow.createChild("div", "responsive-design-section hbox").append Child(WebInspector.SettingsUI.createSettingCheckbox("User Agent", WebInspector.o verridesSupport.settings.overrideUserAgent, true)); | |
473 var userAgentSelectAndInput = WebInspector.overridesSupport.createUserAg entSelectAndInput(document); | |
474 userAgentRow.createChild("div", "responsive-design-section hbox").append Child(userAgentSelectAndInput.select); | |
475 this._userAgentSection.createChild("div", "responsive-design-section hbo x").appendChild(userAgentSelectAndInput.input); | |
476 | |
477 this._toolbarExpandedChanged(); | |
478 }, | |
479 | |
480 _toggleToolbarExpanded: function() | |
481 { | |
482 WebInspector.settings.responsiveDesign.toolbarExpanded.set(!WebInspector .settings.responsiveDesign.toolbarExpanded.get()); | |
483 }, | |
484 | |
485 _toolbarExpandedChanged: function() | |
486 { | |
487 var expanded = WebInspector.settings.responsiveDesign.toolbarExpanded.ge t(); | |
488 this._expandButton.classList.toggle("expanded", expanded); | |
489 this._expandButton.querySelector("span").textContent = WebInspector.UISt ring(expanded ? "Collapse" : "Expand"); | |
490 | |
491 if (expanded) { | |
492 this._expandedScreenTouchSection.textContent = ""; | |
493 this._expandedScreenTouchSection.appendChild(this._screenSection); | |
494 this._expandedScreenTouchSection.appendChild(this._touchSection); | |
495 | |
496 this._expandedDeviceSection.textContent = ""; | |
497 this._expandedDeviceSection.appendChild(this._deviceSection); | |
498 this._expandedDeviceSection.appendChild(this._expandedScreenTouchSec tion); | |
499 | |
500 this._toolbarSection.textContent = ""; | |
501 this._toolbarSection.appendChild(this._expandSection); | |
502 this._toolbarSection.appendChild(this._expandedDeviceSection); | |
503 this._toolbarSection.appendChild(this._userAgentSection); | |
504 } else { | |
505 this._toolbarSection.textContent = ""; | |
aandrey
2014/06/05 14:44:38
we can add Element.prototype.appendChildren() in D
dgozman
2014/06/06 11:31:11
Nice idea. Done.
| |
506 this._toolbarSection.appendChild(this._expandSection); | |
507 this._toolbarSection.appendChild(this._deviceSection); | |
508 this._toolbarSection.appendChild(this._screenSection); | |
509 this._toolbarSection.appendChild(this._touchSection); | |
510 } | |
511 | |
512 this.onResize(); | |
456 }, | 513 }, |
457 | 514 |
458 _overridesWarningUpdated: function() | 515 _overridesWarningUpdated: function() |
459 { | 516 { |
460 var message = WebInspector.overridesSupport.warningMessage(); | 517 var message = WebInspector.overridesSupport.warningMessage(); |
461 if (this._warningMessage.textContent === message) | 518 if (this._warningMessage.textContent === message) |
462 return; | 519 return; |
463 this._warningMessage.classList.toggle("hidden", !message); | 520 this._warningMessage.classList.toggle("hidden", !message); |
464 this._warningMessage.textContent = message; | 521 this._warningMessage.textContent = message; |
465 this._responsiveDesignModeChanged(); | 522 this._responsiveDesignEnabledChanged(); |
466 this.onResize(); | 523 this.onResize(); |
467 }, | 524 }, |
468 | 525 |
469 __proto__: WebInspector.VBox.prototype | 526 __proto__: WebInspector.VBox.prototype |
470 }; | 527 }; |
OLD | NEW |