Bug 101841 - Web Inspector: migrate text editor to mutation observers
Summary: Web Inspector: migrate text editor to mutation observers
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: 101939
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-10 10:04 PST by Pavel Feldman
Modified: 2012-11-13 02:13 PST (History)
10 users (show)

See Also:


Attachments
Patch (6.33 KB, patch)
2012-11-10 10:07 PST, Pavel Feldman
no flags Details | Formatted Diff | Diff
Patch (12.52 KB, patch)
2012-11-10 23:06 PST, Pavel Feldman
no flags Details | Formatted Diff | Diff
Patch (15.16 KB, patch)
2012-11-11 05:52 PST, Pavel Feldman
no flags Details | Formatted Diff | Diff
Patch (15.66 KB, patch)
2012-11-12 05:03 PST, Pavel Feldman
no flags Details | Formatted Diff | Diff
[Patch] for landing (17.57 KB, patch)
2012-11-13 00:31 PST, Pavel Feldman
vsevik: 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-11-10 10:04:14 PST
Otherwise, we miss notifications on the removed lines.
Comment 1 Pavel Feldman 2012-11-10 10:07:56 PST
Created attachment 173456 [details]
Patch
Comment 2 Pavel Feldman 2012-11-10 23:06:18 PST
Created attachment 173488 [details]
Patch
Comment 3 Pavel Feldman 2012-11-11 05:52:09 PST
Created attachment 173501 [details]
Patch
Comment 4 Vsevolod Vlasov 2012-11-12 03:50:14 PST
Comment on attachment 173501 [details]
Patch

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

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2080
> +        if (false) // For paint debugging.

Maybe add a debug flag at the top of this file?

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2317
> +        // console.log(this.element.innerText === this._textModel.text() + "\n");

Ditto
Comment 5 Pavel Feldman 2012-11-12 05:03:50 PST
Created attachment 173626 [details]
Patch
Comment 6 Vsevolod Vlasov 2012-11-12 05:10:33 PST
Comment on attachment 173626 [details]
Patch

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

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2147
> +            if (mutation.addedNodes.length === 1 && mutation.addedNodes[0].nodeName === "BR")

remove br check?

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2211
>              // Ensure that the newly inserted line row has no lineNumber.

Shouldn't it be assert?
Comment 7 Andrey Adaikin 2012-11-12 05:27:35 PST
Comment on attachment 173626 [details]
Patch

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

>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2211
>>              // Ensure that the newly inserted line row has no lineNumber.
> 
> Shouldn't it be assert?

This is to remove the lineNumber property from a line row being detached from the DOM, as it may be (and will be) cached for a future reuse, and we don't ever want to reuse it with a wrong lineNumber attribute.
Comment 8 Andrey Adaikin 2012-11-12 05:31:38 PST
Comment on attachment 173626 [details]
Patch

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

>>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2211
>>>              // Ensure that the newly inserted line row has no lineNumber.
>> 
>> Shouldn't it be assert?
> 
> This is to remove the lineNumber property from a line row being detached from the DOM, as it may be (and will be) cached for a future reuse, and we don't ever want to reuse it with a wrong lineNumber attribute.

ah we insert a line row here, I missed this... I guess we can get wrong lineNumbers after a drag'n'drop of a peace of code in the editor from one place to another.
Comment 9 Andrey Adaikin 2012-11-12 05:34:24 PST
Comment on attachment 173626 [details]
Patch

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

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2080
> +        if (false) // For paint debugging.

remove?

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2186
> +        // Debug check for validating whether text model matches the DOM representation.

meant to leave this comment?

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2320
>          // This is a "foreign" call outside of this class. Should be before we delete the dirty lines flag.

this comment is no longer valid
Comment 10 Pavel Feldman 2012-11-12 06:35:29 PST
Committed r134223: <http://trac.webkit.org/changeset/134223>
Comment 11 WebKit Review Bot 2012-11-12 08:10:05 PST
Re-opened since this is blocked by bug 101939
Comment 12 Pavel Feldman 2012-11-13 00:31:42 PST
Created attachment 173841 [details]
[Patch] for landing
Comment 13 Pavel Feldman 2012-11-13 00:35:08 PST
Committed r134379: <http://trac.webkit.org/changeset/134379>
Comment 14 Csaba Osztrogonác 2012-11-13 02:10:57 PST
(In reply to comment #13)
> Committed r134379: <http://trac.webkit.org/changeset/134379>

It broke zillion tests at least on Qt - http://build.webkit.sed.hu/results/x86-64%20Linux%20Qt%20Release/r134382%20%2845038%29/results.html
Comment 15 Csaba Osztrogonác 2012-11-13 02:13:29 PST
It seems the root of the problem is that mutation observers is disabled on Qt.
Is there a reason why is it disabled?