| 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 13 matching lines...) Expand all Loading... |
| 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 /** | 29 /** |
| 30 * @unrestricted | 30 * @unrestricted |
| 31 */ | 31 */ |
| 32 Elements.MetricsSidebarPane = class extends Elements.ElementsSidebarPane { | 32 Elements.MetricsSidebarPane = class extends Elements.ElementsSidebarPane { |
| 33 constructor() { | 33 constructor() { |
| 34 super(); | 34 super(true); |
| 35 this.registerRequiredCSS('elements/metricsSidebarPane.css'); |
| 35 | 36 |
| 36 /** @type {?SDK.CSSStyleDeclaration} */ | 37 /** @type {?SDK.CSSStyleDeclaration} */ |
| 37 this._inlineStyle = null; | 38 this._inlineStyle = null; |
| 38 } | 39 } |
| 39 | 40 |
| 40 /** | 41 /** |
| 41 * @override | 42 * @override |
| 42 * @protected | 43 * @protected |
| 43 * @return {!Promise.<?>} | 44 * @return {!Promise.<?>} |
| 44 */ | 45 */ |
| 45 doUpdate() { | 46 doUpdate() { |
| 46 // "style" attribute might have changed. Update metrics unless they are bein
g edited | 47 // "style" attribute might have changed. Update metrics unless they are bein
g edited |
| 47 // (if a CSS property is added, a StyleSheetChanged event is dispatched). | 48 // (if a CSS property is added, a StyleSheetChanged event is dispatched). |
| 48 if (this._isEditingMetrics) | 49 if (this._isEditingMetrics) |
| 49 return Promise.resolve(); | 50 return Promise.resolve(); |
| 50 | 51 |
| 51 // FIXME: avoid updates of a collapsed pane. | 52 // FIXME: avoid updates of a collapsed pane. |
| 52 var node = this.node(); | 53 var node = this.node(); |
| 53 var cssModel = this.cssModel(); | 54 var cssModel = this.cssModel(); |
| 54 if (!node || node.nodeType() !== Node.ELEMENT_NODE || !cssModel) { | 55 if (!node || node.nodeType() !== Node.ELEMENT_NODE || !cssModel) { |
| 55 this.element.removeChildren(); | 56 this.contentElement.removeChildren(); |
| 56 return Promise.resolve(); | 57 return Promise.resolve(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 /** | 60 /** |
| 60 * @param {?Map.<string, string>} style | 61 * @param {?Map.<string, string>} style |
| 61 * @this {Elements.MetricsSidebarPane} | 62 * @this {Elements.MetricsSidebarPane} |
| 62 */ | 63 */ |
| 63 function callback(style) { | 64 function callback(style) { |
| 64 if (!style || this.node() !== node) | 65 if (!style || this.node() !== node) |
| 65 return; | 66 return; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 boxElement.appendChild(createBoxPartElement.call(this, style, name, 'rig
ht', suffix)); | 288 boxElement.appendChild(createBoxPartElement.call(this, style, name, 'rig
ht', suffix)); |
| 288 boxElement.appendChild(createElement('br')); | 289 boxElement.appendChild(createElement('br')); |
| 289 boxElement.appendChild(createBoxPartElement.call(this, style, name, 'bot
tom', suffix)); | 290 boxElement.appendChild(createBoxPartElement.call(this, style, name, 'bot
tom', suffix)); |
| 290 } | 291 } |
| 291 | 292 |
| 292 previousBox = boxElement; | 293 previousBox = boxElement; |
| 293 } | 294 } |
| 294 | 295 |
| 295 metricsElement.appendChild(previousBox); | 296 metricsElement.appendChild(previousBox); |
| 296 metricsElement.addEventListener('mouseover', this._highlightDOMNode.bind(thi
s, false, 'all'), false); | 297 metricsElement.addEventListener('mouseover', this._highlightDOMNode.bind(thi
s, false, 'all'), false); |
| 297 this.element.removeChildren(); | 298 this.contentElement.removeChildren(); |
| 298 this.element.appendChild(metricsElement); | 299 this.contentElement.appendChild(metricsElement); |
| 299 } | 300 } |
| 300 | 301 |
| 301 /** | 302 /** |
| 302 * @param {!Element} targetElement | 303 * @param {!Element} targetElement |
| 303 * @param {string} box | 304 * @param {string} box |
| 304 * @param {string} styleProperty | 305 * @param {string} styleProperty |
| 305 * @param {!Map.<string, string>} computedStyle | 306 * @param {!Map.<string, string>} computedStyle |
| 306 */ | 307 */ |
| 307 startEditing(targetElement, box, styleProperty, computedStyle) { | 308 startEditing(targetElement, box, styleProperty, computedStyle) { |
| 308 if (UI.isBeingEdited(targetElement)) | 309 if (UI.isBeingEdited(targetElement)) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (commitEditor) | 446 if (commitEditor) |
| 446 this.update(); | 447 this.update(); |
| 447 } | 448 } |
| 448 } | 449 } |
| 449 | 450 |
| 450 _editingCommitted(element, userInput, previousContent, context) { | 451 _editingCommitted(element, userInput, previousContent, context) { |
| 451 this.editingEnded(element, context); | 452 this.editingEnded(element, context); |
| 452 this._applyUserInput(element, userInput, previousContent, context, true); | 453 this._applyUserInput(element, userInput, previousContent, context, true); |
| 453 } | 454 } |
| 454 }; | 455 }; |
| OLD | NEW |