diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/inspector/front-end/SourceFrame.js | |
parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/inspector/front-end/SourceFrame.js')
-rw-r--r-- | WebCore/inspector/front-end/SourceFrame.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 4b391ac..8e077cd 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -87,6 +87,16 @@ WebInspector.SourceFrame.prototype = { this._updateExecutionLine(previousLine); }, + markDiff: function(diffData) + { + if (this._diffLines && this._textViewer) + this._removeDiffDecorations(); + + this._diffLines = diffData; + if (this._textViewer) + this._updateDiffDecorations(); + }, + revealLine: function(lineNumber) { if (this._textViewer) @@ -161,6 +171,17 @@ WebInspector.SourceFrame.prototype = { return this._textModel; }, + get scrollTop() + { + return this._textViewer ? this._textViewer.element.scrollTop : 0; + }, + + set scrollTop(scrollTop) + { + if (this._textViewer) + this._textViewer.element.scrollTop = scrollTop; + }, + highlightLine: function(line) { if (this._textViewer) @@ -199,6 +220,7 @@ WebInspector.SourceFrame.prototype = { this._addExistingMessagesToSource(); this._addExistingBreakpointsToSource(); this._updateExecutionLine(); + this._updateDiffDecorations(); this._textViewer.resize(); if (this._lineNumberToReveal) { @@ -319,6 +341,33 @@ WebInspector.SourceFrame.prototype = { this._textViewer.addDecoration(this._executionLine - 1, "webkit-execution-line"); }, + _updateDiffDecorations: function() + { + if (!this._diffLines) + return; + + function addDecorations(textViewer, lines, className) + { + for (var i = 0; i < lines.length; ++i) + textViewer.addDecoration(lines[i], className); + } + addDecorations(this._textViewer, this._diffLines.added, "webkit-added-line"); + addDecorations(this._textViewer, this._diffLines.removed, "webkit-removed-line"); + addDecorations(this._textViewer, this._diffLines.changed, "webkit-changed-line"); + }, + + _removeDiffDecorations: function() + { + function removeDecorations(textViewer, lines, className) + { + for (var i = 0; i < lines.length; ++i) + textViewer.removeDecoration(lines[i], className); + } + removeDecorations(this._textViewer, this._diffLines.added, "webkit-added-line"); + removeDecorations(this._textViewer, this._diffLines.removed, "webkit-removed-line"); + removeDecorations(this._textViewer, this._diffLines.changed, "webkit-changed-line"); + }, + _addExistingMessagesToSource: function() { var length = this._messages.length; |