WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
34816
Web Inspector: split source code into chunks in order to improve text viewer performance on large files.
https://bugs.webkit.org/show_bug.cgi?id=34816
Summary
Web Inspector: split source code into chunks in order to improve text viewer ...
Pavel Feldman
Reported
2010-02-10 15:15:15 PST
This change brings back SourceFrame's canvas+style magic, restores line wrapping and makes things a lot like they used to be. It removes TextEditor for now and renames NativeTextViewer into TextViewer. TextViewer is no longer derived from TextEditor. This TextViewer is still based on TextEditorModel, no iframes are involved. Instead of creating div per line, TextViewer splits source code into 50 line chunks. Upon scroll event, visible chunks are sharded into lines and individual lines are highlighted. Whenever highlighted region gets outside of the visible area, highlight spans are thrown away and region is replaced with the original plain text chunk. Complex stuff: - Whenever there is a need to manipulate individual lines (add message bubble / set breakpoint / reveal / etc.), individual chunks for such lines are created. - There is also an implicit machinery that is maintaining selection when it goes beyond the visible area. - Search occurrences are implemented as artificial spans interweaving highlighting markup. We can now show all and highlight current (not yet implemented). Outstanding problems / TODOs: - Selection does not grow upwards due to range normalization - Highlight animation is missing (sticky yellow is used) - Repaint logic is very simple. Every time it restores origianal plain text chunks first and then splits visible ones apart. It should be optimized in a way that existing markup / line rows are reused.
Attachments
[PATCH] Proposed change.
(123.23 KB, patch)
2010-02-10 15:22 PST
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
[PATCH] Proposed change (same with style fixes).
(123.25 KB, patch)
2010-02-10 15:38 PST
,
Pavel Feldman
timothy
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Pavel Feldman
Comment 1
2010-02-10 15:22:42 PST
Created
attachment 48523
[details]
[PATCH] Proposed change.
WebKit Review Bot
Comment 2
2010-02-10 15:24:27 PST
Attachment 48523
[details]
did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 Skipping input 'WebCore/inspector/front-end/textEditor.css': Can't open for reading WebCore/inspector/front-end/textViewer.css:79: Line contains tab character. [whitespace/tab] [5] WebCore/inspector/front-end/textViewer.css:80: Line contains tab character. [whitespace/tab] [5] WebCore/inspector/front-end/textViewer.css:124: Line contains tab character. [whitespace/tab] [5] WebCore/inspector/front-end/textViewer.css:125: Line contains tab character. [whitespace/tab] [5] WebCore/inspector/front-end/textViewer.css:133: Line contains tab character. [whitespace/tab] [5] Skipping input 'WebCore/inspector/front-end/TextEditor.js': Can't open for reading Skipping input 'WebCore/inspector/front-end/NativeTextViewer.js': Can't open for reading Total errors found: 5 If any of these errors are false positives, please file a bug against check-webkit-style.
Pavel Feldman
Comment 3
2010-02-10 15:38:36 PST
Created
attachment 48525
[details]
[PATCH] Proposed change (same with style fixes).
Timothy Hatcher
Comment 4
2010-02-10 23:27:23 PST
Comment on
attachment 48525
[details]
[PATCH] Proposed change (same with style fixes).
> + setCoalescingUpdate: function(enabled)
I think two functions would be better. Like beginUpdates and endUpdates.
> + if (offset >= currentOffset && offset < currentOffset + rowHeight) { > + return row.chunkNumber; > + }
No braces.
> + for (var i = 0; i < chunkNumber && i < this._textChunks.length; ++i) { > + lineNumber += this._textChunks[i].linesCount; > + }
No braces.
> + var firstVisibleChunk = this._chunkForOffset(Math.max(scrollTop - 10, 0));
What is the 10 magic number? Make it a named constant.
> + for (var i = digits; i < totalDigits; ++i) { > + number += " "; > + }
Braces.
> +Node.prototype.traverseNextTextNode = function(stayWithin, ignoreClass)
ignoreClass isn't used. I am a little concerned about the \u200B\n code. It will cause the coppied text to contain unicode an that can make some editors complain.
Timothy Hatcher
Comment 5
2010-02-11 00:02:18 PST
Comment on
attachment 48525
[details]
[PATCH] Proposed change (same with style fixes). With the style tweaks we talked about on irc for the line gutter and the zero-width space removal.
Pavel Feldman
Comment 6
2010-02-11 06:19:12 PST
(In reply to
comment #4
)
> (From update of
attachment 48525
[details]
) > > + setCoalescingUpdate: function(enabled) > > I think two functions would be better. Like beginUpdates and endUpdates. >
Done.
> No braces. >
Done.
> > No braces.
Done.
> > > What is the 10 magic number? Make it a named constant.
Done.
> > > Braces. >
Done.
> > > +Node.prototype.traverseNextTextNode = function(stayWithin, ignoreClass) > > ignoreClass isn't used.
Done.
> > I am a little concerned about the \u200B\n code. It will cause the coppied text > to contain unicode an that can make some editors complain.
I removed \u200B. (In reply to
comment #5
)
> (From update of
attachment 48525
[details]
) > With the style tweaks we talked about on irc for the line gutter and the > zero-width space removal.
Removed the space, added gutter gap.
Pavel Feldman
Comment 7
2010-02-11 09:17:51 PST
Variation of patch landed. (I extracted a TextChunk class for better clarity and optimized repaint). Committing to
http://svn.webkit.org/repository/webkit/trunk
... D WebCore/inspector/front-end/NativeTextViewer.js D WebCore/inspector/front-end/TextEditor.js D WebCore/inspector/front-end/textEditor.css M WebCore/ChangeLog M WebCore/WebCore.gypi M WebCore/WebCore.vcproj/WebCore.vcproj M WebCore/inspector/front-end/ScriptView.js M WebCore/inspector/front-end/Settings.js M WebCore/inspector/front-end/SourceFrame.js M WebCore/inspector/front-end/SourceView.js A WebCore/inspector/front-end/TextViewer.js M WebCore/inspector/front-end/WebKit.qrc M WebCore/inspector/front-end/inspector.css M WebCore/inspector/front-end/inspector.html A WebCore/inspector/front-end/textViewer.css M WebCore/inspector/front-end/utilities.js Committed
r54657
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug