Bug 1598944 - Rename isSelectionElement to isElement in markup-context-menu.js. r=jdescottes

Depends on D54422

Differential Revision: https://phabricator.services.mozilla.com/D55096
This commit is contained in:
Emilio Cobos Álvarez
2019-11-28 13:55:59 +00:00
parent c20909433d
commit 389f5fc3e9

View File

@@ -472,14 +472,14 @@ class MarkupContextMenu {
return null;
}
_getCopySubmenu(markupContainer, isSelectionElement, isFragment) {
_getCopySubmenu(markupContainer, isElement, isFragment) {
const copySubmenu = new Menu();
copySubmenu.append(
new MenuItem({
id: "node-menu-copyinner",
label: INSPECTOR_L10N.getStr("inspectorCopyInnerHTML.label"),
accesskey: INSPECTOR_L10N.getStr("inspectorCopyInnerHTML.accesskey"),
disabled: !isSelectionElement && !isFragment,
disabled: !isElement && !isFragment,
click: () => this._copyInnerHTML(),
})
);
@@ -488,7 +488,7 @@ class MarkupContextMenu {
id: "node-menu-copyouter",
label: INSPECTOR_L10N.getStr("inspectorCopyOuterHTML.label"),
accesskey: INSPECTOR_L10N.getStr("inspectorCopyOuterHTML.accesskey"),
disabled: !isSelectionElement,
disabled: !isElement,
click: () => this._copyOuterHTML(),
})
);
@@ -497,7 +497,7 @@ class MarkupContextMenu {
id: "node-menu-copyuniqueselector",
label: INSPECTOR_L10N.getStr("inspectorCopyCSSSelector.label"),
accesskey: INSPECTOR_L10N.getStr("inspectorCopyCSSSelector.accesskey"),
disabled: !isSelectionElement,
disabled: !isElement,
click: () => this._copyUniqueSelector(),
})
);
@@ -506,7 +506,7 @@ class MarkupContextMenu {
id: "node-menu-copycsspath",
label: INSPECTOR_L10N.getStr("inspectorCopyCSSPath.label"),
accesskey: INSPECTOR_L10N.getStr("inspectorCopyCSSPath.accesskey"),
disabled: !isSelectionElement,
disabled: !isElement,
click: () => this._copyCssPath(),
})
);
@@ -515,7 +515,7 @@ class MarkupContextMenu {
id: "node-menu-copyxpath",
label: INSPECTOR_L10N.getStr("inspectorCopyXPath.label"),
accesskey: INSPECTOR_L10N.getStr("inspectorCopyXPath.accesskey"),
disabled: !isSelectionElement,
disabled: !isElement,
click: () => this._copyXPath(),
})
);
@@ -524,9 +524,7 @@ class MarkupContextMenu {
id: "node-menu-copyimagedatauri",
label: INSPECTOR_L10N.getStr("inspectorImageDataUri.label"),
disabled:
!isSelectionElement ||
!markupContainer ||
!markupContainer.isPreviewable(),
!isElement || !markupContainer || !markupContainer.isPreviewable(),
click: () => this._copyImageDataUri(),
})
);
@@ -534,7 +532,7 @@ class MarkupContextMenu {
return copySubmenu;
}
_getDOMBreakpointSubmenu(isSelectionElement) {
_getDOMBreakpointSubmenu(isElement) {
const menu = new Menu();
const mutationBreakpoints = this.selection.nodeFront.mutationBreakpoints;
@@ -543,7 +541,7 @@ class MarkupContextMenu {
id: "node-menu-mutation-breakpoint-subtree",
checked: mutationBreakpoints.subtree,
click: () => this.markup.toggleMutationBreakpoint("subtree"),
disabled: !isSelectionElement,
disabled: !isElement,
label: INSPECTOR_L10N.getStr("inspectorSubtreeModification.label"),
type: "checkbox",
})
@@ -554,7 +552,7 @@ class MarkupContextMenu {
id: "node-menu-mutation-breakpoint-attribute",
checked: mutationBreakpoints.attribute,
click: () => this.markup.toggleMutationBreakpoint("attribute"),
disabled: !isSelectionElement,
disabled: !isElement,
label: INSPECTOR_L10N.getStr("inspectorAttributeModification.label"),
type: "checkbox",
})
@@ -564,7 +562,7 @@ class MarkupContextMenu {
new MenuItem({
checked: mutationBreakpoints.removal,
click: () => this.markup.toggleMutationBreakpoint("removal"),
disabled: !isSelectionElement,
disabled: !isElement,
label: INSPECTOR_L10N.getStr("inspectorNodeRemoval.label"),
type: "checkbox",
})
@@ -706,7 +704,7 @@ class MarkupContextMenu {
return pasteSubmenu;
}
_getPseudoClassSubmenu(isSelectionElement) {
_getPseudoClassSubmenu(isElement) {
const menu = new Menu();
// Set the pseudo classes
@@ -718,7 +716,7 @@ class MarkupContextMenu {
click: () => this.inspector.togglePseudoClass(name),
});
if (isSelectionElement) {
if (isElement) {
const checked = this.selection.nodeFront.hasPseudoClassLock(name);
menuitem.checked = checked;
} else {
@@ -744,16 +742,14 @@ class MarkupContextMenu {
markupContainer && markupContainer.editor.getInfoAtNode(target);
const isFragment = this.selection.isDocumentFragmentNode();
const isSelectionElement =
const isAnonymous = this.selection.isAnonymousNode();
const isElement =
this.selection.isElementNode() && !this.selection.isPseudoElementNode();
const isEditableElement =
isSelectionElement && !this.selection.isAnonymousNode();
const isEditableElement = isElement && !isAnonymous;
const isDuplicatableElement =
isSelectionElement &&
!this.selection.isAnonymousNode() &&
!this.selection.isRoot();
isElement && !isAnonymous && !this.selection.isRoot();
const isScreenshotable =
isSelectionElement && this.selection.nodeFront.isTreeDisplayed;
isElement && this.selection.nodeFront.isTreeDisplayed;
const menu = new Menu();
menu.append(
@@ -820,7 +816,7 @@ class MarkupContextMenu {
// FIXME(bug 1598952): This doesn't work in shadow trees at all, but
// we still display the active menu. Also, this should probably be
// enabled for ShadowRoot, at least the non-attribute breakpoints.
submenu: this._getDOMBreakpointSubmenu(isSelectionElement),
submenu: this._getDOMBreakpointSubmenu(isElement),
id: "node-menu-mutation-breakpoint",
})
);
@@ -865,7 +861,7 @@ class MarkupContextMenu {
menu.append(
new MenuItem({
label: INSPECTOR_L10N.getStr("inspectorPseudoClassSubmenu.label"),
submenu: this._getPseudoClassSubmenu(isSelectionElement),
submenu: this._getPseudoClassSubmenu(isElement),
})
);
@@ -885,7 +881,7 @@ class MarkupContextMenu {
accesskey: INSPECTOR_L10N.getStr(
"inspectorScrollNodeIntoView.accesskey"
),
disabled: !isSelectionElement,
disabled: !isElement,
click: () => this.markup.scrollNodeIntoView(),
})
);
@@ -899,11 +895,7 @@ class MarkupContextMenu {
menu.append(
new MenuItem({
label: INSPECTOR_L10N.getStr("inspectorCopyHTMLSubmenu.label"),
submenu: this._getCopySubmenu(
markupContainer,
isSelectionElement,
isFragment
),
submenu: this._getCopySubmenu(markupContainer, isElement, isFragment),
})
);