Backed out changeset 6bc38f188ef2 (bug 1330099) for devtools failures. r=backout
This commit is contained in:
@@ -524,7 +524,7 @@ RuleRewriter.prototype = {
|
||||
*
|
||||
* @param {String} inputString the input to use
|
||||
*/
|
||||
startInitialization(inputString) {
|
||||
startInitialization: function (inputString) {
|
||||
this.inputString = inputString;
|
||||
// Whether there are any newlines in the input text.
|
||||
this.hasNewLine = /[\r\n]/.test(this.inputString);
|
||||
@@ -541,7 +541,7 @@ RuleRewriter.prototype = {
|
||||
*
|
||||
* @param {Number} index The index of the property to modify
|
||||
*/
|
||||
completeInitialization(index) {
|
||||
completeInitialization: function (index) {
|
||||
if (index < 0) {
|
||||
throw new Error("Invalid index " + index + ". Expected positive integer");
|
||||
}
|
||||
@@ -567,7 +567,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} offset the offset at which to compute the indentation
|
||||
* @return {String} the indentation at the indicated position
|
||||
*/
|
||||
getIndentation(string, offset) {
|
||||
getIndentation: function (string, offset) {
|
||||
let originalOffset = offset;
|
||||
for (--offset; offset >= 0; --offset) {
|
||||
let c = string[offset];
|
||||
@@ -600,7 +600,7 @@ RuleRewriter.prototype = {
|
||||
* where |text| is the text that has been rewritten
|
||||
* to be "lexically safe".
|
||||
*/
|
||||
sanitizePropertyValue(text) {
|
||||
sanitizePropertyValue: function (text) {
|
||||
let lexer = getCSSLexer(text);
|
||||
|
||||
let result = "";
|
||||
@@ -663,7 +663,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} index the index at which to start
|
||||
* @return {Number} index of the first non-whitespace character, or -1
|
||||
*/
|
||||
skipWhitespaceBackward(string, index) {
|
||||
skipWhitespaceBackward: function (string, index) {
|
||||
for (--index;
|
||||
index >= 0 && (string[index] === " " || string[index] === "\t");
|
||||
--index) {
|
||||
@@ -679,7 +679,7 @@ RuleRewriter.prototype = {
|
||||
* terminate. It might be invalid, so this
|
||||
* function must check for that.
|
||||
*/
|
||||
maybeTerminateDecl(index) {
|
||||
maybeTerminateDecl: function (index) {
|
||||
if (index < 0 || index >= this.declarations.length
|
||||
// No need to rewrite declarations in comments.
|
||||
|| ("commentOffsets" in this.declarations[index])) {
|
||||
@@ -727,7 +727,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} index The index of the property.
|
||||
* @return {String} The sanitized text.
|
||||
*/
|
||||
sanitizeText(text, index) {
|
||||
sanitizeText: function (text, index) {
|
||||
let [anySanitized, sanitizedText] = this.sanitizePropertyValue(text);
|
||||
if (anySanitized) {
|
||||
this.changedDeclarations[index] = sanitizedText;
|
||||
@@ -742,7 +742,7 @@ RuleRewriter.prototype = {
|
||||
* @param {String} name current name of the property
|
||||
* @param {String} newName new name of the property
|
||||
*/
|
||||
renameProperty(index, name, newName) {
|
||||
renameProperty: function (index, name, newName) {
|
||||
this.completeInitialization(index);
|
||||
this.result += CSS.escape(newName);
|
||||
// We could conceivably compute the name offsets instead so we
|
||||
@@ -758,7 +758,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Boolean} isEnabled true if the property should be enabled;
|
||||
* false if it should be disabled
|
||||
*/
|
||||
setPropertyEnabled(index, name, isEnabled) {
|
||||
setPropertyEnabled: function (index, name, isEnabled) {
|
||||
this.completeInitialization(index);
|
||||
const decl = this.decl;
|
||||
let copyOffset = decl.offsets[1];
|
||||
@@ -812,7 +812,7 @@ RuleRewriter.prototype = {
|
||||
* that holds the default indentation that should be used
|
||||
* for edits to the rule.
|
||||
*/
|
||||
getDefaultIndentation() {
|
||||
getDefaultIndentation: function () {
|
||||
return this.rule.parentStyleSheet.guessIndentation();
|
||||
},
|
||||
|
||||
@@ -895,7 +895,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Boolean} enabled True if the new property should be
|
||||
* enabled, false if disabled
|
||||
*/
|
||||
createProperty(index, name, value, priority, enabled) {
|
||||
createProperty: function (index, name, value, priority, enabled) {
|
||||
this.editPromise = this.internalCreateProperty(index, name, value,
|
||||
priority, enabled);
|
||||
},
|
||||
@@ -913,7 +913,7 @@ RuleRewriter.prototype = {
|
||||
* @param {String} priority the property's priority, either the empty
|
||||
* string or "important"
|
||||
*/
|
||||
setProperty(index, name, value, priority) {
|
||||
setProperty: function (index, name, value, priority) {
|
||||
this.completeInitialization(index);
|
||||
// We might see a "set" on a previously non-existent property; in
|
||||
// that case, act like "create".
|
||||
@@ -941,7 +941,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} index index of the property in the rule.
|
||||
* @param {String} name the name of the property to remove
|
||||
*/
|
||||
removeProperty(index, name) {
|
||||
removeProperty: function (index, name) {
|
||||
this.completeInitialization(index);
|
||||
|
||||
// If asked to remove a property that does not exist, bail out.
|
||||
@@ -988,7 +988,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} copyOffset Offset into |inputString| of the
|
||||
* final text to copy to the output string.
|
||||
*/
|
||||
completeCopying(copyOffset) {
|
||||
completeCopying: function (copyOffset) {
|
||||
// Add the trailing text.
|
||||
this.result += this.inputString.substring(copyOffset);
|
||||
},
|
||||
@@ -999,7 +999,7 @@ RuleRewriter.prototype = {
|
||||
* @return {Promise} A promise which will be resolved when the modifications
|
||||
* are complete.
|
||||
*/
|
||||
apply() {
|
||||
apply: function () {
|
||||
return promise.resolve(this.editPromise).then(() => {
|
||||
return this.rule.setRuleText(this.result);
|
||||
});
|
||||
@@ -1015,7 +1015,7 @@ RuleRewriter.prototype = {
|
||||
* whose value is the new text of the property.
|
||||
* |text| is the rewritten text of the rule.
|
||||
*/
|
||||
getResult() {
|
||||
getResult: function () {
|
||||
return {changed: this.changedDeclarations, text: this.result};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user