Bug 58025

Summary: Web Inspector: Bugs in some corner cases in the text editor
Product: WebKit Reporter: Andrey Adaikin <aandrey>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, podivilov, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Andrey Adaikin 2011-04-07 03:26:00 PDT
1) The very last _empty_ line would not be deleted if you hit a Backspace on it, or the selection text to be deleted is extended to the very bottom of the editor.

2) An odd corner case: delete all source code from the editor, hit backspace on the only empty line, then add a character. In this case the browser will insert a TEXT node instead of a DIV node for a lineRow.
Comment 1 Andrey Adaikin 2011-04-07 03:31:50 PDT
Created attachment 88605 [details]
Patch
Comment 2 Yury Semikhatsky 2011-04-07 06:49:10 PDT
Comment on attachment 88605 [details]
Patch

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

> Source/WebCore/ChangeLog:7
> +

ChangeLog entry should briefly explain the change, please don't leave it empty.

> Source/WebCore/inspector/front-end/TextViewer.js:1145
> +        for (var lineRow = element; lineRow; lineRow = lineRow.parentElement) {

Why not use this loop exclusively without relying on the class name above?
Comment 3 Yury Semikhatsky 2011-04-07 06:49:49 PDT
Comment on attachment 88605 [details]
Patch

Also, please update copyright years in the files you edit.
Comment 4 Andrey Adaikin 2011-04-07 07:14:16 PDT
Comment on attachment 88605 [details]
Patch

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

>> Source/WebCore/ChangeLog:7
>> +
> 
> ChangeLog entry should briefly explain the change, please don't leave it empty.

done.

>> Source/WebCore/inspector/front-end/TextViewer.js:1145
>> +        for (var lineRow = element; lineRow; lineRow = lineRow.parentElement) {
> 
> Why not use this loop exclusively without relying on the class name above?

Because an element may not be attached to the this._container any more (e.g. after a DOMNodeRemoved event). The loop is to handle the odd case when the browser would insert a line-row without the "webkit-line-content" className right under the this._container.
Comment 5 Andrey Adaikin 2011-04-07 07:17:38 PDT
Created attachment 88629 [details]
Patch
Comment 6 Pavel Podivilov 2011-04-08 04:22:11 PDT
Comment on attachment 88629 [details]
Patch

Clearing flags on attachment: 88629

Committed r83285: <http://trac.webkit.org/changeset/83285>
Comment 7 Pavel Podivilov 2011-04-08 04:22:21 PDT
All reviewed patches have been landed.  Closing bug.