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

Side by Side Diff: inspector/front-end/MetricsSidebarPane.js

Issue 542055: DevTools: injected script per context(WebCore part) (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 10 years, 11 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
OLDNEW
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 12 matching lines...) Expand all
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 WebInspector.MetricsSidebarPane = function() 29 WebInspector.MetricsSidebarPane = function()
30 { 30 {
31 WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics")); 31 WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics"));
32 this._inlineStyleId = null; 32 this._inlineStyleId = null;
33 this._inlineStyleInjectedScriptId = null;
33 } 34 }
34 35
35 WebInspector.MetricsSidebarPane.prototype = { 36 WebInspector.MetricsSidebarPane.prototype = {
36 update: function(node) 37 update: function(node)
37 { 38 {
38 if (node) 39 if (node)
39 this.node = node; 40 this.node = node;
40 else 41 else
41 node = this.node; 42 node = this.node;
42 43
43 if (!node || !node.ownerDocument.defaultView || node.nodeType !== Node.E LEMENT_NODE) { 44 if (!node || !node.ownerDocument.defaultView || node.nodeType !== Node.E LEMENT_NODE) {
44 this.bodyElement.removeChildren(); 45 this.bodyElement.removeChildren();
45 return; 46 return;
46 } 47 }
47 48
48 var self = this; 49 var self = this;
49 var callback = function(stylePayload) { 50 var callback = function(stylePayload) {
50 if (!stylePayload) 51 if (!stylePayload)
51 return; 52 return;
52 var style = WebInspector.CSSStyleDeclaration.parseStyle(stylePayload ); 53 var style = WebInspector.CSSStyleDeclaration.parseStyle(stylePayload );
53 self._update(style); 54 self._update(style);
54 }; 55 };
55 InjectedScriptAccess.getComputedStyle(node.id, callback); 56 InjectedScriptAccess.get(node.injectedScriptId).getComputedStyle(node.id , callback);
56 57
57 var inlineStyleCallback = function(stylePayload) { 58 var inlineStyleCallback = function(stylePayload) {
58 if (!stylePayload) 59 if (!stylePayload)
59 return; 60 return;
60 self._inlineStyleId = stylePayload.id; 61 self._inlineStyleId = stylePayload.id;
62 self._inlineStyleInjectedScriptId = stylePayload.injectedScriptId;
61 }; 63 };
62 InjectedScriptAccess.getInlineStyle(node.id, inlineStyleCallback); 64 InjectedScriptAccess.get(node.injectedScriptId).getInlineStyle(node.id, inlineStyleCallback);
63 }, 65 },
64 66
65 _update: function(style) 67 _update: function(style)
66 { 68 {
67 var metricsElement = document.createElement("div"); 69 var metricsElement = document.createElement("div");
68 metricsElement.className = "metrics"; 70 metricsElement.className = "metrics";
69 71
70 function createBoxPartElement(style, name, side, suffix) 72 function createBoxPartElement(style, name, side, suffix)
71 { 73 {
72 var propertyName = (name !== "position" ? name + "-" : "") + side + suffix; 74 var propertyName = (name !== "position" ? name + "-" : "") + side + suffix;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (/^\d+$/.test(userInput)) 199 if (/^\d+$/.test(userInput))
198 userInput += "px"; 200 userInput += "px";
199 201
200 var self = this; 202 var self = this;
201 var callback = function(success) { 203 var callback = function(success) {
202 if (!success) 204 if (!success)
203 return; 205 return;
204 self.dispatchEventToListeners("metrics edited"); 206 self.dispatchEventToListeners("metrics edited");
205 self.update(); 207 self.update();
206 }; 208 };
207 InjectedScriptAccess.setStyleProperty(this._inlineStyleId, context.style Property, userInput, callback); 209 InjectedScriptAccess.get(this._inlineStyleInjectedScriptId).setStyleProp erty(this._inlineStyleId, context.styleProperty, userInput, callback);
208 } 210 }
209 } 211 }
210 212
211 WebInspector.MetricsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.p rototype; 213 WebInspector.MetricsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.p rototype;
OLDNEW
« no previous file with comments | « inspector/front-end/InjectedScriptAccess.js ('k') | inspector/front-end/ObjectPropertiesSection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698