| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Javascript that is being injected into the inspectable page | 6 * @fileoverview Javascript that is being injected into the inspectable page |
| 7 * while debugging. | 7 * while debugging. |
| 8 */ | 8 */ |
| 9 goog.require('goog.json'); | 9 goog.require('goog.json'); |
| 10 goog.provide('devtools.Injected'); | 10 goog.provide('devtools.Injected'); |
| 11 | 11 |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Main injected object. | 14 * Main injected object. |
| 15 * @constructor. | 15 * @constructor. |
| 16 */ | 16 */ |
| 17 devtools.Injected = function() { | 17 devtools.Injected = function() { |
| 18 /** | 18 /** |
| 19 * Unique style id generator. | 19 * Unique style id generator. |
| 20 * @type {number} | 20 * @type {number} |
| 21 * @private | 21 * @private |
| 22 */ | 22 */ |
| 23 this.lastStyleId_ = 1; | 23 this.lastStyleId_ = 1; |
| 24 |
| 25 /** |
| 26 * This array is not unused as it may seem. It stores references to the |
| 27 * styles so that they could be found for future editing. |
| 28 * @type {Array<CSSStyleDeclaration>} |
| 29 * @private |
| 30 */ |
| 31 this.styles_ = []; |
| 24 }; | 32 }; |
| 25 | 33 |
| 26 | 34 |
| 27 /** | 35 /** |
| 28 * Returns array of properties for a given node on a given path. | 36 * Returns array of properties for a given node on a given path. |
| 29 * @param {Node} node Node to get property value for. | 37 * @param {Node} node Node to get property value for. |
| 30 * @param {Array.<string>} path Path to the nested object. | 38 * @param {Array.<string>} path Path to the nested object. |
| 31 * @param {number} protoDepth Depth of the actual proto to inspect. | 39 * @param {number} protoDepth Depth of the actual proto to inspect. |
| 32 * @return {Array.<Object>} Array where each property is represented | 40 * @return {Array.<Object>} Array where each property is represented |
| 33 * by the tree entries [{string} type, {string} name, {Object} value]. | 41 * by the tree entries [{string} type, {string} name, {Object} value]. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 * @param {CSSStyleDeclaration} style Style to serialize. | 191 * @param {CSSStyleDeclaration} style Style to serialize. |
| 184 * @return {Array<Object>} Serializable object. | 192 * @return {Array<Object>} Serializable object. |
| 185 * @private | 193 * @private |
| 186 */ | 194 */ |
| 187 devtools.Injected.prototype.serializeStyle_ = function(style) { | 195 devtools.Injected.prototype.serializeStyle_ = function(style) { |
| 188 if (!style) { | 196 if (!style) { |
| 189 return []; | 197 return []; |
| 190 } | 198 } |
| 191 if (!style.__id) { | 199 if (!style.__id) { |
| 192 style.__id = this.lastStyleId_++; | 200 style.__id = this.lastStyleId_++; |
| 201 this.styles_.push(style); |
| 193 } | 202 } |
| 194 var result = [ | 203 var result = [ |
| 195 style.__id, | 204 style.__id, |
| 196 style.__disabledProperties, | 205 style.__disabledProperties, |
| 197 style.__disabledPropertyValues, | 206 style.__disabledPropertyValues, |
| 198 style.__disabledPropertyPriorities | 207 style.__disabledPropertyPriorities |
| 199 ]; | 208 ]; |
| 200 for (var i = 0; i < style.length; ++i) { | 209 for (var i = 0; i < style.length; ++i) { |
| 201 var name = style[i]; | 210 var name = style[i]; |
| 202 result.push([ | 211 result.push([ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 var individualProperty = style[i]; | 285 var individualProperty = style[i]; |
| 277 if (individualProperty in foundProperties || | 286 if (individualProperty in foundProperties || |
| 278 style.getPropertyShorthand(individualProperty) != shorthandProperty) { | 287 style.getPropertyShorthand(individualProperty) != shorthandProperty) { |
| 279 continue; | 288 continue; |
| 280 } | 289 } |
| 281 foundProperties[individualProperty] = true; | 290 foundProperties[individualProperty] = true; |
| 282 properties.push(individualProperty); | 291 properties.push(individualProperty); |
| 283 } | 292 } |
| 284 return properties; | 293 return properties; |
| 285 }; | 294 }; |
| OLD | NEW |