Changeset 95716 in webkit


Ignore:
Timestamp:
Sep 22, 2011 6:43:23 AM (13 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Console is always scrolled to the top
https://bugs.webkit.org/show_bug.cgi?id=67483

Reviewed by Pavel Feldman.

  • inspector/front-end/ConsoleView.js:

(WebInspector.ConsoleView.prototype.wasShown):
(WebInspector.ConsoleView.prototype.storeScrollPositions):
(WebInspector.ConsoleView.prototype.restoreScrollPositions):
(WebInspector.ConsoleView.prototype.onResize):
(WebInspector.ConsoleView.prototype._immediatelyScrollIntoView):
(WebInspector.ConsoleView.prototype._cancelScheduledScrollIntoView):
(WebInspector.ConsoleView.prototype._consoleCleared):

  • inspector/front-end/Drawer.js:

(WebInspector.Drawer.prototype.hide):
(WebInspector.Drawer.prototype.resize):
(WebInspector.Drawer.prototype._startStatusBarDragging):
(WebInspector.Drawer.prototype._statusBarDragging):

  • inspector/front-end/inspector.js:

(WebInspector.animateStyle):
(WebInspector.animateStyle.forceComplete):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95715 r95716  
     12011-09-22  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Console is always scrolled to the top
     4        https://bugs.webkit.org/show_bug.cgi?id=67483
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/ConsoleView.js:
     9        (WebInspector.ConsoleView.prototype.wasShown):
     10        (WebInspector.ConsoleView.prototype.storeScrollPositions):
     11        (WebInspector.ConsoleView.prototype.restoreScrollPositions):
     12        (WebInspector.ConsoleView.prototype.onResize):
     13        (WebInspector.ConsoleView.prototype._immediatelyScrollIntoView):
     14        (WebInspector.ConsoleView.prototype._cancelScheduledScrollIntoView):
     15        (WebInspector.ConsoleView.prototype._consoleCleared):
     16        * inspector/front-end/Drawer.js:
     17        (WebInspector.Drawer.prototype.hide):
     18        (WebInspector.Drawer.prototype.resize):
     19        (WebInspector.Drawer.prototype._startStatusBarDragging):
     20        (WebInspector.Drawer.prototype._statusBarDragging):
     21        * inspector/front-end/inspector.js:
     22        (WebInspector.animateStyle):
     23        (WebInspector.animateStyle.forceComplete):
     24
    1252011-09-22  Alpha Lam  <hclam@chromium.org>
    226
  • trunk/Source/WebCore/inspector/front-end/ConsoleView.js

    r95536 r95716  
    227227    wasShown: function()
    228228    {
     229        WebInspector.View.prototype.wasShown.call(this);
    229230        if (!this.prompt.isCaretInsidePrompt())
    230231            this.prompt.moveCaretToEndOfPrompt();
     
    236237    },
    237238
     239    storeScrollPositions: function()
     240    {
     241        WebInspector.View.prototype.storeScrollPositions.call(this);
     242        this._scrolledToBottom = this.messagesElement.isScrolledToBottom();
     243    },
     244
     245    restoreScrollPositions: function()
     246    {
     247        if (this._scrolledToBottom)
     248            this._immediatelyScrollIntoView();
     249        else
     250            WebInspector.View.prototype.restoreScrollPositions.call(this);
     251    },
     252
     253    onResize: function()
     254    {
     255        this.restoreScrollPositions();
     256    },
     257
    238258    _isScrollIntoViewScheduled: function()
    239259    {
     
    252272        }
    253273        this._scrollIntoViewTimer = setTimeout(scrollIntoView.bind(this), 20);
     274    },
     275
     276    _immediatelyScrollIntoView: function()
     277    {
     278        this.promptElement.scrollIntoView(true);
     279        this._cancelScheduledScrollIntoView();
     280    },
     281
     282    _cancelScheduledScrollIntoView: function()
     283    {
     284        if (!this._isScrollIntoViewScheduled())
     285            return;
     286
     287        clearTimeout(this._scrollIntoViewTimer);
     288        delete this._scrollIntoViewTimer;
    254289    },
    255290
     
    287322    _consoleCleared: function()
    288323    {
     324        this._scrolledToBottom = true;
    289325        this.messages = [];
    290326
  • trunk/Source/WebCore/inspector/front-end/Drawer.js

    r95536 r95716  
    5959    show: function(view, immediately)
    6060    {
     61        this.immediatelyFinishAnimation();
     62
    6163        var drawerWasVisible = this.visible;
    62 
    63         this.immediatelyFinishAnimation();
     64       
    6465        if (this._view)
    6566            this.element.removeChild(this._view.element);
    6667
    6768        this._view = view;
    68         this._view.show(this.element);
    6969
    7070        var statusBarItems = this._view.statusBarItems || [];
     
    7676
    7777        document.body.addStyleClass("drawer-visible");
     78
     79        this._view.show(this.element);
    7880
    7981        var anchoredItems = document.getElementById("anchored-status-bar-items");
     
    121123        this._savedHeight = this.element.offsetHeight;
    122124
    123         this.element.removeChild(this._view.element);
    124         delete this._view;
    125 
    126125        if (this.element === WebInspector.currentFocusElement || this.element.isAncestor(WebInspector.currentFocusElement))
    127126            WebInspector.currentFocusElement = WebInspector.previousFocusElement;
     
    162161            }
    163162
     163            this._view.hide();
     164            this.element.removeChild(this._view.element);
     165            delete this._view;
    164166            document.body.removeStyleClass("drawer-visible");
    165167            delete this._currentAnimation;
     
    176178            return;
    177179
     180        this._view.storeScrollPositions();
    178181        var height = this._constrainHeight(parseInt(this.element.style.height));
    179182        this._mainElement.style.bottom = height + "px";
     
    227230            return;
    228231
     232        this._view.storeScrollPositions();
    229233        WebInspector.elementDragStart(this._mainStatusBar, this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), event, "row-resize");
    230234
     
    243247        if (WebInspector.currentPanel())
    244248            WebInspector.currentPanel().doResize();
     249        this._view.doResize();
    245250
    246251        event.preventDefault();
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r95636 r95716  
    918918    function animateLoop()
    919919    {
     920        if (hasCompleted)
     921            return;
     922       
    920923        // Advance forward.
    921924        complete += intervalDuration;
     
    954957    function forceComplete()
    955958    {
    956         if (!hasCompleted) {
    957             complete = duration;
    958             animateLoop();
    959         }
     959        if (hasCompleted)
     960            return;
     961
     962        complete = duration;
     963        animateLoop();
    960964    }
    961965
Note: See TracChangeset for help on using the changeset viewer.