Bug 1225254 - split css-logic.js into server and shared files; r=pbro

MozReview-Commit-ID: BTFVQJcVI5d

--HG--
extra : transplant_source : n%A3%EF0e%9F%8E%09%FC4%95%F8%60l3%B73%BDS%C7
This commit is contained in:
Tom Tromey 2016-06-24 08:26:21 -06:00
parent 1006edd234
commit 469cee9bad
25 changed files with 1611 additions and 1585 deletions

View file

@ -109,6 +109,7 @@ devtools/client/webconsole/**
devtools/client/webide/** devtools/client/webide/**
!devtools/client/webide/components/webideCli.js !devtools/client/webide/components/webideCli.js
devtools/server/** devtools/server/**
!devtools/server/css-logic.js
!devtools/server/actors/webbrowser.js !devtools/server/actors/webbrowser.js
!devtools/server/actors/styles.js !devtools/server/actors/styles.js
!devtools/server/actors/string.js !devtools/server/actors/string.js
@ -125,7 +126,6 @@ devtools/shared/discovery/**
devtools/shared/gcli/** devtools/shared/gcli/**
!devtools/shared/gcli/templater.js !devtools/shared/gcli/templater.js
devtools/shared/heapsnapshot/** devtools/shared/heapsnapshot/**
devtools/shared/inspector/**
devtools/shared/layout/** devtools/shared/layout/**
devtools/shared/locales/** devtools/shared/locales/**
devtools/shared/performance/** devtools/shared/performance/**

View file

@ -11,7 +11,7 @@
const {Cc, Ci} = require("chrome"); const {Cc, Ci} = require("chrome");
const ToolDefinitions = require("devtools/client/definitions").Tools; const ToolDefinitions = require("devtools/client/definitions").Tools;
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const CssLogic = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles"); const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const promise = require("promise"); const promise = require("promise");
const defer = require("devtools/shared/defer"); const defer = require("devtools/shared/defer");

View file

@ -8,7 +8,7 @@
const {Cc, Ci} = require("chrome"); const {Cc, Ci} = require("chrome");
const promise = require("promise"); const promise = require("promise");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const CssLogic = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles"); const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const {TextProperty} = const {TextProperty} =
require("devtools/client/inspector/rules/models/text-property"); require("devtools/client/inspector/rules/models/text-property");

View file

@ -14,7 +14,7 @@ const Services = require("Services");
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm"); const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const {Task} = require("devtools/shared/task"); const {Task} = require("devtools/shared/task");
const {Tools} = require("devtools/client/definitions"); const {Tools} = require("devtools/client/definitions");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {l10n} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles"); const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const {OutputParser} = require("devtools/client/shared/output-parser"); const {OutputParser} = require("devtools/client/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils"); const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
@ -968,7 +968,7 @@ CssRuleView.prototype = {
createChild(this.element, "div", { createChild(this.element, "div", {
id: "noResults", id: "noResults",
textContent: CssLogic.l10n("rule.empty") textContent: l10n("rule.empty")
}); });
}, },
@ -1011,7 +1011,7 @@ CssRuleView.prototype = {
if (this._selectedElementLabel) { if (this._selectedElementLabel) {
return this._selectedElementLabel; return this._selectedElementLabel;
} }
this._selectedElementLabel = CssLogic.l10n("rule.selectedElement"); this._selectedElementLabel = l10n("rule.selectedElement");
return this._selectedElementLabel; return this._selectedElementLabel;
}, },
@ -1022,7 +1022,7 @@ CssRuleView.prototype = {
if (this._pseudoElementLabel) { if (this._pseudoElementLabel) {
return this._pseudoElementLabel; return this._pseudoElementLabel;
} }
this._pseudoElementLabel = CssLogic.l10n("rule.pseudoElement"); this._pseudoElementLabel = l10n("rule.pseudoElement");
return this._pseudoElementLabel; return this._pseudoElementLabel;
}, },

View file

@ -19,7 +19,7 @@
var {classes: Cc, interfaces: Ci, utils: Cu} = Components; var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {CssLogic} = require("devtools/shared/inspector/css-logic"); var {isContentStylesheet} = require("devtools/shared/inspector/css-logic");
var defer = require("devtools/shared/defer"); var defer = require("devtools/shared/defer");
/** /**
@ -68,7 +68,7 @@ addMessageListener("Test:GetStyleSheetsInfoForNode", function (msg) {
let sheet = domRules.GetElementAt(i).parentStyleSheet; let sheet = domRules.GetElementAt(i).parentStyleSheet;
sheets.push({ sheets.push({
href: sheet.href, href: sheet.href,
isContentSheet: CssLogic.isContentStylesheet(sheet) isContentSheet: isContentStylesheet(sheet)
}); });
} }

View file

@ -6,7 +6,7 @@
const {Ci} = require("chrome"); const {Ci} = require("chrome");
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm"); const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {l10n} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles"); const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const {PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils"); const {PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
const {Rule} = require("devtools/client/inspector/rules/models/rule"); const {Rule} = require("devtools/client/inspector/rules/models/rule");
@ -159,7 +159,7 @@ RuleEditor.prototype = {
class: "ruleview-selectorhighlighter" + class: "ruleview-selectorhighlighter" +
(this.ruleView.highlightedSelector === selector ? (this.ruleView.highlightedSelector === selector ?
" highlighted" : ""), " highlighted" : ""),
title: CssLogic.l10n("rule.selectorHighlighter.tooltip") title: l10n("rule.selectorHighlighter.tooltip")
}); });
selectorHighlighter.addEventListener("click", () => { selectorHighlighter.addEventListener("click", () => {
this.ruleView.toggleSelectorHighlighter(selectorHighlighter, selector); this.ruleView.toggleSelectorHighlighter(selectorHighlighter, selector);

View file

@ -5,7 +5,7 @@
"use strict"; "use strict";
const {Ci} = require("chrome"); const {Ci} = require("chrome");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {l10n} = require("devtools/shared/inspector/css-logic");
const {getCssProperties} = require("devtools/shared/fronts/css-properties"); const {getCssProperties} = require("devtools/shared/fronts/css-properties");
const {InplaceEditor, editableField} = const {InplaceEditor, editableField} =
require("devtools/client/shared/inplace-editor"); require("devtools/client/shared/inplace-editor");
@ -176,7 +176,7 @@ TextPropertyEditor.prototype = {
this.warning = createChild(this.container, "div", { this.warning = createChild(this.container, "div", {
class: "ruleview-warning", class: "ruleview-warning",
hidden: "", hidden: "",
title: CssLogic.l10n("rule.warning.title"), title: l10n("rule.warning.title"),
}); });
// Filter button that filters for the current property name and is // Filter button that filters for the current property name and is
@ -184,7 +184,7 @@ TextPropertyEditor.prototype = {
this.filterProperty = createChild(this.container, "div", { this.filterProperty = createChild(this.container, "div", {
class: "ruleview-overridden-rule-filter", class: "ruleview-overridden-rule-filter",
hidden: "", hidden: "",
title: CssLogic.l10n("rule.filterProperty.title"), title: l10n("rule.filterProperty.title"),
}); });
this.filterProperty.addEventListener("click", event => { this.filterProperty.addEventListener("click", event => {
@ -371,7 +371,7 @@ TextPropertyEditor.prototype = {
onRevert: this._onSwatchRevert onRevert: this._onSwatchRevert
}); });
span.on("unit-change", this._onSwatchCommit); span.on("unit-change", this._onSwatchCommit);
let title = CssLogic.l10n("rule.colorSwatch.tooltip"); let title = l10n("rule.colorSwatch.tooltip");
span.setAttribute("title", title); span.setAttribute("title", title);
} }
} }
@ -389,7 +389,7 @@ TextPropertyEditor.prototype = {
onCommit: this._onSwatchCommit, onCommit: this._onSwatchCommit,
onRevert: this._onSwatchRevert onRevert: this._onSwatchRevert
}); });
let title = CssLogic.l10n("rule.bezierSwatch.tooltip"); let title = l10n("rule.bezierSwatch.tooltip");
span.setAttribute("title", title); span.setAttribute("title", title);
} }
} }
@ -406,7 +406,7 @@ TextPropertyEditor.prototype = {
onCommit: this._onSwatchCommit, onCommit: this._onSwatchCommit,
onRevert: this._onSwatchRevert onRevert: this._onSwatchRevert
}, outputParser, parserOptions); }, outputParser, parserOptions);
let title = CssLogic.l10n("rule.filterSwatch.tooltip"); let title = l10n("rule.filterSwatch.tooltip");
span.setAttribute("title", title); span.setAttribute("title", title);
} }
} }
@ -416,7 +416,7 @@ TextPropertyEditor.prototype = {
if (this.ruleEditor.isEditable) { if (this.ruleEditor.isEditable) {
for (let angleSpan of this.angleSwatchSpans) { for (let angleSpan of this.angleSwatchSpans) {
angleSpan.on("unit-change", this._onSwatchCommit); angleSpan.on("unit-change", this._onSwatchCommit);
let title = CssLogic.l10n("rule.angleSwatch.tooltip"); let title = l10n("rule.angleSwatch.tooltip");
angleSpan.setAttribute("title", title); angleSpan.setAttribute("title", title);
} }
} }

View file

@ -19,7 +19,7 @@
var {classes: Cc, interfaces: Ci, utils: Cu} = Components; var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {CssLogic} = require("devtools/shared/inspector/css-logic"); var {isContentStylesheet} = require("devtools/shared/inspector/css-logic");
var defer = require("devtools/shared/defer"); var defer = require("devtools/shared/defer");
/** /**
@ -68,7 +68,7 @@ addMessageListener("Test:GetStyleSheetsInfoForNode", function (msg) {
let sheet = domRules.GetElementAt(i).parentStyleSheet; let sheet = domRules.GetElementAt(i).parentStyleSheet;
sheets.push({ sheets.push({
href: sheet.href, href: sheet.href,
isContentSheet: CssLogic.isContentStylesheet(sheet) isContentSheet: isContentStylesheet(sheet)
}); });
} }

View file

@ -12,7 +12,6 @@ Services.scriptloader.loadSubScript(
this); this);
var {CssRuleView} = require("devtools/client/inspector/rules/rules"); var {CssRuleView} = require("devtools/client/inspector/rules/rules");
var {CssLogic, CssSelector} = require("devtools/shared/inspector/css-logic");
var {getInplaceEditorForSpan: inplaceEditor} = var {getInplaceEditorForSpan: inplaceEditor} =
require("devtools/client/shared/inplace-editor"); require("devtools/client/shared/inplace-editor");

View file

@ -15,7 +15,7 @@ const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
const Editor = require("devtools/client/sourceeditor/editor"); const Editor = require("devtools/client/sourceeditor/editor");
const promise = require("promise"); const promise = require("promise");
const defer = require("devtools/shared/defer"); const defer = require("devtools/shared/defer");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {shortSource, prettifyCSS} = require("devtools/shared/inspector/css-logic");
const {console} = require("resource://gre/modules/Console.jsm"); const {console} = require("resource://gre/modules/Console.jsm");
const Services = require("Services"); const Services = require("Services");
const EventEmitter = require("devtools/shared/event-emitter"); const EventEmitter = require("devtools/shared/event-emitter");
@ -196,7 +196,7 @@ StyleSheetEditor.prototype = {
if (!this._friendlyName) { if (!this._friendlyName) {
let sheetURI = this.styleSheet.href; let sheetURI = this.styleSheet.href;
this._friendlyName = CssLogic.shortSource({ href: sheetURI }); this._friendlyName = shortSource({ href: sheetURI });
try { try {
this._friendlyName = decodeURI(this._friendlyName); this._friendlyName = decodeURI(this._friendlyName);
} catch (ex) { } catch (ex) {
@ -262,9 +262,8 @@ StyleSheetEditor.prototype = {
/** /**
* A helper function that fetches the source text from the style * A helper function that fetches the source text from the style
* sheet. The text is possibly prettified using * sheet. The text is possibly prettified using prettifyCSS. This
* CssLogic.prettifyCSS. This also sets |this._state.text| to the * also sets |this._state.text| to the new text.
* new text.
* *
* @return {Promise} a promise that resolves to the new text * @return {Promise} a promise that resolves to the new text
*/ */
@ -274,7 +273,7 @@ StyleSheetEditor.prototype = {
}).then((source) => { }).then((source) => {
let ruleCount = this.styleSheet.ruleCount; let ruleCount = this.styleSheet.ruleCount;
if (!this.styleSheet.isOriginalSource) { if (!this.styleSheet.isOriginalSource) {
source = CssLogic.prettifyCSS(source, ruleCount); source = prettifyCSS(source, ruleCount);
} }
this._state.text = source; this._state.text = source;
return source; return source;

View file

@ -18,7 +18,7 @@ loader.lazyGetter(this, "DOMUtils", () => {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils); return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
}); });
loader.lazyRequireGetter(this, "stylesheets", "devtools/server/actors/stylesheets"); loader.lazyRequireGetter(this, "stylesheets", "devtools/server/actors/stylesheets");
loader.lazyRequireGetter(this, "CssLogic", "devtools/shared/inspector/css-logic", true); loader.lazyRequireGetter(this, "prettifyCSS", "devtools/shared/inspector/css-logic", true);
const CSSRule = Ci.nsIDOMCSSRule; const CSSRule = Ci.nsIDOMCSSRule;
@ -397,7 +397,7 @@ var CSSUsageActor = protocol.ActorClassWithSpec(cssUsageSpec, {
shortUrl: rule.url.split("/").slice(-1)[0], shortUrl: rule.url.split("/").slice(-1)[0],
start: { line: rule.line, column: rule.column }, start: { line: rule.line, column: rule.column },
selectorText: ruleData.selectorText, selectorText: ruleData.selectorText,
formattedCssText: CssLogic.prettifyCSS(ruleData.cssText) formattedCssText: prettifyCSS(ruleData.cssText)
}; };
}; };

