Web Inspector: Implement Copy CSS Selector and Copy Xpath Selector context menus
https://bugs.webkit.org/show_bug.cgi?id=158881
<rdar://problem/8181156>
Reviewed by Matt Baker.
Source/WebInspectorUI:
This is based off of the Blink implementation (DOMPresentationUtils)
with some minor modifications and using our own utility methods.
* Localizations/en.lproj/localizedStrings.js:
New context menu strings.
* UserInterface/Base/DOMUtilities.js:
(WebInspector.cssPath):
(WebInspector.cssPathComponent.classNames):
(WebInspector.cssPathComponent):
(WebInspector.xpath):
(WebInspector.xpathIndex.isSimiliarNode):
(WebInspector.xpathIndex):
Build strings for a CSS selector path or XPath path to a node.
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._populateNodeContextMenu):
* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline.prototype.populateContextMenu):
Include copy path context menu items on nodes.
Pseudo elements do not get Copy XPath.
Non-node elements do not get Copy Selector Path.
LayoutTests:
* inspector/dom/domutilities-csspath-expected.txt: Added.
* inspector/dom/domutilities-csspath.html: Added.
* inspector/dom/domutilities-path-dump-expected.txt: Added.
* inspector/dom/domutilities-path-dump.html: Added.
* inspector/dom/domutilities-xpath-expected.txt: Added.
* inspector/dom/domutilities-xpath.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed