Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.VBox} | 33 * @extends {WebInspector.VBox} |
| 34 * @implements {WebInspector.TargetManager.Observer} | |
| 34 */ | 35 */ |
| 35 WebInspector.RenderingOptionsView = function() | 36 WebInspector.RenderingOptionsView = function() |
| 36 { | 37 { |
| 37 WebInspector.VBox.call(this); | 38 WebInspector.VBox.call(this); |
| 38 this.registerRequiredCSS("helpScreen.css"); | 39 this.registerRequiredCSS("helpScreen.css"); |
| 39 this.element.classList.add("help-indent-labels"); | 40 this.element.classList.add("help-indent-labels"); |
| 40 | 41 |
| 41 var div = this.element.createChild("div", "settings-tab help-content help-co ntainer help-no-columns"); | 42 var div = this.element.createChild("div", "settings-tab help-content help-co ntainer help-no-columns"); |
| 42 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show paint rectangles"), WebInspector.settings.showPaintRects)); | 43 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show paint rectangles"), WebInspector.settings.showPaintRects)); |
| 43 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show composited layer borders"), WebInspector.settings.showDebugBorders )); | 44 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show composited layer borders"), WebInspector.settings.showDebugBorders )); |
| 44 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show FPS meter"), WebInspector.settings.showFPSCounter)); | 45 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show FPS meter"), WebInspector.settings.showFPSCounter)); |
| 45 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Enable continuous page repainting"), WebInspector.settings.continuousPa inting)); | 46 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Enable continuous page repainting"), WebInspector.settings.continuousPa inting)); |
| 46 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStr ing("Show potential scroll bottlenecks"), WebInspector.settings.showScrollBottle neckRects); | 47 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStr ing("Show potential scroll bottlenecks"), WebInspector.settings.settings.showScr ollBottleneckRects); |
|
dgozman
2014/07/14 12:16:11
Accidental change?
pfeldman
2014/07/14 12:41:20
Done.
| |
| 47 child.title = WebInspector.UIString("Shows areas of the page that slow down scrolling:\nTouch and mousewheel event listeners can delay scrolling.\nSome area s need to repaint their content when scrolled."); | 48 child.title = WebInspector.UIString("Shows areas of the page that slow down scrolling:\nTouch and mousewheel event listeners can delay scrolling.\nSome area s need to repaint their content when scrolled."); |
| 48 div.appendChild(child); | 49 div.appendChild(child); |
| 50 | |
| 51 /** | |
| 52 * @type {!Map.<!WebInspector.Setting, function(boolean)>} | |
| 53 */ | |
| 54 this._setters = new Map(); | |
| 55 this._mapSettingToSetter(WebInspector.settings.showPaintRects, Protocol.Page Agent.prototype.setShowPaintRects); | |
| 56 this._mapSettingToSetter(WebInspector.settings.showDebugBorders, Protocol.Pa geAgent.prototype.setShowDebugBorders); | |
| 57 this._mapSettingToSetter(WebInspector.settings.showFPSCounter, Protocol.Page Agent.prototype.setShowFPSCounter); | |
| 58 this._mapSettingToSetter(WebInspector.settings.continuousPainting, Protocol. PageAgent.prototype.setContinuousPaintingEnabled); | |
| 59 this._mapSettingToSetter(WebInspector.settings.showScrollBottleneckRects, Pr otocol.PageAgent.prototype.setShowScrollBottleneckRects); | |
| 60 | |
| 61 WebInspector.targetManager.observeTargets(this); | |
| 49 } | 62 } |
| 50 | 63 |
| 51 WebInspector.RenderingOptionsView.prototype = { | 64 WebInspector.RenderingOptionsView.prototype = { |
| 65 /** | |
| 66 * @param {!WebInspector.Target} target | |
| 67 */ | |
| 68 targetAdded: function(target) | |
| 69 { | |
| 70 var settings = this._setters.keys(); | |
| 71 for (var i = 0; i < settings.length; ++i) { | |
| 72 var setting = settings[i]; | |
| 73 if (setting.get()) { | |
| 74 var setter = this._setters.get(setting); | |
| 75 setter.call(target.pageAgent(), true); | |
|
dgozman
2014/07/14 12:16:11
This means that settings will not be applied unles
pfeldman
2014/07/14 12:41:20
Done.
| |
| 76 } | |
| 77 } | |
| 78 }, | |
| 79 | |
| 80 /** | |
| 81 * @param {!WebInspector.Target} target | |
| 82 */ | |
| 83 targetRemoved: function(target) | |
| 84 { | |
| 85 }, | |
| 86 | |
| 87 /** | |
| 88 * @param {!WebInspector.Setting} setting | |
| 89 * @param {function(boolean)} setter | |
| 90 */ | |
| 91 _mapSettingToSetter: function(setting, setter) | |
| 92 { | |
| 93 this._setters.put(setting, setter); | |
| 94 setting.addChangeListener(changeListener.bind(this)); | |
| 95 | |
| 96 /** | |
| 97 * @this {WebInspector.RenderingOptionsView} | |
| 98 */ | |
| 99 function changeListener() | |
| 100 { | |
| 101 var targets = WebInspector.targetManager.targets(); | |
| 102 var setter = this._setters.get(setting); | |
| 103 for (var i = 0; i < targets.length; ++i) | |
| 104 setter.call(targets[i].pageAgent(), setting.get()); | |
| 105 } | |
| 106 }, | |
| 107 | |
| 52 __proto__: WebInspector.VBox.prototype | 108 __proto__: WebInspector.VBox.prototype |
| 53 } | 109 } |
| OLD | NEW |