Bug 78123 - Web Inspector: toggle Edit as HTML on F2, drag nodes up / down upon Ctrl(Cmd) Up / Down.
Summary: Web Inspector: toggle Edit as HTML on F2, drag nodes up / down upon Ctrl(Cmd)...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Pavel Feldman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 09:36 PST by Pavel Feldman
Modified: 2012-02-09 04:24 PST (History)
10 users (show)

See Also:


Attachments
Patch (15.61 KB, patch)
2012-02-08 09:38 PST, Pavel Feldman
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Feldman 2012-02-08 09:36:35 PST
It almost allows working with DOM using keyboard only.
Comment 1 Pavel Feldman 2012-02-08 09:38:53 PST
Created attachment 126102 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2012-02-09 01:26:57 PST
Comment on attachment 126102 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=126102&action=review

> Source/WebCore/inspector/front-end/ElementsTreeOutline.js:509
> +            if (event.keyIdentifier === "Up" && node.previousSibling && node.parentNode) {

You could move the node.parentNode check one level above.

> Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1727
> +        if (!this.representedObject.parentNode || this.representedObject.parentNode.nodeType() == Node.DOCUMENT_NODE)

=== ?

> Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1763
> +            if (initialValue != value)

!== ?

> LayoutTests/inspector/elements/undo-dom-edits-expected.txt:56
> +    + <div id="node-to-edit-as-html">â¦</div>

Should the node change its expanded state after the HTML-wise editing?
Comment 3 Yury Semikhatsky 2012-02-09 03:16:35 PST
Comment on attachment 126102 [details]
Patch

+            if (event.keyIdentifier === "Down" && node.nextSibling && node.parentNode) {
+                node.moveTo(node.parentNode, node.nextSibling.nextSibling, this._selectNodeAfterEdit.bind(this, null, treeElement.expanded));

Will it work fine if node.nextSibling.nextSibling === null?
Comment 4 Pavel Feldman 2012-02-09 04:05:42 PST
(In reply to comment #3)
> (From update of attachment 126102 [details])
> +            if (event.keyIdentifier === "Down" && node.nextSibling && node.parentNode) {
> +                node.moveTo(node.parentNode, node.nextSibling.nextSibling, this._selectNodeAfterEdit.bind(this, null, treeElement.expanded));
> 
> Will it work fine if node.nextSibling.nextSibling === null?

Yes.
Comment 5 Pavel Feldman 2012-02-09 04:20:01 PST
(In reply to comment #2)
> (From update of attachment 126102 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=126102&action=review
> 
> > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:509
> > +            if (event.keyIdentifier === "Up" && node.previousSibling && node.parentNode) {
> 
> You could move the node.parentNode check one level above.
> 

Done.

> > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1727
> > +        if (!this.representedObject.parentNode || this.representedObject.parentNode.nodeType() == Node.DOCUMENT_NODE)
> 
> === ?

Done.

> 
> > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1763
> > +            if (initialValue != value)
> 
> !== ?
> 

Done.

> > LayoutTests/inspector/elements/undo-dom-edits-expected.txt:56
> > +    + <div id="node-to-edit-as-html">â¦</div>
> 
> Should the node change its expanded state after the HTML-wise editing?

Good point. It will be expanded, but it happends asynchronously. That's why the expectations are looking this way. Let me see if I can improve it.
Comment 6 Pavel Feldman 2012-02-09 04:24:46 PST
Committed r107217: <http://trac.webkit.org/changeset/107217>