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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 * @override | 51 * @override |
52 * @param {!WebInspector.Target} target | 52 * @param {!WebInspector.Target} target |
53 */ | 53 */ |
54 targetAdded: function(target) | 54 targetAdded: function(target) |
55 { | 55 { |
56 // When DevTools are opening in the inspect element mode, the first targ
et comes in | 56 // When DevTools are opening in the inspect element mode, the first targ
et comes in |
57 // much later than the InspectorFrontendAPI.enterInspectElementMode even
t. | 57 // much later than the InspectorFrontendAPI.enterInspectElementMode even
t. |
58 if (!this.enabled()) | 58 if (!this.enabled()) |
59 return; | 59 return; |
60 var domModel = WebInspector.DOMModel.fromTarget(target); | 60 var domModel = WebInspector.DOMModel.fromTarget(target); |
61 domModel.setInspectModeEnabled(true, WebInspector.moduleSetting("showUAS
hadowDOM").get()); | 61 domModel.setInspectMode(WebInspector.moduleSetting("showUAShadowDOM").ge
t() ? DOMAgent.InspectMode.SearchForUAShadowDOM : DOMAgent.InspectMode.SearchFor
Node); |
62 }, | 62 }, |
63 | 63 |
64 /** | 64 /** |
65 * @override | 65 * @override |
66 * @param {!WebInspector.Target} target | 66 * @param {!WebInspector.Target} target |
67 */ | 67 */ |
68 targetRemoved: function(target) | 68 targetRemoved: function(target) |
69 { | 69 { |
70 }, | 70 }, |
71 | 71 |
72 /** | 72 /** |
73 * @return {boolean} | 73 * @return {boolean} |
74 */ | 74 */ |
75 enabled: function() | 75 enabled: function() |
76 { | 76 { |
77 return this._toggleSearchButton.toggled(); | 77 return this._toggleSearchButton.toggled(); |
78 }, | 78 }, |
79 | 79 |
80 disable: function() | 80 disable: function() |
81 { | 81 { |
82 if (this.enabled()) | 82 if (this.enabled()) |
83 this._toggleSearch(); | 83 this._toggleSearch(); |
84 }, | 84 }, |
85 | 85 |
86 _toggleSearch: function() | 86 _toggleSearch: function() |
87 { | 87 { |
88 var enabled = !this.enabled(); | 88 var enabled = !this.enabled(); |
89 this._toggleSearchButton.setToggled(enabled); | 89 this._toggleSearchButton.setToggled(enabled); |
90 | 90 |
91 for (var domModel of WebInspector.DOMModel.instances()) | 91 for (var domModel of WebInspector.DOMModel.instances()) { |
92 domModel.setInspectModeEnabled(enabled, WebInspector.moduleSetting("
showUAShadowDOM").get()); | 92 var mode; |
| 93 if (!enabled) |
| 94 mode = DOMAgent.InspectMode.None; |
| 95 else if (WebInspector.moduleSetting("showUAShadowDOM").get()) |
| 96 mode = DOMAgent.InspectMode.SearchForUAShadowDOM; |
| 97 else |
| 98 mode = DOMAgent.InspectMode.SearchForNode; |
| 99 |
| 100 domModel.setInspectMode(mode); |
| 101 } |
93 }, | 102 }, |
94 | 103 |
95 _suspendStateChanged: function() | 104 _suspendStateChanged: function() |
96 { | 105 { |
97 if (WebInspector.targetManager.allTargetsSuspended()) | 106 if (WebInspector.targetManager.allTargetsSuspended()) |
98 this._toggleSearchButton.setToggled(false); | 107 this._toggleSearchButton.setToggled(false); |
99 } | 108 } |
100 } | 109 } |
101 | 110 |
102 /** | 111 /** |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 { | 147 { |
139 if (!WebInspector.inspectElementModeController) | 148 if (!WebInspector.inspectElementModeController) |
140 return null; | 149 return null; |
141 | 150 |
142 return WebInspector.inspectElementModeController._toggleSearchButton; | 151 return WebInspector.inspectElementModeController._toggleSearchButton; |
143 } | 152 } |
144 } | 153 } |
145 | 154 |
146 /** @type {?WebInspector.InspectElementModeController} */ | 155 /** @type {?WebInspector.InspectElementModeController} */ |
147 WebInspector.inspectElementModeController = null; | 156 WebInspector.inspectElementModeController = null; |
OLD | NEW |