Bug 1587789 - Remove isXBLAnonymous functions defined and used in the inspector. r=bgrins

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gabriel Luong 2019-10-24 21:05:44 +00:00
Родитель ba7c03e388
Коммит 7bd0dc6499
6 изменённых файлов: 4 добавлений и 51 удалений

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

@ -22,7 +22,6 @@ add_task(async function() {
for (const node of children.nodes) {
ok(node.isAnonymous, "Child is anonymous");
ok(node._form.isXBLAnonymous, "Child is XBL anonymous");
ok(!node._form.isShadowAnonymous, "Child is not shadow anonymous");
ok(!node._form.isNativeAnonymous, "Child is not native anonymous");
await isEditingMenuDisabled(node, inspector);

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

@ -32,7 +32,6 @@ add_task(async function() {
for (const node of grandchildren.nodes) {
ok(node.isAnonymous, "Child is anonymous");
ok(!node._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(!node._form.isShadowAnonymous, "Child is not shadow anonymous");
ok(node._form.isNativeAnonymous, "Child is native anonymous");
await isEditingMenuDisabled(node, inspector);

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

@ -89,12 +89,6 @@ loader.lazyRequireGetter(
"devtools/shared/layout/utils",
true
);
loader.lazyRequireGetter(
this,
"isXBLAnonymous",
"devtools/shared/layout/utils",
true
);
loader.lazyRequireGetter(
this,
"isRemoteFrame",
@ -248,7 +242,6 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
isAfterPseudoElement: isAfterPseudoElement(this.rawNode),
isAnonymous: isAnonymous(this.rawNode),
isNativeAnonymous: isNativeAnonymous(this.rawNode),
isXBLAnonymous: isXBLAnonymous(this.rawNode),
isShadowAnonymous: isShadowAnonymous(this.rawNode),
isShadowRoot: shadowRoot,
shadowRootMode: getShadowRootMode(this.rawNode),

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

@ -19,20 +19,12 @@ loader.lazyRequireGetter(
"nodeFilterConstants",
"devtools/shared/dom-node-filter-constants"
);
loader.lazyRequireGetter(
this,
"isNativeAnonymous",
"devtools/shared/layout/utils",
true
);
loader.lazyRequireGetter(
this,
"isXBLAnonymous",
"devtools/shared/layout/utils",
true
);
loader.lazyRequireGetter(
this,
"CssLogic",
@ -165,13 +157,10 @@ function standardTreeWalkerFilter(node) {
: nodeFilterConstants.FILTER_SKIP;
}
// Ignore all native and XBL anonymous content inside a non-XUL document.
// Ignore all native anonymous content inside a non-XUL document.
// We need to do this to skip things like form controls, scrollbars,
// video controls, etc (see bug 1187482).
if (
!isInXULDocument(node) &&
(isXBLAnonymous(node) || isNativeAnonymous(node))
) {
if (!isInXULDocument(node) && isNativeAnonymous(node)) {
return nodeFilterConstants.FILTER_SKIP;
}

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

@ -114,7 +114,6 @@ async function testPseudoElements(walker) {
const before = children.nodes[0];
ok(before.isAnonymous, "Child is anonymous");
ok(!before._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(!before._form.isShadowAnonymous, "Child is not shadow anonymous");
ok(before._form.isNativeAnonymous, "Child is native anonymous");
@ -123,7 +122,6 @@ async function testPseudoElements(walker) {
const after = children.nodes[2];
ok(after.isAnonymous, "Child is anonymous");
ok(!after._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(!after._form.isShadowAnonymous, "Child is not shadow anonymous");
ok(after._form.isNativeAnonymous, "Child is native anonymous");
}
@ -144,7 +142,6 @@ async function testEmptyWithPseudo(walker) {
const before = children.nodes[0];
ok(before.isAnonymous, "Child is anonymous");
ok(!before._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(!before._form.isShadowAnonymous, "Child is not shadow anonymous");
ok(before._form.isNativeAnonymous, "Child is native anonymous");
}
@ -165,14 +162,12 @@ async function testShadowAnonymous(walker) {
const before = children.nodes[0];
ok(before.isAnonymous, "Child is anonymous");
ok(!before._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(!before._form.isShadowAnonymous, "Child is not shadow anonymous");
ok(before._form.isNativeAnonymous, "Child is native anonymous");
// <h3>Shadow <em>DOM</em></h3>
const shadowChild1 = children.nodes[1];
ok(shadowChild1.isAnonymous, "Child is anonymous");
ok(!shadowChild1._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(shadowChild1._form.isShadowAnonymous, "Child is shadow anonymous");
ok(!shadowChild1._form.isNativeAnonymous, "Child is not native anonymous");
@ -183,14 +178,12 @@ async function testShadowAnonymous(walker) {
// <em>DOM</em>
const shadowSubChild = children.nodes[1];
ok(shadowSubChild.isAnonymous, "Child is anonymous");
ok(!shadowSubChild._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(shadowSubChild._form.isShadowAnonymous, "Child is shadow anonymous");
ok(!shadowSubChild._form.isNativeAnonymous, "Child is not native anonymous");
// <select multiple></select>
const shadowChild2 = children.nodes[2];
ok(shadowChild2.isAnonymous, "Child is anonymous");
ok(!shadowChild2._form.isXBLAnonymous, "Child is not XBL anonymous");
ok(shadowChild2._form.isShadowAnonymous, "Child is shadow anonymous");
ok(!shadowChild2._form.isNativeAnonymous, "Child is not native anonymous");
}

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

@ -494,7 +494,7 @@ const hasBindingParent = node => !!getBindingParent(node);
/**
* Determine whether a node is native anonymous content (as opposed
* to XBL anonymous or shadow DOM).
* to shadow DOM).
* Native anonymous content includes elements like internals to form
* controls and ::before/::after.
*
@ -503,30 +503,10 @@ const hasBindingParent = node => !!getBindingParent(node);
*
*/
const isNativeAnonymous = node =>
hasBindingParent(node) && !(isXBLAnonymous(node) || isShadowAnonymous(node));
hasBindingParent(node) && !isShadowAnonymous(node);
exports.isNativeAnonymous = isNativeAnonymous;
/**
* Determine whether a node is XBL anonymous content (as opposed
* to native anonymous or shadow DOM).
* See https://developer.mozilla.org/en-US/docs/XBL/XBL_1.0_Reference/Anonymous_Content.
*
* @param {DOMNode} node
* @return {Boolean}
*
*/
function isXBLAnonymous(node) {
const parent = getBindingParent(node);
if (!parent) {
return false;
}
const anonNodes = [...(node.ownerDocument.getAnonymousNodes(parent) || [])];
return anonNodes.indexOf(node) > -1;
}
exports.isXBLAnonymous = isXBLAnonymous;
/**
* Determine whether a node is a child of a shadow root.
* See https://w3c.github.io/webcomponents/spec/shadow/