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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/CSSProperty.js

Issue 1809533003: DevTools: remove illusionary caching from String.prototype.lineEndings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: String.prototype.lineEndings -> String.prototype.computeLineEndings Created 4 years, 9 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 // 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 if (overwrite && propertyText === this.propertyText) { 109 if (overwrite && propertyText === this.propertyText) {
110 if (majorChange) 110 if (majorChange)
111 this.ownerStyle.cssModel().domModel().markUndoableState(); 111 this.ownerStyle.cssModel().domModel().markUndoableState();
112 return Promise.resolve(true); 112 return Promise.resolve(true);
113 } 113 }
114 114
115 var range = this.range.relativeTo(this.ownerStyle.range.startLine, this. ownerStyle.range.startColumn); 115 var range = this.range.relativeTo(this.ownerStyle.range.startLine, this. ownerStyle.range.startColumn);
116 var indentation = this.ownerStyle.cssText ? this._detectIndentation(this .ownerStyle.cssText) : WebInspector.moduleSetting("textEditorIndent").get(); 116 var indentation = this.ownerStyle.cssText ? this._detectIndentation(this .ownerStyle.cssText) : WebInspector.moduleSetting("textEditorIndent").get();
117 var endIndentation = this.ownerStyle.cssText ? indentation.substring(0, this.ownerStyle.range.endColumn) : ""; 117 var endIndentation = this.ownerStyle.cssText ? indentation.substring(0, this.ownerStyle.range.endColumn) : "";
118 var newStyleText = range.replaceInText(this.ownerStyle.cssText || "", St ring.sprintf(";%s;", propertyText)); 118 var text = new WebInspector.Text(this.ownerStyle.cssText || "");
119 var newStyleText = text.replaceRange(range, String.sprintf(";%s;", prope rtyText));
119 120
120 return self.runtime.instancePromise(WebInspector.TokenizerFactory) 121 return self.runtime.instancePromise(WebInspector.TokenizerFactory)
121 .then(this._formatStyle.bind(this, newStyleText, indentation, endInd entation)) 122 .then(this._formatStyle.bind(this, newStyleText, indentation, endInd entation))
122 .then(setStyleText.bind(this)); 123 .then(setStyleText.bind(this));
123 124
124 /** 125 /**
125 * @param {string} styleText 126 * @param {string} styleText
126 * @this {WebInspector.CSSProperty} 127 * @this {WebInspector.CSSProperty}
127 * @return {!Promise.<boolean>} 128 * @return {!Promise.<boolean>}
128 */ 129 */
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 233 {
233 if (!this.ownerStyle) 234 if (!this.ownerStyle)
234 return Promise.resolve(false); 235 return Promise.resolve(false);
235 if (disabled === this.disabled) 236 if (disabled === this.disabled)
236 return Promise.resolve(true); 237 return Promise.resolve(true);
237 var propertyText = this.text.trim(); 238 var propertyText = this.text.trim();
238 var text = disabled ? "/* " + propertyText + " */" : this.text.substring (2, propertyText.length - 2).trim(); 239 var text = disabled ? "/* " + propertyText + " */" : this.text.substring (2, propertyText.length - 2).trim();
239 return this.setText(text, true, true); 240 return this.setText(text, true, true);
240 } 241 }
241 } 242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698