Bug 1539265 - Make ::marker pseudo-elements always visible in the markup view. r=jdescottes,mbalfanz,pbro

Instead of only when setting devtools.inspector.showAllAnonymousContent.

Differential Revision: https://phabricator.services.mozilla.com/D25166

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ian Moody 2019-04-02 07:36:27 +00:00
Родитель 8bceae1489
Коммит da57ddce6d
6 изменённых файлов: 12 добавлений и 49 удалений

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

@ -14,9 +14,9 @@ add_task(async function() {
data:text/html;charset=utf-8,
<h1>foo</h1>
<span>bar</span>
<ul>
<li></li>
</ul>`);
<dl>
<dt></dt>
</dl>`);
const markup = inspector.markup;
const doc = markup.doc;
const win = doc.defaultView;
@ -25,7 +25,7 @@ add_task(async function() {
const bodyContainer = await getContainerForSelector("body", inspector);
const spanContainer = await getContainerForSelector("span", inspector);
const headerContainer = await getContainerForSelector("h1", inspector);
const listContainer = await getContainerForSelector("ul", inspector);
const listContainer = await getContainerForSelector("dl", inspector);
// Focus on the tree element.
rootElt.focus();
@ -71,7 +71,7 @@ add_task(async function() {
"Closed tree item should have aria-expanded unset");
info("Selecting and expanding list container");
await selectNode("ul", inspector);
await selectNode("dl", inspector);
EventUtils.synthesizeKey("VK_RIGHT", {}, win);
await waitForMultipleChildrenUpdates(inspector);
@ -80,7 +80,7 @@ add_task(async function() {
"Active descendant should not be set to list container tagLine");
is(listContainer.tagLine.getAttribute("aria-expanded"), "true",
"Open tree item should have aria-expanded set");
const listItemContainer = await getContainerForSelector("li", inspector);
const listItemContainer = await getContainerForSelector("dt", inspector);
is(listItemContainer.tagLine.getAttribute("aria-level"),
TOP_CONTAINER_LEVEL + 1,
"Grand child container tagLine should have nested level up to date");

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

@ -7,10 +7,8 @@
// Test drag and dropping a node before a ::marker pseudo.
const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
const SHOWANON_PREF = "devtools.inspector.showAllAnonymousContent";
add_task(async function() {
await pushPref(SHOWANON_PREF, true);
const {inspector} = await openInspectorForURL(TEST_URL);
info("Expand #list node");

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

@ -9,8 +9,6 @@ requestLongerTimeout(1);
// Test a few static pages using webcomponents with ::marker and ::before
// pseudos and check that they are displayed as expected in the markup view.
const SHOWANON_PREF = "devtools.inspector.showAllAnonymousContent";
const TEST_DATA = [
{
// Test that ::before on an empty shadow host is displayed when the host
@ -34,10 +32,6 @@ const TEST_DATA = [
});
</script>`,
tree: `
test-component
#shadow-root
::before`,
anonTree: `
test-component
#shadow-root
::marker
@ -68,13 +62,6 @@ const TEST_DATA = [
});
</script>`,
tree: `
test-component
#shadow-root
slot
div!slotted
::before
class="light-dom"`,
anonTree: `
test-component
#shadow-root
slot
@ -102,16 +89,13 @@ const TEST_DATA = [
});
</script>`,
tree: `
test-component
#shadow-root`,
anonTree: `
test-component
#shadow-root
::marker`,
},
];
for (const {url, tree, anonTree, title} of TEST_DATA) {
for (const {url, tree, title} of TEST_DATA) {
// Test each configuration in both open and closed modes
add_task(async function() {
info(`Testing: [${title}] in OPEN mode`);
@ -125,20 +109,4 @@ for (const {url, tree, anonTree, title} of TEST_DATA) {
await assertMarkupViewAsTree(tree, "test-component", inspector);
await removeTab(tab);
});
add_task(async function() {
await pushPref(SHOWANON_PREF, true);
info(`Testing: [${title}] in OPEN mode with showAllAnonymousContent`);
const {inspector, tab} = await openInspectorForURL(url.replace(/#MODE#/g, "open"));
await assertMarkupViewAsTree(anonTree, "test-component", inspector);
await removeTab(tab);
await pushPref(SHOWANON_PREF, false);
});
add_task(async function() {
await pushPref(SHOWANON_PREF, true);
info(`Testing: [${title}] in CLOSED mode with showAllAnonymousContent`);
const {inspector, tab} = await openInspectorForURL(url.replace(/#MODE#/g, "closed"));
await assertMarkupViewAsTree(anonTree, "test-component", inspector);
await removeTab(tab);
await pushPref(SHOWANON_PREF, false);
});
}

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

@ -8,11 +8,9 @@
const TEST_URI = URL_ROOT + "doc_pseudoelement.html";
const PSEUDO_PREF = "devtools.inspector.show_pseudo_elements";
const SHOWANON_PREF = "devtools.inspector.showAllAnonymousContent";
add_task(async function() {
await pushPref(PSEUDO_PREF, true);
await pushPref(SHOWANON_PREF, true);
await addTab(TEST_URI);
const {inspector, view} = await openRuleView();

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

@ -7,11 +7,9 @@
// Test that pseudoelements are displayed correctly in the markup view.
const TEST_URI = URL_ROOT + "doc_pseudoelement.html";
const SHOWANON_PREF = "devtools.inspector.showAllAnonymousContent";
add_task(async function() {
await addTab(TEST_URI);
await pushPref(SHOWANON_PREF, true);
const {inspector} = await openRuleView();
const node = await getNodeFront("#topleft", inspector);

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

@ -60,13 +60,14 @@ function isInXULDocument(el) {
/**
* This DeepTreeWalker filter skips whitespace text nodes and anonymous
* content with the exception of ::before and ::after and anonymous content
* in XUL document (needed to show all elements in the browser toolbox).
* content with the exception of ::marker, ::before, and ::after, plus anonymous
* content in XUL document (needed to show all elements in the browser toolbox).
*/
function standardTreeWalkerFilter(node) {
// ::before and ::after are native anonymous content, but we always
// ::marker, ::before, and ::after are native anonymous content, but we always
// want to show them
if (node.nodeName === "_moz_generated_content_before" ||
if (node.nodeName === "_moz_generated_content_marker" ||
node.nodeName === "_moz_generated_content_before" ||
node.nodeName === "_moz_generated_content_after") {
return nodeFilterConstants.FILTER_ACCEPT;
}