Title: [121042] trunk/Source/WebCore
Revision
121042
Author
[email protected]
Date
2012-06-22 11:22:43 -0700 (Fri, 22 Jun 2012)

Log Message

Web Inspector: [Elements] Right-clicking on whitespace should show the same context menu as right-clicking on the tag text
https://bugs.webkit.org/show_bug.cgi?id=89766

Reviewed by Vsevolod Vlasov.

Explicitly check for the TreeElement.representedObject's nodeType()
rather than for the event target's enclosing element class.
Drive-by: do not consider the "collapsed node has children" ellipsis as a text node.

* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline.prototype.populateContextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121041 => 121042)


--- trunk/Source/WebCore/ChangeLog	2012-06-22 18:19:32 UTC (rev 121041)
+++ trunk/Source/WebCore/ChangeLog	2012-06-22 18:22:43 UTC (rev 121042)
@@ -1,3 +1,17 @@
+2012-06-22  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: [Elements] Right-clicking on whitespace should show the same context menu as right-clicking on the tag text
+        https://bugs.webkit.org/show_bug.cgi?id=89766
+
+        Reviewed by Vsevolod Vlasov.
+
+        Explicitly check for the TreeElement.representedObject's nodeType()
+        rather than for the event target's enclosing element class.
+        Drive-by: do not consider the "collapsed node has children" ellipsis as a text node.
+
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline.prototype.populateContextMenu):
+
 2012-06-22  Florin Malita  <[email protected]>
 
         REGRESSION (Safari 5.1.5 - ToT): Crash in RenderSVGRoot::computeReplacedLogicalWidth

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (121041 => 121042)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-06-22 18:19:32 UTC (rev 121041)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-06-22 18:22:43 UTC (rev 121042)
@@ -449,19 +449,21 @@
         if (!treeElement)
             return false;
 
-        var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
+        var isTag = treeElement.representedObject.nodeType() === Node.ELEMENT_NODE;
         var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
+        if (textNode && textNode.hasStyleClass("bogus"))
+            textNode = null;
         var commentNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-comment");
         var populated = WebInspector.populateHrefContextMenu(contextMenu, this.selectedDOMNode(), event);
-        if (tag && treeElement._populateTagContextMenu) {
+        if (textNode && treeElement._populateTextContextMenu) {
             if (populated)
                 contextMenu.appendSeparator();
-            treeElement._populateTagContextMenu(contextMenu, event);
+            treeElement._populateTextContextMenu(contextMenu, textNode);
             populated = true;
-        } else if (textNode && treeElement._populateTextContextMenu) {
+        } else if (isTag && treeElement._populateTagContextMenu) {
             if (populated)
                 contextMenu.appendSeparator();
-            treeElement._populateTextContextMenu(contextMenu, textNode);
+            treeElement._populateTagContextMenu(contextMenu, event);
             populated = true;
         } else if (commentNode && treeElement._populateNodeContextMenu) {
             if (populated)
@@ -1561,7 +1563,7 @@
 
                 if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElement.ForbiddenClosingTagElements[tagName]))) {
                     if (this.hasChildren) {
-                        var textNodeElement = info.titleDOM.createChild("span", "webkit-html-text-node");
+                        var textNodeElement = info.titleDOM.createChild("span", "webkit-html-text-node bogus");
                         textNodeElement.textContent = "\u2026";
                         info.titleDOM.appendChild(document.createTextNode("\u200B"));
                     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to