Bug 1530294 - Add option to skip cache when requesting authored text for CSS rule r=gl

This patch adds a boolean option to skip the cached value of `StyeRuleActor.authoredText` and re-parse the stylesheet for its value.
When changing content of a descendant rule inside an ancestor like @media or @select, the cached `authoredText` value is outdated.
This yields incorrect data when requesting the complete rule authored text, hence the need for a cache-busting option.

In addition to this change, there is a slight refactor to include the generated unique selector for the mock-rule for element inline styles.

Differential Revision: https://phabricator.services.mozilla.com/D21033
This commit is contained in:
Razvan Caliman
2019-02-26 09:09:01 +00:00
parent 8dde4bca1e
commit 273e5be80d
2 changed files with 31 additions and 17 deletions

View File

@@ -10,7 +10,6 @@ const { createFactory, createElement } = require("devtools/client/shared/vendor/
const { Provider } = require("devtools/client/shared/vendor/react-redux");
loader.lazyRequireGetter(this, "ChangesContextMenu", "devtools/client/inspector/changes/ChangesContextMenu");
loader.lazyRequireGetter(this, "prettifyCSS", "devtools/shared/inspector/css-logic", true);
loader.lazyRequireGetter(this, "clipboardHelper", "devtools/shared/platform/clipboard");
const ChangesApp = createFactory(require("./components/ChangesApp"));
@@ -158,8 +157,7 @@ class ChangesView {
async copyRule(ruleId) {
const rule = await this.inspector.pageStyle.getRule(ruleId);
const text = await rule.getRuleText();
const prettyCSS = prettifyCSS(text);
clipboardHelper.copyString(prettyCSS);
clipboardHelper.copyString(text);
}
/**