⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 140421 in webkit


Ignore:
Timestamp:
Jan 22, 2013, 6:43:38 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: do not highlight really long lines in DTE.
https://bugs.webkit.org/show_bug.cgi?id=107531

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-01-22
Reviewed by Pavel Feldman.

Source/WebCore:

Improve TextEditorHighlighter.orderedRangesPerLine method to return
only ranges that start before particular column.

Test: inspector/editor/text-editor-long-line.html

  • inspector/front-end/TextEditorHighlighter.js:

(WebInspector.TextEditorHighlighter):
(WebInspector.TextEditorHighlighter.prototype.setHighlightLineLimit):
(WebInspector.TextEditorHighlighter.prototype.orderedRangesPerLine.comparator):
(WebInspector.TextEditorHighlighter.prototype.orderedRangesPerLine):

LayoutTests:

Layout test to verify that Default Text Editor does not spend time for
highlighting really long lines of code.

  • inspector/editor/highlighter-long-line.html: Correct highlighter defaults in initialization.
  • inspector/editor/text-editor-long-line-expected.txt: Added.
  • inspector/editor/text-editor-long-line.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140417 r140421  
     12013-01-22  Andrey Lushnikov  <lushnikov@chromium.org>
     2
     3        Web Inspector: do not highlight really long lines in DTE.
     4        https://bugs.webkit.org/show_bug.cgi?id=107531
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Layout test to verify that Default Text Editor does not spend time for
     9        highlighting really long lines of code.
     10
     11        * inspector/editor/highlighter-long-line.html: Correct highlighter defaults in initialization.
     12        * inspector/editor/text-editor-long-line-expected.txt: Added.
     13        * inspector/editor/text-editor-long-line.html: Added.
     14
    1152013-01-22  Thiago Marcos P. Santos  <thiago.santos@intel.com>
    216
  • trunk/LayoutTests/inspector/editor/highlighter-long-line.html

    r138438 r140421  
    1212    highlighter.mimeType = "text/javascript";
    1313    highlighter.highlightChunkLimit = Number.MAX_VALUE; // Synchronous.
     14    highlighter.setHighlightLineLimit(Number.MAX_VALUE);
    1415
    1516    var src = "/* asdf */ ";
  • trunk/Source/WebCore/ChangeLog

    r140420 r140421  
     12013-01-22  Andrey Lushnikov  <lushnikov@chromium.org>
     2
     3        Web Inspector: do not highlight really long lines in DTE.
     4        https://bugs.webkit.org/show_bug.cgi?id=107531
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Improve TextEditorHighlighter.orderedRangesPerLine method to return
     9        only ranges that start before particular column.
     10
     11        Test: inspector/editor/text-editor-long-line.html
     12
     13        * inspector/front-end/TextEditorHighlighter.js:
     14        (WebInspector.TextEditorHighlighter):
     15        (WebInspector.TextEditorHighlighter.prototype.setHighlightLineLimit):
     16        (WebInspector.TextEditorHighlighter.prototype.orderedRangesPerLine.comparator):
     17        (WebInspector.TextEditorHighlighter.prototype.orderedRangesPerLine):
     18
    1192013-01-22  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
    220
  • trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js

    r140314 r140421  
    20582058            }
    20592059
    2060             var ranges = this._highlighter.orderedRangesPerLine(lineNumber);
     2060            var ranges = highlight.ranges;
    20612061            this._renderRanges(lineRow, line, ranges);
    20622062
  • trunk/Source/WebCore/inspector/front-end/TextEditorHighlighter.js

    r140320 r140421  
    3939    this._damageCallback = damageCallback;
    4040    this._highlightChunkLimit = 1000;
     41    this._highlightLineLimit = 500;
    4142}
    4243
     
    5758
    5859    /**
    59      * @param {number} lineNumber
    60      * @return {Array.<{startColumn: number, endColumn: number, token: string}>}
     60     * @param {number} highlightLineLimit
    6161     */
    62     orderedRangesPerLine: function(lineNumber)
    63     {
    64         var syntaxTokenHighligh = this._textModel.getAttribute(lineNumber, "highlight");
    65         if (!syntaxTokenHighligh)
    66             return [];
    67 
    68         syntaxTokenHighligh.ranges.sort(function(a, b) {
    69             return a.startColumn - b.startColumn;
    70         });
    71 
    72         return syntaxTokenHighligh.ranges;
     62    setHighlightLineLimit: function(highlightLineLimit)
     63    {
     64        this._highlightLineLimit = highlightLineLimit;
    7365    },
    7466
     
    197189                    var newColumn = this._tokenizer.nextToken(lastHighlightedColumn);
    198190                    var tokenType = this._tokenizer.tokenType;
    199                     if (tokenType)
     191                    if (tokenType && lastHighlightedColumn < this._highlightLineLimit)
    200192                        state.ranges.push({
    201193                            startColumn: lastHighlightedColumn,
Note: See TracChangeset for help on using the changeset viewer.