Changeset 53205 in webkit


Ignore:
Timestamp:
Jan 13, 2010 2:12:48 PM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-01-13 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: Introduce SourceFrame2 with basic breakpoint / execution line
rendering capabilities.

Contains a drive-by naming fix (lineNumberOffset and lineNumberToOffset were
too close to each other, but were unrelated).

https://bugs.webkit.org/show_bug.cgi?id=33618

Location:
trunk/WebCore
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53204 r53205  
     12010-01-13  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: Introduce SourceFrame2 with basic breakpoint / execution line
     6        rendering capabilities.
     7
     8        Contains a drive-by naming fix (lineNumberOffset and lineNumberToOffset were
     9        too close to each other, but were unrelated).
     10
     11        https://bugs.webkit.org/show_bug.cgi?id=33618
     12
     13        * WebCore.gypi:
     14        * WebCore.vcproj/WebCore.vcproj:
     15        * inspector/front-end/SourceFrame2.js: Added.
     16        (WebInspector.SourceFrame2):
     17        (WebInspector.SourceFrame2.prototype.set text):
     18        (WebInspector.SourceFrame2.prototype.get executionLine):
     19        (WebInspector.SourceFrame2.prototype.set executionLine):
     20        (WebInspector.SourceFrame2.prototype.revealLine):
     21        (WebInspector.SourceFrame2.prototype._toggleBreakpoint):
     22        (WebInspector.SourceFrame2.prototype.resize):
     23        (WebInspector.BreakpointLineNumberDecorator):
     24        (WebInspector.BreakpointLineNumberDecorator.prototype.decorate):
     25        (WebInspector.BreakpointLineNumberDecorator.prototype._paintBreakpoint):
     26        (WebInspector.BreakpointLineNumberDecorator.prototype._paintProgramCounter):
     27        (WebInspector.BreakpointLineNumberDecorator.prototype.mouseDown):
     28        (WebInspector.ExecutionLineDecorator):
     29        (WebInspector.ExecutionLineDecorator.prototype.decorate):
     30        * inspector/front-end/TextEditor.js:
     31        (WebInspector.TextEditor):
     32        (WebInspector.TextEditor.prototype.get textModel):
     33        (WebInspector.TextEditor.prototype.set readOnly):
     34        (WebInspector.TextEditor.prototype.set lineNumberDecorator):
     35        (WebInspector.TextEditor.prototype.set lineDecorator):
     36        (WebInspector.TextEditor.prototype.selectionRange):
     37        (WebInspector.TextEditor.prototype._offsetToLine):
     38        (WebInspector.TextEditor.prototype._lineToOffset):
     39        (WebInspector.TextEditor.prototype.reveal):
     40        (WebInspector.TextEditor.prototype._textChanged):
     41        (WebInspector.TextEditor.prototype._updateSize):
     42        (WebInspector.TextEditor.prototype.updateCanvasSize):
     43        (WebInspector.TextEditor.prototype._repaintAll):
     44        (WebInspector.TextEditor.prototype._paintLines):
     45        (WebInspector.TextEditor.prototype._paintLinesContinuation):
     46        (WebInspector.TextEditor.prototype.paintLineNumbers):
     47        (WebInspector.TextEditor.prototype._paintCurrentLine):
     48        (WebInspector.TextEditor.prototype._mouseDown):
     49        (WebInspector.TextEditor.prototype._caretForMouseEvent):
     50        (WebInspector.TextEditor.prototype._keyDown):
     51        (WebInspector.TextEditor.prototype._handleNavigationKey):
     52        (WebInspector.TextEditor.prototype._textInput):
     53        (WebInspector.TextEditor.prototype._updateCursor):
     54        (WebInspector.TextEditor.prototype._paintSelection):
     55        (WebInspector.TextEditor.prototype._initFont):
     56
    1572010-01-13  Nate Chapin  <japhet@chromium.org>
    258
     
    2278        Reviewed by Adam Roben.
    2379
    24         REGRESSION (r49268): DHTML drag not allowed unless event.dataTransfer.effectAllowed 
     80        REGRESSION (r49268): DHTML drag not allowed unless event.dataTransfer.effectAllowed
    2581        is set (differs from HTML5).
    2682        Fixes <https://bugs.webkit.org/show_bug.cgi?id=33607> and <rdar://7507114>.
    2783
    2884        If no effectAllowed is set in the dragStart operation, we should default to
    29         uninitialized instead of none, so the user doesn't have to manually set the 
     85        uninitialized instead of none, so the user doesn't have to manually set the
    3086        effectAllowed to enable drag and drop.
    3187
  • trunk/WebCore/WebCore.gypi

    r53161 r53205  
    37233723            'inspector/front-end/SidebarTreeElement.js',
    37243724            'inspector/front-end/SourceFrame.js',
     3725            'inspector/front-end/SourceFrame2.js',
    37253726            'inspector/front-end/SourceSyntaxHighlighter.js',
    37263727            'inspector/front-end/SourceView.js',
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r53156 r53205  
    4284942849                                </File>
    4285042850                                <File
     42851                                        RelativePath="..\inspector\front-end\SourceFrame2.js"
     42852                                        >
     42853                                </File>
     42854                                <File
    4285142855                                        RelativePath="..\inspector\front-end\SourceSyntaxHighlighter.js"
    4285242856                                        >
  • trunk/WebCore/inspector/front-end/TextEditor.js

    r53184 r53205  
    9595
    9696    this._lineOffsetsCache = [0];
     97    this._readOnly = false;
    9798}
    9899
     
    106107    },
    107108
     109    get textModel()
     110    {
     111        return this._textModel;
     112    },
     113
     114    set readOnly(readOnly)
     115    {
     116        this._readOnly = readOnly;
     117    },
     118
     119    set lineNumberDecorator(lineNumberDecorator)
     120    {
     121        this._lineNumberDecorator = lineNumberDecorator;
     122    },
     123
     124    set lineDecorator(lineDecorator)
     125    {
     126        this._lineDecorator = lineDecorator;
     127    },
     128
    108129    setSelection: function(startLine, startColumn, endLine, endColumn)
    109130    {
     
    113134    },
    114135
    115     _offsetToLineNumber: function(offset)
     136    _offsetToLine: function(offset)
    116137    {
    117138        if (offset > this._lineOffsetsCache[this._lineOffsetsCache.length - 1]) {
    118139            // Seeking outside cached area. Fill the cache.
    119140            var lineNumber = this._lineOffsetsCache.length;
    120             while (this._lineNumberToOffset(lineNumber) < offset)
     141            while (this._lineToOffset(lineNumber) < offset)
    121142                lineNumber++;
    122143            return lineNumber;
     
    136157    },
    137158
    138     _lineNumberToOffset: function(lineNumber)
     159    _lineToOffset: function(lineNumber)
    139160    {
    140161        var offset = this._lineOffsetsCache[lineNumber];
     
    159180
    160181    reveal: function(line, column) {
    161         var maxScrollTop = this._lineNumberToOffset(line);
     182        var maxScrollTop = this._lineToOffset(line);
    162183        var minScrollTop = maxScrollTop + this._lineHeight(line) - this._canvas.height;
    163184        if (this._scrollTop > maxScrollTop)
     
    168189        var firstColumn = this._columnForOffset(line, this._scrollLeft);
    169190        var maxScrollLeft = this._columnToOffset(line, column);
    170         var minScrollLeft = maxScrollLeft - this._container.clientWidth + this._lineNumberOffset;
     191        var minScrollLeft = maxScrollLeft - this._container.clientWidth + this._lineNumberWidth;
    171192        if (this._scrollLeft < minScrollLeft)
    172193            this._container.scrollLeft = minScrollLeft + 100;
     
    185206
    186207        if (this._highlightingEnabled) {
    187             var lastVisibleLine = Math.min(this._textModel.linesCount, this._offsetToLineNumber(this._scrollTop + this._canvas.height) + 1);
     208            var lastVisibleLine = Math.min(this._textModel.linesCount, this._offsetToLine(this._scrollTop + this._canvas.height) + 1);
    188209            this._highlighter.updateHighlight(newRange.startLine, lastVisibleLine);
    189210        }
     
    194215            this._lineOffsetsCache.length = oldRange.startLine + 1;
    195216            // Force linenumber cache to be continuous.
    196             this._lineNumberToOffset(oldRange.startLine);
    197             this._paintLineNumbers();
     217            this._lineToOffset(oldRange.startLine);
     218            this.paintLineNumbers();
    198219        }
    199220        this._paint();
     
    215236    _highlightChanged: function(fromLine, toLine)
    216237    {
    217         this._invalidateLines(fromLine, toLine + 1);
     238        this._invalidateLines(fromLine, toLine);
    218239        this._paint();
    219240    },
     
    221242    _updateSize: function(startLine, endLine)
    222243    {
    223         var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount);
    224         this._lineNumberOffset = (newLineNumberDigits + 2) * this._digitWidth;
    225 
    226244        var guardedEndLine = Math.min(this._textModel.linesCount, endLine + 1);
    227245        var newMaximum = false;
     
    247265        }
    248266
    249         this._sheet.style.width = this._textWidth + this._lineNumberOffset + "px";
    250         this._sheet.style.height = this._lineNumberToOffset(this._textModel.linesCount) + "px";
    251 
    252         if (this._canvas.width !== this._container.clientWidth || this._canvas.height !== this._container.clientHeight || newLineNumberDigits !== this._lineNumberDigits) {
     267        var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount);
     268        this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth;
     269
     270        var newWidth = this._textWidth + this._lineNumberWidth + "px";
     271        var newHeight = this._lineToOffset(this._textModel.linesCount) + "px";
     272        this._sheet.style.width = newWidth;
     273        this._sheet.style.height = newHeight;
     274
     275        if (newLineNumberDigits !== this._lineNumberDigits) {
     276            this._lineNumberDigits = newLineNumberDigits;
     277            this._repaintAll();
     278        }
     279       
     280        // Changes to size can change the client area (scrollers can appear/disappear)
     281        this.updateCanvasSize();
     282    },
     283
     284    updateCanvasSize: function()
     285    {
     286        if (this._canvas.width !== this._container.clientWidth || this._canvas.height !== this._container.clientHeight) {
    253287            this._canvas.width = this._container.clientWidth;
    254288            this._canvas.height = this._container.clientHeight;
    255             this._lineNumberDigits = newLineNumberDigits;
    256289            this._repaintAll();
    257290        }
     
    261294    {
    262295        this._invalidateLines(0, this._textModel.linesCount);
    263         this._paintLineNumbers();
     296        this.paintLineNumbers();
    264297        this._paint();
    265298        this._updateCursor(this._selection.endLine, this._selection.endColumn);
     
    297330        this._ctx.font = this._font;
    298331        this._ctx.textBaseline = "bottom";
    299        
    300         firstLine = Math.max(firstLine, this._offsetToLineNumber(this._scrollTop) - 1);
    301         lastLine = Math.min(lastLine, this._offsetToLineNumber(this._scrollTop + this._canvas.height) + 1);
     332
     333        firstLine = Math.max(firstLine, this._offsetToLine(this._scrollTop) - 1);
     334        lastLine = Math.min(lastLine, this._offsetToLine(this._scrollTop + this._canvas.height) + 1);
    302335        if (firstLine > lastLine)
    303336            return;
     
    306339            WebInspector.log("Repaint %d:%d", firstLine, lastLine);
    307340            this._ctx.fillStyle = "rgb(255,255,0)";
    308             var fromOffset = this._lineNumberToOffset(firstLine);
    309             var toOffset = this._lineNumberToOffset(lastLine);
    310             this._ctx.fillRect(this._lineNumberOffset - 1, fromOffset - this._scrollTop, this._canvas.width - this._lineNumberOffset + 1, toOffset - fromOffset);
     341            var fromOffset = this._lineToOffset(firstLine);
     342            var toOffset = this._lineToOffset(lastLine);
     343            this._ctx.fillRect(this._lineNumberWidth - 1, fromOffset - this._scrollTop, this._canvas.width - this._lineNumberWidth + 1, toOffset - fromOffset);
    311344            setTimeout(this._paintLinesContinuation.bind(this, firstLine, lastLine), 100);
    312345        } else
     
    318351        this._ctx.save();
    319352        this._ctx.beginPath();
    320         this._ctx.rect(this._lineNumberOffset - 1, 0, this._canvas.width - this._lineNumberOffset + 1, this._canvas.height);
     353        this._ctx.rect(this._lineNumberWidth - 1, 0, this._canvas.width - this._lineNumberWidth + 1, this._canvas.height);
    321354        this._ctx.clip();
    322355
    323356        // First clear the region, then update last line to fit model (this clears removed lines from the end of the document).
    324         var fromOffset = this._lineNumberToOffset(firstLine);
    325         var toOffset = lastLine < this._textModel.linesCount ? this._lineNumberToOffset(lastLine) : this._canvas.height + this._scrollTop;
     357        var fromOffset = this._lineToOffset(firstLine);
     358        var toOffset = lastLine < this._textModel.linesCount ? this._lineToOffset(lastLine) : this._canvas.height + this._scrollTop;
     359
    326360        // Do not clear region when paintCurrentLine is likely to do all the necessary work.
    327         if (firstLine + 1 != lastLine || this._selection.endLine != firstLine) {
     361        if (this._readOnly || firstLine + 1 != lastLine || this._selection.endLine != firstLine) {
    328362            this._ctx.fillStyle = "rgb(255,255,255)";
    329363            this._ctx.fillRect(0, fromOffset - this._scrollTop, this._canvas.width, toOffset - fromOffset);
     
    331365        lastLine = Math.min(lastLine, this._textModel.linesCount);
    332366
     367        // Paint current line for editable mode only.
     368        if (!this._readOnly && this._selection.startLine === this._selection.endLine && firstLine <= this._selection.startLine && this._selection.startLine < lastLine)
     369            this._paintCurrentLine(this._selection.startLine);
     370
     371        this._paintSelection(firstLine, lastLine);
     372
    333373        if (this._highlightingEnabled)
    334374            this._highlighter.highlight(lastLine);
    335375
    336         if (this._selection.startLine === this._selection.endLine && firstLine <= this._selection.startLine && this._selection.startLine < lastLine)
    337             this._paintCurrentLine(this._selection.startLine);
    338 
    339         this._paintSelection(firstLine, lastLine);
    340 
    341376        for (var i = firstLine; i < lastLine; ++i) {
    342377            var line = this._textModel.line(i);
    343             var lineOffset = this._lineNumberToOffset(i) + this._textLineHeight - this._scrollTop;
     378            var lineOffset = this._lineToOffset(i) - this._scrollTop;
     379
     380            if (this._lineDecorator)
     381                this._lineDecorator.decorate(i, this._ctx, this._lineNumberWidth - 1, lineOffset, this._canvas.width - this._lineNumberWidth + 1, this._lineHeight(i), this._textLineHeight);
    344382
    345383            if (!this._highlightingEnabled) {
    346384                this._ctx.fillStyle = "rgb(0,0,0)";
    347                 this._ctx.fillText(line, this._lineNumberOffset - this._scrollLeft, lineOffset);
     385                this._ctx.fillText(line, this._lineNumberWidth - this._scrollLeft, lineOffset + this._textLineHeight);
    348386                continue;
    349387            }
     
    360398                    if (plainTextStart !== -1) {
    361399                        this._ctx.fillStyle = "rgb(0,0,0)";
    362                         this._ctx.fillText(line.substring(plainTextStart, j), this._lineNumberOffset - this._scrollLeft + this._columnToOffset(i, plainTextStart), lineOffset);
     400                        this._ctx.fillText(line.substring(plainTextStart, j), this._lineNumberWidth - this._scrollLeft + this._columnToOffset(i, plainTextStart), lineOffset + this._textLineHeight);
    363401                        plainTextStart = -1;
    364402                    }
    365403                    this._ctx.fillStyle = attribute.style;
    366                     this._ctx.fillText(line.substring(j, j + attribute.length), this._lineNumberOffset - this._scrollLeft + this._columnToOffset(i, j), lineOffset);
     404                    this._ctx.fillText(line.substring(j, j + attribute.length), this._lineNumberWidth - this._scrollLeft + this._columnToOffset(i, j), lineOffset + this._textLineHeight);
    367405                    j += attribute.length;
    368406                }
     
    370408            if (plainTextStart !== -1) {
    371409                this._ctx.fillStyle = "rgb(0,0,0)";
    372                 this._ctx.fillText(line.substring(plainTextStart, line.length), this._lineNumberOffset - this._scrollLeft + this._columnToOffset(i, plainTextStart), lineOffset);
     410                this._ctx.fillText(line.substring(plainTextStart, line.length), this._lineNumberWidth - this._scrollLeft + this._columnToOffset(i, plainTextStart), lineOffset + this._textLineHeight);
    373411            }
    374412        }
     
    376414    },
    377415
    378     _paintLineNumbers: function()
     416    paintLineNumbers: function()
    379417    {
    380418        this._ctx.font = this._font;
     
    382420
    383421        this._ctx.fillStyle = "rgb(255,255,255)";
    384         this._ctx.fillRect(0, 0, this._lineNumberOffset - 2, this._canvas.height);
     422        this._ctx.fillRect(0, 0, this._lineNumberWidth - 2, this._canvas.height);
    385423
    386424        this._ctx.fillStyle = "rgb(235,235,235)";
    387         this._ctx.fillRect(this._lineNumberOffset - 2, 0, 1, this._canvas.height);
    388 
    389         var firstLine = Math.max(0, this._offsetToLineNumber(this._scrollTop) - 1);
    390         var lastLine = Math.min(this._textModel.linesCount, this._offsetToLineNumber(this._scrollTop + this._canvas.height) + 1);
    391 
    392         this._ctx.fillStyle = "rgb(155,155,155)";
    393         for (var i = firstLine; i < lastLine; ++i)
    394            this._ctx.fillText(i + 1, (this._lineNumberDigits - this._decimalDigits(i + 1) + 1) * this._digitWidth, this._lineNumberToOffset(i) + this._textLineHeight - this._scrollTop);
     425        this._ctx.fillRect(this._lineNumberWidth - 2, 0, 1, this._canvas.height);
     426
     427        var firstLine = Math.max(0, this._offsetToLine(this._scrollTop) - 1);
     428        var lastLine = Math.min(this._textModel.linesCount, this._offsetToLine(this._scrollTop + this._canvas.height) + 1);
     429
     430        for (var i = firstLine; i < lastLine; ++i) {
     431            var lineOffset = this._lineToOffset(i) - this._scrollTop;
     432            this._ctx.fillStyle = "rgb(155,155,155)";
     433            if (this._lineNumberDecorator && this._lineNumberDecorator.decorate(i, this._ctx, 0, lineOffset, this._lineNumberWidth, this._lineHeight(i), this._textLineHeight))
     434                continue;
     435            this._ctx.fillText(i + 1, (this._lineNumberDigits - this._decimalDigits(i + 1) + 1) * this._digitWidth, lineOffset + this._textLineHeight);
     436        }
    395437    },
    396438
     
    398440    {
    399441        this._ctx.fillStyle = "rgb(232, 242, 254)";
    400         this._ctx.fillRect(0, this._lineNumberToOffset(line) - this._scrollTop, this._canvas.width, this._lineHeight(line));
    401         this._ctx.fillStyle = "rgb(0, 0, 0)";
     442        this._ctx.fillRect(0, this._lineToOffset(line) - this._scrollTop, this._canvas.width, this._lineHeight(line));
    402443    },
    403444
     
    426467    {
    427468        var location = this._caretForMouseEvent(e);
     469
     470        if (e.x < this._lineNumberWidth && this._lineNumberDecorator) {
     471            if (this._lineNumberDecorator.mouseDown(location.line, e))           
     472                return;
     473        }
     474
    428475        if (e.shiftKey)
    429476            this._setSelectionEnd(location.line, location.column);
     
    456503    _caretForMouseEvent: function(e)
    457504    {
    458         var lineNumber = Math.max(0, this._offsetToLineNumber(e.y + this._scrollTop) - 1);
     505        var lineNumber = Math.max(0, this._offsetToLine(e.y + this._scrollTop) - 1);
    459506        var line = this._textModel.line(lineNumber);
    460         var offset = e.x + this._scrollLeft - this._lineNumberOffset - this._digitWidth;
     507        var offset = e.x + this._scrollLeft - this._lineNumberWidth - this._digitWidth;
    461508        return { line: lineNumber, column: this._columnForOffset(lineNumber, offset) };
    462509    },
     
    494541            return;
    495542        }
     543
     544        if (this._readOnly)
     545            return;
    496546
    497547        var keyCodes = WebInspector.KeyboardShortcut.KeyCodes;
     
    535585                        arrowAction.call(this, caretLine - 1, this._desiredCaretColumn, true);
    536586                    else {
    537                         var offset = Math.max(0, this._lineNumberToOffset(caretLine) - this._canvas.height);
    538                         arrowAction.call(this, this._offsetToLineNumber(offset), this._desiredCaretColumn, true);
     587                        var offset = Math.max(0, this._lineToOffset(caretLine) - this._canvas.height);
     588                        arrowAction.call(this, this._offsetToLine(offset), this._desiredCaretColumn, true);
    539589                    }
    540590                }
     
    550600                        arrowAction.call(this, caretLine + 1, this._desiredCaretColumn, true);
    551601                    else {
    552                         var offset = this._lineNumberToOffset(caretLine) + this._canvas.height;
    553                         arrowAction.call(this, this._offsetToLineNumber(offset), this._desiredCaretColumn, true);
     602                        var offset = this._lineToOffset(caretLine) + this._canvas.height;
     603                        arrowAction.call(this, this._offsetToLine(offset), this._desiredCaretColumn, true);
    554604                    }
    555605                }
     
    599649    _textInput: function(e)
    600650    {
     651        if (this._readOnly)
     652            return;
     653
    601654        if (e.data && !e.altKey && !e.ctrlKey && !e.metaKey) {
    602655            this._replaceSelectionWith(e.data);
     
    627680            return;
    628681        var offset = this._columnToOffset(line, column);
    629         if (offset >= this._container.scrollLeft)
    630             this._cursor.setLocation(this._lineNumberOffset + offset - 1, this._lineNumberToOffset(line));
     682        if (offset >= this._container.scrollLeft && !this._readOnly)
     683            this._cursor.setLocation(this._lineNumberWidth + offset - 1, this._lineToOffset(line));
    631684        else
    632             this._cursor.setLocation(0, 0);
     685            this._cursor.hide();
    633686    },
    634687
     
    657710            if (i === range.startLine) {
    658711                var offset = this._columnToOffset(range.startLine, range.startColumn);
    659                 from = offset - this._scrollLeft + this._lineNumberOffset - 1;
     712                from = offset - this._scrollLeft + this._lineNumberWidth - 1;
    660713            } else
    661714                from = 0;
     
    663716            if (i === range.endLine) {
    664717                var offset = this._columnToOffset(range.endLine, range.endColumn);
    665                 to = offset - this._scrollLeft + this._lineNumberOffset - 1;
     718                to = offset - this._scrollLeft + this._lineNumberWidth - 1;
    666719            } else
    667720                to = this._canvas.width;
    668721
    669             this._ctx.fillRect(from, this._lineNumberToOffset(i) - this._scrollTop, to - from, this._textLineHeight);
     722            this._ctx.fillRect(from, this._lineToOffset(i) - this._scrollTop, to - from, this._textLineHeight);
    670723        }
    671724        this._ctx.fillStyle = "rgb(0, 0, 0)";
     
    708761    _paste: function(e)
    709762    {
     763        if (this._readOnly) {
     764            e.preventDefault();
     765            return;
     766        }
     767
    710768        var text = e.clipboardData.getData("Text");
    711769        if (!text)
     
    766824        this._textLineHeight = Math.floor(this._fontSize * 1.4);
    767825        this._cursor.setTextLineHeight(this._textLineHeight);
     826        this._lineOffsetsCache = [0];
    768827    },
    769828
     
    9551014    },
    9561015
     1016    hide: function()
     1017    {
     1018        if (this._paintInterval) {
     1019            window.clearInterval(this._paintInterval);
     1020            delete this._paintInterval;
     1021        }
     1022        this._cursorElement.style.display = "none";
     1023    },
     1024
    9571025    setTextLineHeight: function(textLineHeight)
    9581026    {
  • trunk/WebCore/inspector/front-end/TextEditorHighlighter.js

    r53184 r53205  
    7373        // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling.
    7474        var toLine = Math.min(startLine + 200, endLine);
    75         this._highlightLines(startLine, toLine);
     75        this._highlightInChunks(startLine, toLine);
    7676
    7777        // Schedule tail highlight if necessary.
     
    9191        if (this._requestedEndLine !== endLine) {
    9292            // User keeps updating the job in between of our timer ticks. Just reschedule self, don't eat CPU (they must be scrolling).
    93             this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, startLine, this._requestedEndLine), 200);
     93            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, startLine, this._requestedEndLine), 100);
    9494            return;
    9595        }
     
    134134            this._tokenizer.condition = this._tokenizer.initialCondition;
    135135
    136         var damagedFrom = startLine;
    137         var damagedTo = startLine;
    138136        for (var i = startLine; i < endLine; ++i) {
    139             damagedTo = i;
    140 
    141137            state = {};
    142138            state.preCondition = this._tokenizer.condition;
     
    151147            if (nextLineState && nextLineState.preCondition === state.postCondition) {
    152148                // Following lines are up to date, no need re-highlight.
    153                 this._damageCallback(damagedFrom, damagedTo);
     149                this._damageCallback(startLine, i + 1);
    154150                return true;
    155151            }
    156152        }
    157         this._damageCallback(damagedFrom, damagedTo);
     153        this._damageCallback(startLine, endLine);
    158154        return false;
    159155    },
  • trunk/WebCore/inspector/front-end/TextEditorModel.js

    r53184 r53205  
    148148    {
    149149        this._lines.splice(lineNumber, 0, text);
    150         this._attributes.splice(lineNumber, 0, []);
     150        this._attributes.splice(lineNumber, 0, {});
    151151    },
    152152
     
    190190        var attrs = this._attributes[line];
    191191        if (!attrs) {
    192             attrs = [];
     192            attrs = {};
    193193            this._attributes[line] = attrs;
    194194        }
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r52985 r53205  
    6565    <file>SidebarTreeElement.js</file>
    6666    <file>SourceFrame.js</file>
     67    <file>SourceFrame2.js</file>
    6768    <file>SourceSyntaxHighlighter.js</file>
    6869    <file>SourceView.js</file>
  • trunk/WebCore/inspector/front-end/inspector.html

    r52985 r53205  
    9292    <script type="text/javascript" src="ResourceView.js"></script>
    9393    <script type="text/javascript" src="SourceFrame.js"></script>
     94    <script type="text/javascript" src="SourceFrame2.js"></script>
    9495    <script type="text/javascript" src="SourceSyntaxHighlighter.js"></script>
    9596    <script type="text/javascript" src="CSSSourceSyntaxHighlighter.js"></script>
Note: See TracChangeset for help on using the changeset viewer.