Title: [188343] trunk/Source/WebInspectorUI
- Revision
- 188343
- Author
- [email protected]
- Date
- 2015-08-12 12:03:12 -0700 (Wed, 12 Aug 2015)
Log Message
Web Inspector: DOM Node should have context menu to scroll it into view on the inspected page
https://bugs.webkit.org/show_bug.cgi?id=147913
Reviewed by Timothy Hatcher.
* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._updateChildren.set continue):
(WebInspector.DOMTreeElement.prototype._populateNodeContextMenu):
Add a context menu item to scroll into view for element nodes.
(WebInspector.DOMTreeElement.prototype._scrollIntoView.resolvedNode.scrollIntoView):
(WebInspector.DOMTreeElement.prototype._scrollIntoView.resolvedNode):
(WebInspector.DOMTreeElement.prototype._scrollIntoView):
Call scrollIntoViewIfNeeded on the real Node.
* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline.prototype.populateContextMenu):
Remove unused parameter.
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
(WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
Add context menu for Nodes in ObjectTrees.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (188342 => 188343)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-08-12 19:00:48 UTC (rev 188342)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-08-12 19:03:12 UTC (rev 188343)
@@ -1,3 +1,29 @@
+2015-08-12 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: DOM Node should have context menu to scroll it into view on the inspected page
+ https://bugs.webkit.org/show_bug.cgi?id=147913
+
+ Reviewed by Timothy Hatcher.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Views/DOMTreeElement.js:
+ (WebInspector.DOMTreeElement.prototype._updateChildren.set continue):
+ (WebInspector.DOMTreeElement.prototype._populateNodeContextMenu):
+ Add a context menu item to scroll into view for element nodes.
+
+ (WebInspector.DOMTreeElement.prototype._scrollIntoView.resolvedNode.scrollIntoView):
+ (WebInspector.DOMTreeElement.prototype._scrollIntoView.resolvedNode):
+ (WebInspector.DOMTreeElement.prototype._scrollIntoView):
+ Call scrollIntoViewIfNeeded on the real Node.
+
+ * UserInterface/Views/DOMTreeOutline.js:
+ (WebInspector.DOMTreeOutline.prototype.populateContextMenu):
+ Remove unused parameter.
+
+ * UserInterface/Views/ObjectTreeBaseTreeElement.js:
+ (WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
+ Add context menu for Nodes in ObjectTrees.
+
2015-08-12 Dan Bernstein <[email protected]>
Removed the executable bit from non-executable source.
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (188342 => 188343)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-08-12 19:00:48 UTC (rev 188342)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-08-12 19:03:12 UTC (rev 188343)
@@ -439,6 +439,7 @@
localizedStrings["Script"] = "Script";
localizedStrings["Script Evaluated"] = "Script Evaluated";
localizedStrings["Scripts"] = "Scripts";
+localizedStrings["Scroll Into View"] = "Scroll Into View";
localizedStrings["Search"] = "Search";
localizedStrings["Search Resource Content"] = "Search Resource Content";
localizedStrings["Secure"] = "Secure";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (188342 => 188343)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2015-08-12 19:00:48 UTC (rev 188342)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2015-08-12 19:03:12 UTC (rev 188343)
@@ -666,6 +666,10 @@
contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
if (this.editable)
contextMenu.appendItem(WebInspector.UIString("Delete Node"), this.remove.bind(this));
+
+ let node = this.representedObject;
+ if (node.nodeType() === Node.ELEMENT_NODE)
+ contextMenu.appendItem(WebInspector.UIString("Scroll Into View"), this._scrollIntoView.bind(this));
}
_startEditing()
@@ -1354,6 +1358,26 @@
this.representedObject.removeNode(removeNodeCallback);
}
+ _scrollIntoView()
+ {
+ function resolvedNode(object)
+ {
+ if (!object)
+ return;
+
+ function scrollIntoView()
+ {
+ this.scrollIntoViewIfNeeded(true);
+ }
+
+ object.callFunction(scrollIntoView, undefined, false, function() {});
+ object.release();
+ }
+
+ let node = this.representedObject;
+ WebInspector.RemoteObject.resolveNode(node, "", resolvedNode);
+ }
+
_editAsHTML()
{
var treeOutline = this.treeOutline;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (188342 => 188343)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js 2015-08-12 19:00:48 UTC (rev 188342)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js 2015-08-12 19:03:12 UTC (rev 188343)
@@ -266,7 +266,7 @@
} else if (commentNode && treeElement._populateNodeContextMenu) {
if (populated)
contextMenu.appendSeparator();
- treeElement._populateNodeContextMenu(contextMenu, textNode);
+ treeElement._populateNodeContextMenu(contextMenu);
populated = true;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js (188342 => 188343)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js 2015-08-12 19:00:48 UTC (rev 188342)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js 2015-08-12 19:03:12 UTC (rev 188343)
@@ -237,6 +237,11 @@
});
});
+ contextMenu.appendItem(WebInspector.UIString("Scroll Into View"), function() {
+ function scrollIntoView() { this.scrollIntoViewIfNeeded(true); }
+ resolvedValue.callFunction(scrollIntoView, undefined, false, function() {});
+ });
+
contextMenu.appendSeparator();
contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"), function() {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes