| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @constructor | 6 * @constructor |
| 7 * @param {!WebInspector.CSSStyleDeclaration} ownerStyle | 7 * @param {!WebInspector.CSSStyleDeclaration} ownerStyle |
| 8 * @param {number} index | 8 * @param {number} index |
| 9 * @param {string} name | 9 * @param {string} name |
| 10 * @param {string} value | 10 * @param {string} value |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 this.value = value; | 23 this.value = value; |
| 24 this.important = important; | 24 this.important = important; |
| 25 this.disabled = disabled; | 25 this.disabled = disabled; |
| 26 this.parsedOk = parsedOk; | 26 this.parsedOk = parsedOk; |
| 27 this.implicit = implicit; // A longhand, implicitly set by missing values of
shorthand. | 27 this.implicit = implicit; // A longhand, implicitly set by missing values of
shorthand. |
| 28 this.text = text; | 28 this.text = text; |
| 29 this.range = range ? WebInspector.TextRange.fromObject(range) : null; | 29 this.range = range ? WebInspector.TextRange.fromObject(range) : null; |
| 30 this._active = true; | 30 this._active = true; |
| 31 this._nameRange = null; | 31 this._nameRange = null; |
| 32 this._valueRange = null; | 32 this._valueRange = null; |
| 33 } | 33 }; |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * @param {!WebInspector.CSSStyleDeclaration} ownerStyle | 36 * @param {!WebInspector.CSSStyleDeclaration} ownerStyle |
| 37 * @param {number} index | 37 * @param {number} index |
| 38 * @param {!CSSAgent.CSSProperty} payload | 38 * @param {!CSSAgent.CSSProperty} payload |
| 39 * @return {!WebInspector.CSSProperty} | 39 * @return {!WebInspector.CSSProperty} |
| 40 */ | 40 */ |
| 41 WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload) | 41 WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload) |
| 42 { | 42 { |
| 43 // The following default field values are used in the payload: | 43 // The following default field values are used in the payload: |
| 44 // important: false | 44 // important: false |
| 45 // parsedOk: true | 45 // parsedOk: true |
| 46 // implicit: false | 46 // implicit: false |
| 47 // disabled: false | 47 // disabled: false |
| 48 var result = new WebInspector.CSSProperty( | 48 var result = new WebInspector.CSSProperty( |
| 49 ownerStyle, index, payload.name, payload.value, payload.important || fal
se, payload.disabled || false, ("parsedOk" in payload) ? !!payload.parsedOk : tr
ue, !!payload.implicit, payload.text, payload.range); | 49 ownerStyle, index, payload.name, payload.value, payload.important || fal
se, payload.disabled || false, ("parsedOk" in payload) ? !!payload.parsedOk : tr
ue, !!payload.implicit, payload.text, payload.range); |
| 50 return result; | 50 return result; |
| 51 } | 51 }; |
| 52 | 52 |
| 53 WebInspector.CSSProperty.prototype = { | 53 WebInspector.CSSProperty.prototype = { |
| 54 _ensureRanges: function() | 54 _ensureRanges: function() |
| 55 { | 55 { |
| 56 if (this._nameRange && this._valueRange) | 56 if (this._nameRange && this._valueRange) |
| 57 return; | 57 return; |
| 58 var range = this.range; | 58 var range = this.range; |
| 59 var text = this.text ? new WebInspector.Text(this.text) : null; | 59 var text = this.text ? new WebInspector.Text(this.text) : null; |
| 60 if (!range || !text) | 60 if (!range || !text) |
| 61 return; | 61 return; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 setDisabled: function(disabled) | 290 setDisabled: function(disabled) |
| 291 { | 291 { |
| 292 if (!this.ownerStyle) | 292 if (!this.ownerStyle) |
| 293 return Promise.resolve(false); | 293 return Promise.resolve(false); |
| 294 if (disabled === this.disabled) | 294 if (disabled === this.disabled) |
| 295 return Promise.resolve(true); | 295 return Promise.resolve(true); |
| 296 var propertyText = this.text.trim(); | 296 var propertyText = this.text.trim(); |
| 297 var text = disabled ? "/* " + propertyText + " */" : this.text.substring
(2, propertyText.length - 2).trim(); | 297 var text = disabled ? "/* " + propertyText + " */" : this.text.substring
(2, propertyText.length - 2).trim(); |
| 298 return this.setText(text, true, true); | 298 return this.setText(text, true, true); |
| 299 } | 299 } |
| 300 } | 300 }; |
| OLD | NEW |