Modified: trunk/Source/WebInspectorUI/ChangeLog (246657 => 246658)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-06-20 22:28:47 UTC (rev 246657)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-06-20 22:45:17 UTC (rev 246658)
@@ -1,3 +1,17 @@
+2019-06-20 Devin Rousso <drou...@apple.com>
+
+ Web Inspector: Edit -> Tag doesn't do anything for html, head, and body elements
+ https://bugs.webkit.org/show_bug.cgi?id=199052
+ <rdar://problem/51923906>
+
+ Reviewed by Matt Baker.
+
+ * UserInterface/Views/DOMTreeElement.js:
+ (WI.DOMTreeElement.prototype.populateDOMNodeContextMenu):
+ - Don't show an "Edit > Tag" for <html>, <head>, and <body> nodes
+ - Disable any "Edit" submenu item if it's target is already being edited
+ - Prevent "Add" submenu items from being shown for text nodes
+
2019-06-19 Devin Rousso <drou...@apple.com>
Web Inspector: REGRESSION: Debugger: current call frame indicator isn't vertically centered
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (246657 => 246658)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2019-06-20 22:28:47 UTC (rev 246657)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2019-06-20 22:45:17 UTC (rev 246658)
@@ -743,12 +743,12 @@
populateDOMNodeContextMenu(contextMenu, subMenus, event)
{
- let attribute = event.target.closest(".html-attribute");
+ let attributeNode = event.target.closest(".html-attribute");
let textNode = event.target.closest(".html-text-node");
let attributeName = null;
- if (attribute) {
- let attributeNameElement = attribute.getElementsByClassName("html-attribute-name")[0];
+ if (attributeNode) {
+ let attributeNameElement = attributeNode.getElementsByClassName("html-attribute-name")[0];
if (attributeNameElement)
attributeName = attributeNameElement.textContent.trim();
}
@@ -759,23 +759,23 @@
contextMenu.appendSeparator();
let isEditableNode = this.representedObject.nodeType() === Node.ELEMENT_NODE && this.editable;
- let isNonShadowEditable = !this.representedObject.isInUserAgentShadowTree() && this.editable;
- let forbiddenClosingTag = WI.DOMTreeElement.ForbiddenClosingTagElements.has(this.representedObject.nodeNameInCorrectCase());
+ let isNonShadowEditable = !this.representedObject.isInUserAgentShadowTree() && isEditableNode;
+ let alreadyEditingHTML = this._htmlEditElement && WI.isBeingEdited(this._htmlEditElement);
if (isEditableNode) {
- if (!forbiddenClosingTag) {
+ if (!DOMTreeElement.ForbiddenClosingTagElements.has(this.representedObject.nodeNameInCorrectCase())) {
subMenus.add.appendItem(WI.UIString("Child", "A submenu item of 'Add' to append DOM nodes to the selected DOM node"), () => {
this._addHTML();
- });
+ }, alreadyEditingHTML);
}
subMenus.add.appendItem(WI.UIString("Previous Sibling", "A submenu item of 'Add' to add DOM nodes before the selected DOM node"), () => {
this._addPreviousSibling();
- });
+ }, alreadyEditingHTML);
subMenus.add.appendItem(WI.UIString("Next Sibling", "A submenu item of 'Add' to add DOM nodes after the selected DOM node"), () => {
this._addNextSibling();
- });
+ }, alreadyEditingHTML);
}
if (isNonShadowEditable) {
@@ -787,25 +787,29 @@
if (this.editable) {
subMenus.edit.appendItem(WI.UIString("HTML"), () => {
this._editAsHTML();
- });
+ }, alreadyEditingHTML);
}
if (isNonShadowEditable) {
if (attributeName) {
subMenus.edit.appendItem(WI.UIString("Attribute"), () => {
- this._startEditingAttribute(attribute, event.target);
- });
+ this._startEditingAttribute(attributeNode, event.target);
+ }, WI.isBeingEdited(attributeNode));
}
- subMenus.edit.appendItem(WI.UIString("Tag", "A submenu item of 'Edit' to change DOM element's tag name"), () => {
- this._startEditingTagName();
- });
+ if (!DOMTreeElement.EditTagBlacklist.has(this.representedObject.nodeNameInCorrectCase())) {
+ let tagNameNode = event.target.closest(".html-tag-name");
+
+ subMenus.edit.appendItem(WI.UIString("Tag", "A submenu item of 'Edit' to change DOM element's tag name"), () => {
+ this._startEditingTagName(tagNameNode);
+ }, WI.isBeingEdited(tagNameNode));
+ }
}
if (textNode && this.editable) {
subMenus.edit.appendItem(WI.UIString("Text"), () => {
this._startEditingTextNode(textNode);
- });
+ }, WI.isBeingEdited(textNode));
}
if (!this.representedObject.isPseudoElement()) {