Skip to content
Permalink
Browse files
2011-04-08 Andrey Adaikin <aandrey@google.com>
        Reviewed by Pavel Feldman.

        Web Inspector: Tweak dynamically constants for the async highlighting in text editor
        https://bugs.webkit.org/show_bug.cgi?id=58035

        * inspector/front-end/TextViewer.js:
        (WebInspector.TextEditorMainPanel.prototype._expandChunks):
        (WebInspector.TextEditorMainPanel.prototype._schedulePaintLines):
        (WebInspector.TextEditorMainPanel.prototype._paintScheduledLines):
        (WebInspector.TextEditorMainPanel.prototype._restorePaintLinesOperationsCredit):
        (WebInspector.TextEditorMainPanel.prototype._adjustPaintLinesOperationsRefreshValue):

Canonical link: https://commits.webkit.org/73054@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Pavel Podivilov committed Apr 8, 2011
1 parent bf6cbb5 commit 5e124613f0321afbd2c42b729ae3c9c56e01f446
Showing with 35 additions and 3 deletions.
  1. +14 −0 Source/WebCore/ChangeLog
  2. +21 −3 Source/WebCore/inspector/front-end/TextViewer.js
@@ -1,3 +1,17 @@
2011-04-08 Andrey Adaikin <aandrey@google.com>

Reviewed by Pavel Feldman.

Web Inspector: Tweak dynamically constants for the async highlighting in text editor
https://bugs.webkit.org/show_bug.cgi?id=58035

* inspector/front-end/TextViewer.js:
(WebInspector.TextEditorMainPanel.prototype._expandChunks):
(WebInspector.TextEditorMainPanel.prototype._schedulePaintLines):
(WebInspector.TextEditorMainPanel.prototype._paintScheduledLines):
(WebInspector.TextEditorMainPanel.prototype._restorePaintLinesOperationsCredit):
(WebInspector.TextEditorMainPanel.prototype._adjustPaintLinesOperationsRefreshValue):

2011-04-08 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.
@@ -856,6 +856,7 @@ WebInspector.TextEditorMainPanel.prototype = {

this._restorePaintLinesOperationsCredit();
WebInspector.TextEditorChunkedPanel.prototype._expandChunks.call(this, fromIndex, toIndex);
this._adjustPaintLinesOperationsRefreshValue();

this._restoreSelection(selection);
},
@@ -875,7 +876,7 @@ WebInspector.TextEditorMainPanel.prototype = {

if (!this._scheduledPaintLines) {
this._scheduledPaintLines = [ { startLine: startLine, endLine: endLine } ];
this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 10);
this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 0);
} else {
for (var i = 0; i < this._scheduledPaintLines.length; ++i) {
var chunk = this._scheduledPaintLines[i];
@@ -910,14 +911,31 @@ WebInspector.TextEditorMainPanel.prototype = {

var scheduledPaintLines = this._scheduledPaintLines;
delete this._scheduledPaintLines;

this._restorePaintLinesOperationsCredit();
this._paintLineChunks(scheduledPaintLines, !skipRestoreSelection);
this._adjustPaintLinesOperationsRefreshValue();
},

_restorePaintLinesOperationsCredit: function()
{
this._paintLinesOperationsCredit = 250;
if (!this._paintLinesOperationsRefreshValue)
this._paintLinesOperationsRefreshValue = 250;
this._paintLinesOperationsCredit = this._paintLinesOperationsRefreshValue;
this._paintLinesOperationsLastRefresh = Date.now();
},

_adjustPaintLinesOperationsRefreshValue: function()
{
var operationsDone = this._paintLinesOperationsRefreshValue - this._paintLinesOperationsCredit;
if (operationsDone <= 0)
return;
var timePast = Date.now() - this._paintLinesOperationsLastRefresh;
if (timePast <= 0)
return;
// Make the synchronous CPU chunk for painting the lines 50 msec.
var value = Math.floor(operationsDone / timePast * 50);
this._paintLinesOperationsRefreshValue = Number.constrain(value, 150, 1500);
},

_paintLines: function(fromLine, toLine, restoreSelection)

0 comments on commit 5e12461

Please sign in to comment.