View file

@ -12,7 +12,7 @@ const { on, emit } = require("sdk/event/core");
const lazyContainer = {}; const lazyContainer = {};
loader.lazyRequireGetter(lazyContainer, "CssLogic", loader.lazyRequireGetter(lazyContainer, "CssLogic",
"devtools/shared/inspector/css-logic", true); "devtools/server/css-logic", true);
exports.getComputedStyle = (node) => exports.getComputedStyle = (node) =>
lazyContainer.CssLogic.getComputedStyle(node); lazyContainer.CssLogic.getComputedStyle(node);

View file

@ -150,7 +150,7 @@ loader.lazyGetter(this, "eventListenerService", function () {
.getService(Ci.nsIEventListenerService); .getService(Ci.nsIEventListenerService);
}); });
loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic").CssLogic); loader.lazyGetter(this, "CssLogic", () => require("devtools/server/css-logic").CssLogic);
/** /**
* We only send nodeValue up to a certain size by default. This stuff * We only send nodeValue up to a certain size by default. This stuff

View file

@ -33,7 +33,7 @@ loader.lazyGetter(this, "Debugger", () => {
hackDebugger(Debugger); hackDebugger(Debugger);
return Debugger; return Debugger;
}); });
loader.lazyRequireGetter(this, "CssLogic", "devtools/shared/inspector/css-logic", true); loader.lazyRequireGetter(this, "CssLogic", "devtools/server/css-logic", true);
loader.lazyRequireGetter(this, "events", "sdk/event/core"); loader.lazyRequireGetter(this, "events", "sdk/event/core");
loader.lazyRequireGetter(this, "mapURIToAddonID", "devtools/server/actors/utils/map-uri-to-addon-id"); loader.lazyRequireGetter(this, "mapURIToAddonID", "devtools/server/actors/utils/map-uri-to-addon-id");

View file

@ -14,7 +14,7 @@ const {Arg, method, RetVal} = protocol;
const {fetch} = require("devtools/shared/DevToolsUtils"); const {fetch} = require("devtools/shared/DevToolsUtils");
const {oldStyleSheetSpec, styleEditorSpec} = require("devtools/shared/specs/styleeditor"); const {oldStyleSheetSpec, styleEditorSpec} = require("devtools/shared/specs/styleeditor");
loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic").CssLogic); loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic"));
var TRANSITION_CLASS = "moz-styleeditor-transitioning"; var TRANSITION_CLASS = "moz-styleeditor-transitioning";
var TRANSITION_DURATION_MS = 500; var TRANSITION_DURATION_MS = 500;

View file

@ -19,7 +19,8 @@ const {UPDATE_PRESERVING_RULES, UPDATE_GENERAL} = require("devtools/server/actor
const {pageStyleSpec, styleRuleSpec, ELEMENT_STYLE} = require("devtools/shared/specs/styles"); const {pageStyleSpec, styleRuleSpec, ELEMENT_STYLE} = require("devtools/shared/specs/styles");
loader.lazyRequireGetter(this, "CSS", "CSS"); loader.lazyRequireGetter(this, "CSS", "CSS");
loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic").CssLogic); loader.lazyGetter(this, "CssLogic", () => require("devtools/server/css-logic").CssLogic);
loader.lazyGetter(this, "SharedCssLogic", () => require("devtools/shared/inspector/css-logic"));
loader.lazyGetter(this, "DOMUtils", () => Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils)); loader.lazyGetter(this, "DOMUtils", () => Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils));
// When gathering rules to read for pseudo elements, we will skip // When gathering rules to read for pseudo elements, we will skip
@ -202,7 +203,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
getComputed: function (node, options) { getComputed: function (node, options) {
let ret = Object.create(null); let ret = Object.create(null);
this.cssLogic.sourceFilter = options.filter || CssLogic.FILTER.UA; this.cssLogic.sourceFilter = options.filter || SharedCssLogic.FILTER.UA;
this.cssLogic.highlight(node.rawNode); this.cssLogic.highlight(node.rawNode);
let computed = this.cssLogic.computedStyle || []; let computed = this.cssLogic.computedStyle || [];
@ -380,7 +381,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
* } * }
*/ */
getMatchedSelectors: function (node, property, options) { getMatchedSelectors: function (node, property, options) {
this.cssLogic.sourceFilter = options.filter || CssLogic.FILTER.UA; this.cssLogic.sourceFilter = options.filter || SharedCssLogic.FILTER.UA;
this.cssLogic.highlight(node.rawNode); this.cssLogic.highlight(node.rawNode);
let rules = new Set(); let rules = new Set();
@ -577,9 +578,9 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
for (let i = domRules.Count() - 1; i >= 0; i--) { for (let i = domRules.Count() - 1; i >= 0; i--) {
let domRule = domRules.GetElementAt(i); let domRule = domRules.GetElementAt(i);
let isSystem = !CssLogic.isContentStylesheet(domRule.parentStyleSheet); let isSystem = !SharedCssLogic.isContentStylesheet(domRule.parentStyleSheet);
if (isSystem && options.filter != CssLogic.FILTER.UA) { if (isSystem && options.filter != SharedCssLogic.FILTER.UA) {
continue; continue;
} }

View file

@ -18,7 +18,7 @@ const {originalSourceSpec, mediaRuleSpec, styleSheetSpec,
styleSheetsSpec} = require("devtools/shared/specs/stylesheets"); styleSheetsSpec} = require("devtools/shared/specs/stylesheets");
const {SourceMapConsumer} = require("source-map"); const {SourceMapConsumer} = require("source-map");
loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic").CssLogic); loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic"));
XPCOMUtils.defineLazyGetter(this, "DOMUtils", function () { XPCOMUtils.defineLazyGetter(this, "DOMUtils", function () {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils); return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);

1544
devtools/server/css-logic.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -32,6 +32,7 @@ DevToolsModules(
'child.js', 'child.js',
'content-globals.js', 'content-globals.js',
'content-server.jsm', 'content-server.jsm',
'css-logic.js',
'main.js', 'main.js',
'primitive.js', 'primitive.js',
'service-worker-child.js', 'service-worker-child.js',

View file

@ -33,7 +33,7 @@ Test that css-logic handles media-queries correctly
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var Services = require("Services"); var Services = require("Services");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {CssLogic} = require("devtools/server/css-logic");
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();

View file

@ -15,7 +15,7 @@ Test that css-logic calculates CSS specificity properly
var {utils: Cu, classes: Cc, interfaces: Ci} = Components; var {utils: Cu, classes: Cc, interfaces: Ci} = Components;
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
const {CssLogic, CssSelector} = require("devtools/shared/inspector/css-logic"); const {CssLogic, CssSelector} = require("devtools/server/css-logic");
const DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"] const DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"]
.getService(Ci.inIDOMUtils); .getService(Ci.inIDOMUtils);

View file

@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<script type="application/javascript;version=1.8" src="inspector-helpers.js"></script> <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
<script type="application/javascript;version=1.8"> <script type="application/javascript;version=1.8">
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {CssLogic} = require("devtools/server/css-logic");
window.onload = function() { window.onload = function() {
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();

View file

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
<script type="application/javascript;version=1.8" src="inspector-helpers.js"></script> <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
<script type="application/javascript;version=1.8"> <script type="application/javascript;version=1.8">
const inspector = require("devtools/server/actors/inspector"); const inspector = require("devtools/server/actors/inspector");
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const CssLogic = require("devtools/shared/inspector/css-logic");
window.onload = function() { window.onload = function() {
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
"use strict"; "use strict";
const {CssLogic} = require("devtools/shared/inspector/css-logic"); const {prettifyCSS} = require("devtools/shared/inspector/css-logic");
const TESTS = [ const TESTS = [
{ name: "simple test", { name: "simple test",
@ -52,17 +52,17 @@ const TESTS = [
]; ];
function run_test() { function run_test() {
// Note that CssLogic.LINE_SEPARATOR is computed lazily, so we // Note that prettifyCSS.LINE_SEPARATOR is computed lazily, so we
// ensure it is set. // ensure it is set.
CssLogic.prettifyCSS(""); prettifyCSS("");
for (let test of TESTS) { for (let test of TESTS) {
do_print(test.name); do_print(test.name);
let input = test.input.split("\n").join(CssLogic.LINE_SEPARATOR); let input = test.input.split("\n").join(prettifyCSS.LINE_SEPARATOR);
let output = CssLogic.prettifyCSS(input); let output = prettifyCSS(input);
let expected = test.expected.join(CssLogic.LINE_SEPARATOR) + let expected = test.expected.join(prettifyCSS.LINE_SEPARATOR) +
CssLogic.LINE_SEPARATOR; prettifyCSS.LINE_SEPARATOR;
equal(output, expected, test.name); equal(output, expected, test.name);
} }
} }