Bug 1865264 - [devtools] Remove CssRule/CssSheet unused `source` getters. r=devtools-reviewers,ochameau.

test_css-logic-media-queries.html was only checking this property,
and we have a mochitest equivalent checking the UI (browser_rules_media-queries.js),
so we remove it.

Depends on D193872

Differential Revision: https://phabricator.services.mozilla.com/D193873
This commit is contained in:
Nicolas Chevobbe 2023-11-22 09:37:37 +00:00
Родитель 03d2894dec
Коммит 6c847e7936
3 изменённых файлов: 0 добавлений и 82 удалений

Просмотреть файл

@ -31,7 +31,6 @@ const nodeConstants = require("resource://devtools/shared/dom-node-constants.js"
const {
getBindingElementAndPseudo,
getCSSStyleRules,
l10n,
hasVisitedState,
isAgentStylesheet,
isAuthorStylesheet,
@ -964,7 +963,6 @@ class CssRule {
this._selectors = null;
this.line = InspectorUtils.getRelativeRuleLine(this.domRule);
this.column = InspectorUtils.getRuleColumn(this.domRule);
this.source = this._cssSheet.shortSource + ":" + this.line;
this.href = this._cssSheet.href;
this.authorRule = this._cssSheet.authorSheet;
this.userRule = this._cssSheet.userSheet;
@ -972,7 +970,6 @@ class CssRule {
} else if (element) {
this._selectors = [new CssSelector(this, "@element.style", 0)];
this.line = -1;
this.source = l10n("rule.sourceElement");
this.href = "#";
this.authorRule = true;
this.userRule = false;
@ -1077,16 +1074,6 @@ class CssSelector {
_matchId = null;
/**
* Retrieve the CssSelector source, which is the source of the CssSheet owning
* the selector.
*
* @return {string} the selector source.
*/
get source() {
return this.cssRule.source;
}
/**
* Retrieve the CssSelector source element, which is the source of the CssRule
* owning the selector. This is only available when the CssSelector comes from
@ -1404,16 +1391,6 @@ class CssSelectorInfo {
}
}
/**
* Retrieve the CssSelector source, which is the source of the CssSheet owning
* the selector.
*
* @return {string} the selector source.
*/
get source() {
return this.selector.source;
}
/**
* Retrieve the CssSelector source element, which is the source of the CssRule
* owning the selector. This is only available when the CssSelector comes from

Просмотреть файл

@ -43,8 +43,6 @@ support-files = [
["test_animation-type-longhand.html"]
["test_css-logic-media-queries.html"]
["test_css-logic-specificity.html"]
["test_css-logic.html"]

Просмотреть файл

@ -1,57 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Test that css-logic handles media-queries correctly
-->
<head>
<meta charset="utf-8">
<title>Test css-logic media-queries</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<style>
div {
width: 1000px;
height: 100px;
background-color: #f00;
}
@media screen and (min-width: 1px) {
div {
width: 200px;
}
}
</style>
</head>
<body>
<div></div>
<script type="application/javascript">
"use strict";
window.onload = function() {
const {require} = ChromeUtils.importESModule("resource://devtools/shared/loader/Loader.sys.mjs");
const {CssLogic} = require("devtools/server/actors/inspector/css-logic");
SimpleTest.waitForExplicitFinish();
const div = document.querySelector("div");
const cssLogic = new CssLogic();
cssLogic.highlight(div);
cssLogic.processMatchedSelectors();
const _strings = Services.strings
.createBundle("chrome://devtools-shared/locale/styleinspector.properties");
const inline = _strings.GetStringFromName("rule.sourceInline");
const source1 = inline + ":9";
const source2 = inline + ":2";
is(cssLogic._matchedRules[0][0].source, source1,
"rule.source gives correct output for rule 1");
is(cssLogic._matchedRules[1][0].source, source2,
"rule.source gives correct output for rule 2");
SimpleTest.finish();
};
</script>
</body>
</html>