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

Side by Side Diff: Source/devtools/front_end/MetricsSidebarPane.js

Issue 218703002: DevTools: [wip] move Elements panel off WebInspector.domModel and single tree outline. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comment addressed (and much more) Created 6 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) 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 var left = this._getPropertyValueAsPx(computedStyle, componentName + "-l eft" + suffix); 133 var left = this._getPropertyValueAsPx(computedStyle, componentName + "-l eft" + suffix);
134 var top = this._getPropertyValueAsPx(computedStyle, componentName + "-to p" + suffix); 134 var top = this._getPropertyValueAsPx(computedStyle, componentName + "-to p" + suffix);
135 var right = this._getPropertyValueAsPx(computedStyle, componentName + "- right" + suffix); 135 var right = this._getPropertyValueAsPx(computedStyle, componentName + "- right" + suffix);
136 var bottom = this._getPropertyValueAsPx(computedStyle, componentName + " -bottom" + suffix); 136 var bottom = this._getPropertyValueAsPx(computedStyle, componentName + " -bottom" + suffix);
137 return { left: left, top: top, right: right, bottom: bottom }; 137 return { left: left, top: top, right: right, bottom: bottom };
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 if (showHighlight && this.node) {
144 if (nodeId) {
145 if (this._highlightMode === mode) 144 if (this._highlightMode === mode)
146 return; 145 return;
147 this._highlightMode = mode; 146 this._highlightMode = mode;
148 WebInspector.domModel.highlightDOMNode(nodeId, mode); 147 this.node.highlight(mode);
149 } else { 148 } else {
150 delete this._highlightMode; 149 delete this._highlightMode;
151 WebInspector.domModel.hideDOMNodeHighlight(); 150 WebInspector.domModel.hideDOMNodeHighlight();
152 } 151 }
153 152
154 for (var i = 0; this._boxElements && i < this._boxElements.length; ++i) { 153 for (var i = 0; this._boxElements && i < this._boxElements.length; ++i) {
155 var element = this._boxElements[i]; 154 var element = this._boxElements[i];
156 if (!nodeId || mode === "all" || element._name === mode) 155 if (!this.node || mode === "all" || element._name === mode)
157 element.style.backgroundColor = element._backgroundColor; 156 element.style.backgroundColor = element._backgroundColor;
158 else 157 else
159 element.style.backgroundColor = ""; 158 element.style.backgroundColor = "";
160 } 159 }
161 }, 160 },
162 161
163 /** 162 /**
164 * @param {!WebInspector.CSSStyleDeclaration} style 163 * @param {!WebInspector.CSSStyleDeclaration} style
165 */ 164 */
166 _updateMetrics: function(style) 165 _updateMetrics: function(style)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 425
427 this.previousPropertyDataCandidate = null; 426 this.previousPropertyDataCandidate = null;
428 var self = this; 427 var self = this;
429 var callback = function(style) { 428 var callback = function(style) {
430 if (!style) 429 if (!style)
431 return; 430 return;
432 self.inlineStyle = style; 431 self.inlineStyle = style;
433 if (!("originalPropertyData" in self)) 432 if (!("originalPropertyData" in self))
434 self.originalPropertyData = self.previousPropertyDataCandidate; 433 self.originalPropertyData = self.previousPropertyDataCandidate;
435 434
436 if (typeof self._highlightMode !== "undefined") { 435 if (typeof self._highlightMode !== "undefined")
437 WebInspector.domModel.highlightDOMNode(self.node.id, self._highl ightMode); 436 self.node.highlight(self._highlightMode);
438 }
439 437
440 if (commitEditor) { 438 if (commitEditor) {
441 self.dispatchEventToListeners("metrics edited"); 439 self.dispatchEventToListeners("metrics edited");
442 self.update(); 440 self.update();
443 } 441 }
444 }; 442 };
445 443
446 var allProperties = this.inlineStyle.allProperties; 444 var allProperties = this.inlineStyle.allProperties;
447 for (var i = 0; i < allProperties.length; ++i) { 445 for (var i = 0; i < allProperties.length; ++i) {
448 var property = allProperties[i]; 446 var property = allProperties[i];
449 if (property.name !== context.styleProperty || property.inactive) 447 if (property.name !== context.styleProperty || property.inactive)
450 continue; 448 continue;
451 449
452 this.previousPropertyDataCandidate = property; 450 this.previousPropertyDataCandidate = property;
453 property.setValue(userInput, commitEditor, true, callback); 451 property.setValue(userInput, commitEditor, true, callback);
454 return; 452 return;
455 } 453 }
456 454
457 this.inlineStyle.appendProperty(context.styleProperty, userInput, callba ck); 455 this.inlineStyle.appendProperty(context.styleProperty, userInput, callba ck);
458 }, 456 },
459 457
460 editingCommitted: function(element, userInput, previousContent, context) 458 editingCommitted: function(element, userInput, previousContent, context)
461 { 459 {
462 this.editingEnded(element, context); 460 this.editingEnded(element, context);
463 this._applyUserInput(element, userInput, previousContent, context, true) ; 461 this._applyUserInput(element, userInput, previousContent, context, true) ;
464 }, 462 },
465 463
466 __proto__: WebInspector.SidebarPane.prototype 464 __proto__: WebInspector.SidebarPane.prototype
467 } 465 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/EventListenersSidebarPane.js ('k') | Source/devtools/front_end/PropertiesSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698