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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95716
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-22 Vsevolod Vlasov <vsevik@chromium.org>
+
+ 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):
+
2011-09-22 Alpha Lam <hclam@chromium.org>
https://bugs.webkit.org/show_bug.cgi?id=68081
wasShown: function()
{
+ WebInspector.View.prototype.wasShown.call(this);
if (!this.prompt.isCaretInsidePrompt())
this.prompt.moveCaretToEndOfPrompt();
},
WebInspector.currentFocusElement = this.promptElement;
},
+ storeScrollPositions: function()
+ {
+ WebInspector.View.prototype.storeScrollPositions.call(this);
+ this._scrolledToBottom = this.messagesElement.isScrolledToBottom();
+ },
+
+ restoreScrollPositions: function()
+ {
+ if (this._scrolledToBottom)
+ this._immediatelyScrollIntoView();
+ else
+ WebInspector.View.prototype.restoreScrollPositions.call(this);
+ },
+
+ onResize: function()
+ {
+ this.restoreScrollPositions();
+ },
+
_isScrollIntoViewScheduled: function()
{
return !!this._scrollIntoViewTimer;
this._scrollIntoViewTimer = setTimeout(scrollIntoView.bind(this), 20);
},
+ _immediatelyScrollIntoView: function()
+ {
+ this.promptElement.scrollIntoView(true);
+ this._cancelScheduledScrollIntoView();
+ },
+
+ _cancelScheduledScrollIntoView: function()
+ {
+ if (!this._isScrollIntoViewScheduled())
+ return;
+
+ clearTimeout(this._scrollIntoViewTimer);
+ delete this._scrollIntoViewTimer;
+ },
+
_consoleMessageAdded: function(event)
{
this._appendConsoleMessage(event.data);
_consoleCleared: function()
{
+ this._scrolledToBottom = true;
this.messages = [];
this.currentGroup = this.topGroup;
show: function(view, immediately)
{
- var drawerWasVisible = this.visible;
-
this.immediatelyFinishAnimation();
+
+ var drawerWasVisible = this.visible;
+
if (this._view)
this.element.removeChild(this._view.element);
this._view = view;
- this._view.show(this.element);
var statusBarItems = this._view.statusBarItems || [];
for (var i = 0; i < statusBarItems.length; ++i)
document.body.addStyleClass("drawer-visible");
+ this._view.show(this.element);
+
var anchoredItems = document.getElementById("anchored-status-bar-items");
var height = this._constrainHeight(this._savedHeight || this.element.offsetHeight);
var animations = [
this._savedHeight = this.element.offsetHeight;
- this.element.removeChild(this._view.element);
- delete this._view;
-
if (this.element === WebInspector.currentFocusElement || this.element.isAncestor(WebInspector.currentFocusElement))
WebInspector.currentFocusElement = WebInspector.previousFocusElement;
this._counters.insertBefore(this._currentPanelCounters, this._counters.firstChild);
}
+ this._view.hide();
+ this.element.removeChild(this._view.element);
+ delete this._view;
document.body.removeStyleClass("drawer-visible");
delete this._currentAnimation;
}
if (!this.visible)
return;
+ this._view.storeScrollPositions();
var height = this._constrainHeight(parseInt(this.element.style.height));
this._mainElement.style.bottom = height + "px";
this.element.style.height = height + "px";
if (!this.visible || event.target !== this._mainStatusBar)
return;
+ this._view.storeScrollPositions();
WebInspector.elementDragStart(this._mainStatusBar, this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), event, "row-resize");
this._statusBarDragOffset = event.pageY - this.element.totalOffsetTop();
this.element.style.height = height + "px";
if (WebInspector.currentPanel())
WebInspector.currentPanel().doResize();
+ this._view.doResize();
event.preventDefault();
event.stopPropagation();
function animateLoop()
{
+ if (hasCompleted)
+ return;
+
// Advance forward.
complete += intervalDuration;
var next = complete + intervalDuration;
function forceComplete()
{
- if (!hasCompleted) {
- complete = duration;
- animateLoop();
- }
+ if (hasCompleted)
+ return;
+
+ complete = duration;
+ animateLoop();
}
function cancel()