mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1268974 - make css-parsing-utils eslint-clean; r=pbro
MozReview-Commit-ID: 4iPN37XMbIy
This commit is contained in:
parent
fb5eef8042
commit
71073210e9
@ -99,9 +99,16 @@ devtools/client/promisedebugger/**
|
||||
devtools/client/responsivedesign/**
|
||||
devtools/client/scratchpad/**
|
||||
devtools/client/shadereditor/**
|
||||
devtools/client/shared/**
|
||||
devtools/client/shared/*.js
|
||||
devtools/client/shared/*.jsm
|
||||
!devtools/client/shared/css-color.js
|
||||
!devtools/client/shared/css-color-db.js
|
||||
!devtools/client/shared/css-parsing-utils.js
|
||||
devtools/client/shared/components/**
|
||||
devtools/client/shared/redux/**
|
||||
devtools/client/shared/test/**
|
||||
devtools/client/shared/vendor/**
|
||||
devtools/client/shared/widgets/**
|
||||
devtools/client/sourceeditor/**
|
||||
devtools/client/webaudioeditor/**
|
||||
devtools/client/webconsole/**
|
||||
|
@ -514,7 +514,7 @@ RuleRewriter.prototype = {
|
||||
*
|
||||
* @param {Number} index The index of the property to modify
|
||||
*/
|
||||
completeInitialization: function(index) {
|
||||
completeInitialization: function (index) {
|
||||
if (index < 0) {
|
||||
throw new Error("Invalid index " + index + ". Expected positive integer");
|
||||
}
|
||||
@ -540,7 +540,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} offset the offset at which to compute the indentation
|
||||
* @return {String} the indentation at the indicated position
|
||||
*/
|
||||
getIndentation: function(string, offset) {
|
||||
getIndentation: function (string, offset) {
|
||||
let originalOffset = offset;
|
||||
for (--offset; offset >= 0; --offset) {
|
||||
let c = string[offset];
|
||||
@ -573,7 +573,7 @@ RuleRewriter.prototype = {
|
||||
* where |text| is the text that has been rewritten
|
||||
* to be "lexically safe".
|
||||
*/
|
||||
sanitizePropertyValue: function(text) {
|
||||
sanitizePropertyValue: function (text) {
|
||||
let lexer = DOMUtils.getCSSLexer(text);
|
||||
|
||||
let result = "";
|
||||
@ -636,7 +636,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} index the index at which to start
|
||||
* @return {Number} index of the first non-whitespace character, or -1
|
||||
*/
|
||||
skipWhitespaceBackward: function(string, index) {
|
||||
skipWhitespaceBackward: function (string, index) {
|
||||
for (--index;
|
||||
index >= 0 && (string[index] === " " || string[index] === "\t");
|
||||
--index) {
|
||||
@ -652,7 +652,7 @@ RuleRewriter.prototype = {
|
||||
* terminate. It might be invalid, so this
|
||||
* function must check for that.
|
||||
*/
|
||||
maybeTerminateDecl: function(index) {
|
||||
maybeTerminateDecl: function (index) {
|
||||
if (index < 0 || index >= this.declarations.length
|
||||
// No need to rewrite declarations in comments.
|
||||
|| ("commentOffsets" in this.declarations[index])) {
|
||||
@ -700,7 +700,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} index The index of the property.
|
||||
* @return {String} The sanitized text.
|
||||
*/
|
||||
sanitizeText: function(text, index) {
|
||||
sanitizeText: function (text, index) {
|
||||
let [anySanitized, sanitizedText] = this.sanitizePropertyValue(text);
|
||||
if (anySanitized) {
|
||||
this.changedDeclarations[index] = sanitizedText;
|
||||
@ -715,7 +715,7 @@ RuleRewriter.prototype = {
|
||||
* @param {String} name current name of the property
|
||||
* @param {String} newName new name of the property
|
||||
*/
|
||||
renameProperty: function(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
|
||||
@ -731,7 +731,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Boolean} isEnabled true if the property should be enabled;
|
||||
* false if it should be disabled
|
||||
*/
|
||||
setPropertyEnabled: function(index, name, isEnabled) {
|
||||
setPropertyEnabled: function (index, name, isEnabled) {
|
||||
this.completeInitialization(index);
|
||||
const decl = this.decl;
|
||||
let copyOffset = decl.offsets[1];
|
||||
@ -785,7 +785,7 @@ RuleRewriter.prototype = {
|
||||
* that holds the default indentation that should be used
|
||||
* for edits to the rule.
|
||||
*/
|
||||
getDefaultIndentation: function() {
|
||||
getDefaultIndentation: function () {
|
||||
return this.rule.parentStyleSheet.guessIndentation();
|
||||
},
|
||||
|
||||
@ -801,7 +801,7 @@ RuleRewriter.prototype = {
|
||||
* @return {Promise} a promise that is resolved when the edit has
|
||||
* completed
|
||||
*/
|
||||
internalCreateProperty: Task.async(function*(index, name, value, priority) {
|
||||
internalCreateProperty: Task.async(function* (index, name, value, priority) {
|
||||
this.completeInitialization(index);
|
||||
let newIndentation = "";
|
||||
if (this.hasNewLine) {
|
||||
@ -859,7 +859,7 @@ RuleRewriter.prototype = {
|
||||
* @param {String} priority priority of the new property; either
|
||||
* the empty string or "important"
|
||||
*/
|
||||
createProperty: function(index, name, value, priority) {
|
||||
createProperty: function (index, name, value, priority) {
|
||||
this.editPromise = this.internalCreateProperty(index, name, value,
|
||||
priority);
|
||||
},
|
||||
@ -877,12 +877,13 @@ RuleRewriter.prototype = {
|
||||
* @param {String} priority the property's priority, either the empty
|
||||
* string or "important"
|
||||
*/
|
||||
setProperty: function(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".
|
||||
if (!this.decl) {
|
||||
return this.createProperty(index, name, value, priority);
|
||||
this.createProperty(index, name, value, priority);
|
||||
return;
|
||||
}
|
||||
|
||||
// Note that this assumes that "set" never operates on disabled
|
||||
@ -904,7 +905,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} index index of the property in the rule.
|
||||
* @param {String} name the name of the property to remove
|
||||
*/
|
||||
removeProperty: function(index, name) {
|
||||
removeProperty: function (index, name) {
|
||||
this.completeInitialization(index);
|
||||
let copyOffset = this.decl.offsets[1];
|
||||
// Maybe removing this rule left us with a completely blank
|
||||
@ -934,7 +935,7 @@ RuleRewriter.prototype = {
|
||||
* @param {Number} copyOffset Offset into |inputString| of the
|
||||
* final text to copy to the output string.
|
||||
*/
|
||||
completeCopying: function(copyOffset) {
|
||||
completeCopying: function (copyOffset) {
|
||||
// Add the trailing text.
|
||||
this.result += this.inputString.substring(copyOffset);
|
||||
},
|
||||
@ -945,7 +946,7 @@ RuleRewriter.prototype = {
|
||||
* @return {Promise} A promise which will be resolved when the modifications
|
||||
* are complete.
|
||||
*/
|
||||
apply: function() {
|
||||
apply: function () {
|
||||
return promise.resolve(this.editPromise).then(() => {
|
||||
return this.rule.setRuleText(this.result);
|
||||
});
|
||||
@ -961,7 +962,7 @@ RuleRewriter.prototype = {
|
||||
* whose value is the new text of the property.
|
||||
* |text| is the rewritten text of the rule.
|
||||
*/
|
||||
getResult: function() {
|
||||
getResult: function () {
|
||||
return {changed: this.changedDeclarations, text: this.result};
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user