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

Side by Side Diff: Source/devtools/front_end/main/RenderingOptions.js

Issue 1040103002: [DevTools] Cleanup Page domain calls, which should be Emulation calls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: supportsRendering to RenderingOptions Created 5 years, 8 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
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 this._mapSettingToSetter(WebInspector.settings.showDebugBorders, "setShowDeb ugBorders"); 42 this._mapSettingToSetter(WebInspector.settings.showDebugBorders, "setShowDeb ugBorders");
43 this._mapSettingToSetter(WebInspector.settings.showFPSCounter, "setShowFPSCo unter"); 43 this._mapSettingToSetter(WebInspector.settings.showFPSCounter, "setShowFPSCo unter");
44 this._mapSettingToSetter(WebInspector.settings.continuousPainting, "setConti nuousPaintingEnabled"); 44 this._mapSettingToSetter(WebInspector.settings.continuousPainting, "setConti nuousPaintingEnabled");
45 this._mapSettingToSetter(WebInspector.settings.showScrollBottleneckRects, "s etShowScrollBottleneckRects"); 45 this._mapSettingToSetter(WebInspector.settings.showScrollBottleneckRects, "s etShowScrollBottleneckRects");
46 46
47 WebInspector.targetManager.observeTargets(this); 47 WebInspector.targetManager.observeTargets(this);
48 } 48 }
49 49
50 WebInspector.RenderingOptions.prototype = { 50 WebInspector.RenderingOptions.prototype = {
51 /** 51 /**
52 * @param {!WebInspector.Target} target
53 * @return {boolean}
54 */
55 supportsRendering: function(target)
56 {
57 return target.isPage();
58 },
59
60 /**
52 * @override 61 * @override
53 * @param {!WebInspector.Target} target 62 * @param {!WebInspector.Target} target
54 */ 63 */
55 targetAdded: function(target) 64 targetAdded: function(target)
56 { 65 {
66 if (this.supportsRendering(target))
67 return;
68
57 var settings = this._setterNames.keysArray(); 69 var settings = this._setterNames.keysArray();
58 for (var i = 0; i < settings.length; ++i) { 70 for (var i = 0; i < settings.length; ++i) {
59 var setting = settings[i]; 71 var setting = settings[i];
60 if (setting.get()) { 72 if (setting.get()) {
61 var setterName = this._setterNames.get(setting); 73 var setterName = this._setterNames.get(setting);
62 target.renderingAgent()[setterName](true); 74 target.renderingAgent()[setterName](true);
63 } 75 }
64 } 76 }
65 }, 77 },
66 78
67 /** 79 /**
68 * @override 80 * @override
69 * @param {!WebInspector.Target} target 81 * @param {!WebInspector.Target} target
70 */ 82 */
71 targetRemoved: function(target) 83 targetRemoved: function(target)
72 { 84 {
73 }, 85 },
74 86
75 /** 87 /**
76 * @param {!WebInspector.Setting} setting 88 * @param {!WebInspector.Setting} setting
77 * @param {string} setterName 89 * @param {string} setterName
78 */ 90 */
79 _mapSettingToSetter: function(setting, setterName) 91 _mapSettingToSetter: function(setting, setterName)
80 { 92 {
81 this._setterNames.set(setting, setterName); 93 this._setterNames.set(setting, setterName);
82 setting.addChangeListener(changeListener); 94 setting.addChangeListener(changeListener.bind(this));
83 95
96 /**
97 * @this {WebInspector.RenderingOptions}
98 */
84 function changeListener() 99 function changeListener()
85 { 100 {
86 var targets = WebInspector.targetManager.targets(); 101 var targets = WebInspector.targetManager.targets();
87 for (var i = 0; i < targets.length; ++i) 102 for (var i = 0; i < targets.length; ++i) {
88 targets[i].renderingAgent()[setterName](setting.get()); 103 if (this.supportsRendering(targets[i]))
104 targets[i].renderingAgent()[setterName](setting.get());
105 }
89 } 106 }
90 } 107 }
91 } 108 }
92 109
93 /** 110 /**
94 * @constructor 111 * @constructor
95 * @extends {WebInspector.VBox} 112 * @extends {WebInspector.VBox}
96 */ 113 */
97 WebInspector.RenderingOptions.View = function() 114 WebInspector.RenderingOptions.View = function()
98 { 115 {
99 WebInspector.VBox.call(this); 116 WebInspector.VBox.call(this);
100 this.registerRequiredCSS("ui/helpScreen.css"); 117 this.registerRequiredCSS("ui/helpScreen.css");
101 this.element.classList.add("help-indent-labels"); 118 this.element.classList.add("help-indent-labels");
102 119
103 var div = this.element.createChild("div", "settings-tab help-content help-co ntainer help-no-columns"); 120 var div = this.element.createChild("div", "settings-tab help-content help-co ntainer help-no-columns");
104 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show paint rectangles"), WebInspector.settings.showPaintRects)); 121 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show paint rectangles"), WebInspector.settings.showPaintRects));
105 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show composited layer borders"), WebInspector.settings.showDebugBorders )); 122 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show composited layer borders"), WebInspector.settings.showDebugBorders ));
106 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show FPS meter"), WebInspector.settings.showFPSCounter)); 123 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Show FPS meter"), WebInspector.settings.showFPSCounter));
107 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Enable continuous page repainting"), WebInspector.settings.continuousPa inting)); 124 div.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.U IString("Enable continuous page repainting"), WebInspector.settings.continuousPa inting));
108 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStr ing("Show potential scroll bottlenecks"), WebInspector.settings.showScrollBottle neckRects); 125 var child = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStr ing("Show potential scroll bottlenecks"), WebInspector.settings.showScrollBottle neckRects);
109 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."); 126 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.");
110 div.appendChild(child); 127 div.appendChild(child);
111 } 128 }
112 129
113 WebInspector.RenderingOptions.View.prototype = { 130 WebInspector.RenderingOptions.View.prototype = {
114 __proto__: WebInspector.VBox.prototype 131 __proto__: WebInspector.VBox.prototype
115 } 132 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/geolocation-emulation-tests-expected.txt ('k') | Source/devtools/front_end/sdk/OverridesSupport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698