| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 'Highlights elements (teal) that can slow down scrolling, including
touch & wheel event handlers and other main-thread scrolling situations.'), | 61 'Highlights elements (teal) that can slow down scrolling, including
touch & wheel event handlers and other main-thread scrolling situations.'), |
| 62 setterName: 'setShowScrollBottleneckRects' | 62 setterName: 'setShowScrollBottleneckRects' |
| 63 } | 63 } |
| 64 ]; | 64 ]; |
| 65 for (var i = 0; i < options.length; i++) | 65 for (var i = 0; i < options.length; i++) |
| 66 this._appendCheckbox(options[i].label, options[i].setterName, options[i].s
ubtitle); | 66 this._appendCheckbox(options[i].label, options[i].setterName, options[i].s
ubtitle); |
| 67 | 67 |
| 68 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); | 68 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); |
| 69 | 69 |
| 70 var cssMediaSubtitle = Common.UIString('Forces media type for testing print
and screen styles'); | 70 var cssMediaSubtitle = Common.UIString('Forces media type for testing print
and screen styles'); |
| 71 var checkboxLabel = UI.createCheckboxLabel(Common.UIString('Emulate CSS Medi
a'), false, cssMediaSubtitle); | 71 var checkboxLabel = UI.CheckboxLabel.create(Common.UIString('Emulate CSS Med
ia'), false, cssMediaSubtitle); |
| 72 this._mediaCheckbox = checkboxLabel.checkboxElement; | 72 this._mediaCheckbox = checkboxLabel.checkboxElement; |
| 73 this._mediaCheckbox.addEventListener('click', this._mediaToggled.bind(this),
false); | 73 this._mediaCheckbox.addEventListener('click', this._mediaToggled.bind(this),
false); |
| 74 this.contentElement.appendChild(checkboxLabel); | 74 this.contentElement.appendChild(checkboxLabel); |
| 75 | 75 |
| 76 var mediaRow = this.contentElement.createChild('div', 'media-row'); | 76 var mediaRow = this.contentElement.createChild('div', 'media-row'); |
| 77 this._mediaSelect = mediaRow.createChild('select', 'chrome-select'); | 77 this._mediaSelect = mediaRow.createChild('select', 'chrome-select'); |
| 78 this._mediaSelect.appendChild(new Option(Common.UIString('print'), 'print'))
; | 78 this._mediaSelect.appendChild(new Option(Common.UIString('print'), 'print'))
; |
| 79 this._mediaSelect.appendChild(new Option(Common.UIString('screen'), 'screen'
)); | 79 this._mediaSelect.appendChild(new Option(Common.UIString('screen'), 'screen'
)); |
| 80 this._mediaSelect.addEventListener('change', this._mediaToggled.bind(this),
false); | 80 this._mediaSelect.addEventListener('change', this._mediaToggled.bind(this),
false); |
| 81 this._mediaSelect.disabled = true; | 81 this._mediaSelect.disabled = true; |
| 82 | 82 |
| 83 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); | 83 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); |
| 84 } | 84 } |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * @return {!Main.RenderingOptionsView} | 87 * @return {!Main.RenderingOptionsView} |
| 88 */ | 88 */ |
| 89 static instance() { | 89 static instance() { |
| 90 if (!Main.RenderingOptionsView._instanceObject) | 90 if (!Main.RenderingOptionsView._instanceObject) |
| 91 Main.RenderingOptionsView._instanceObject = new Main.RenderingOptionsView(
); | 91 Main.RenderingOptionsView._instanceObject = new Main.RenderingOptionsView(
); |
| 92 return Main.RenderingOptionsView._instanceObject; | 92 return Main.RenderingOptionsView._instanceObject; |
| 93 } | 93 } |
| 94 | 94 |
| 95 /** | 95 /** |
| 96 * @param {string} label | 96 * @param {string} label |
| 97 * @param {string} setterName | 97 * @param {string} setterName |
| 98 * @param {string=} subtitle | 98 * @param {string=} subtitle |
| 99 */ | 99 */ |
| 100 _appendCheckbox(label, setterName, subtitle) { | 100 _appendCheckbox(label, setterName, subtitle) { |
| 101 var checkboxLabel = UI.createCheckboxLabel(label, false, subtitle); | 101 var checkboxLabel = UI.CheckboxLabel.create(label, false, subtitle); |
| 102 this._settings.set(setterName, checkboxLabel.checkboxElement); | 102 this._settings.set(setterName, checkboxLabel.checkboxElement); |
| 103 checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled
.bind(this, setterName)); | 103 checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled
.bind(this, setterName)); |
| 104 this.contentElement.appendChild(checkboxLabel); | 104 this.contentElement.appendChild(checkboxLabel); |
| 105 } | 105 } |
| 106 | 106 |
| 107 /** | 107 /** |
| 108 * @param {string} setterName | 108 * @param {string} setterName |
| 109 */ | 109 */ |
| 110 _settingToggled(setterName) { | 110 _settingToggled(setterName) { |
| 111 var enabled = this._settings.get(setterName).checked; | 111 var enabled = this._settings.get(setterName).checked; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 cssModel.mediaQueryResultChanged(); | 143 cssModel.mediaQueryResultChanged(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @override | 147 * @override |
| 148 * @param {!SDK.Target} target | 148 * @param {!SDK.Target} target |
| 149 */ | 149 */ |
| 150 targetRemoved(target) { | 150 targetRemoved(target) { |
| 151 } | 151 } |
| 152 }; | 152 }; |
| OLD | NEW |