OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 /** | 29 /** |
30 * @constructor | 30 * @constructor |
31 * @extends {WebInspector.SidebarPane} | 31 * @extends {WebInspector.SidebarPane} |
32 */ | 32 */ |
33 WebInspector.MetricsSidebarPane = function() | 33 WebInspector.MetricsSidebarPane = function() |
34 { | 34 { |
35 WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics")); | 35 WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics")); |
36 | 36 |
37 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetChanged, this._styleSheetOrMediaQueryResultChanged, this); | 37 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetChanged, this._styleSheetOrMediaQueryResultChanged, this); |
38 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Med
iaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this); | 38 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Med
iaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this); |
39 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModi
fied, this._attributesUpdated, this); | 39 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrModi
fied, this._attributesUpdated, this); |
40 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemo
ved, this._attributesUpdated, this); | 40 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemo
ved, this._attributesUpdated, this); |
41 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.FrameResized, this._frameResized, this); | 41 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.FrameResized, this._frameResized, this); |
42 } | 42 } |
43 | 43 |
44 WebInspector.MetricsSidebarPane.prototype = { | 44 WebInspector.MetricsSidebarPane.prototype = { |
45 /** | 45 /** |
46 * @param {?WebInspector.DOMNode=} node | 46 * @param {?WebInspector.DOMNode=} node |
47 */ | 47 */ |
48 update: function(node) | 48 update: function(node) |
49 { | 49 { |
50 if (node) | 50 if (node) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 }, | 138 }, |
139 | 139 |
140 _highlightDOMNode: function(showHighlight, mode, event) | 140 _highlightDOMNode: function(showHighlight, mode, event) |
141 { | 141 { |
142 event.consume(); | 142 event.consume(); |
143 var nodeId = showHighlight && this.node ? this.node.id : 0; | 143 var nodeId = showHighlight && this.node ? this.node.id : 0; |
144 if (nodeId) { | 144 if (nodeId) { |
145 if (this._highlightMode === mode) | 145 if (this._highlightMode === mode) |
146 return; | 146 return; |
147 this._highlightMode = mode; | 147 this._highlightMode = mode; |
148 WebInspector.domAgent.highlightDOMNode(nodeId, mode); | 148 WebInspector.domModel.highlightDOMNode(nodeId, mode); |
149 } else { | 149 } else { |
150 delete this._highlightMode; | 150 delete this._highlightMode; |
151 WebInspector.domAgent.hideDOMNodeHighlight(); | 151 WebInspector.domModel.hideDOMNodeHighlight(); |
152 } | 152 } |
153 | 153 |
154 for (var i = 0; this._boxElements && i < this._boxElements.length; ++i)
{ | 154 for (var i = 0; this._boxElements && i < this._boxElements.length; ++i)
{ |
155 var element = this._boxElements[i]; | 155 var element = this._boxElements[i]; |
156 if (!nodeId || mode === "all" || element._name === mode) | 156 if (!nodeId || mode === "all" || element._name === mode) |
157 element.style.backgroundColor = element._backgroundColor; | 157 element.style.backgroundColor = element._backgroundColor; |
158 else | 158 else |
159 element.style.backgroundColor = ""; | 159 element.style.backgroundColor = ""; |
160 } | 160 } |
161 }, | 161 }, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 this.previousPropertyDataCandidate = null; | 427 this.previousPropertyDataCandidate = null; |
428 var self = this; | 428 var self = this; |
429 var callback = function(style) { | 429 var callback = function(style) { |
430 if (!style) | 430 if (!style) |
431 return; | 431 return; |
432 self.inlineStyle = style; | 432 self.inlineStyle = style; |
433 if (!("originalPropertyData" in self)) | 433 if (!("originalPropertyData" in self)) |
434 self.originalPropertyData = self.previousPropertyDataCandidate; | 434 self.originalPropertyData = self.previousPropertyDataCandidate; |
435 | 435 |
436 if (typeof self._highlightMode !== "undefined") { | 436 if (typeof self._highlightMode !== "undefined") { |
437 WebInspector.domAgent.highlightDOMNode(self.node.id, self._highl
ightMode); | 437 WebInspector.domModel.highlightDOMNode(self.node.id, self._highl
ightMode); |
438 } | 438 } |
439 | 439 |
440 if (commitEditor) { | 440 if (commitEditor) { |
441 self.dispatchEventToListeners("metrics edited"); | 441 self.dispatchEventToListeners("metrics edited"); |
442 self.update(); | 442 self.update(); |
443 } | 443 } |
444 }; | 444 }; |
445 | 445 |
446 var allProperties = this.inlineStyle.allProperties; | 446 var allProperties = this.inlineStyle.allProperties; |
447 for (var i = 0; i < allProperties.length; ++i) { | 447 for (var i = 0; i < allProperties.length; ++i) { |
(...skipping 10 matching lines...) Expand all Loading... |
458 }, | 458 }, |
459 | 459 |
460 editingCommitted: function(element, userInput, previousContent, context) | 460 editingCommitted: function(element, userInput, previousContent, context) |
461 { | 461 { |
462 this.editingEnded(element, context); | 462 this.editingEnded(element, context); |
463 this._applyUserInput(element, userInput, previousContent, context, true)
; | 463 this._applyUserInput(element, userInput, previousContent, context, true)
; |
464 }, | 464 }, |
465 | 465 |
466 __proto__: WebInspector.SidebarPane.prototype | 466 __proto__: WebInspector.SidebarPane.prototype |
467 } | 467 } |
OLD | NEW |