OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 this._filter.addFilters(this._filterBar); | 82 this._filter.addFilters(this._filterBar); |
83 | 83 |
84 this._viewport = new WebInspector.ViewportControl(this); | 84 this._viewport = new WebInspector.ViewportControl(this); |
85 this._viewport.setStickToBottom(true); | 85 this._viewport.setStickToBottom(true); |
86 this._viewport.contentElement().classList.add("console-group", "console-grou
p-messages"); | 86 this._viewport.contentElement().classList.add("console-group", "console-grou
p-messages"); |
87 this._contentsElement.appendChild(this._viewport.element); | 87 this._contentsElement.appendChild(this._viewport.element); |
88 this._messagesElement = this._viewport.element; | 88 this._messagesElement = this._viewport.element; |
89 this._messagesElement.id = "console-messages"; | 89 this._messagesElement.id = "console-messages"; |
90 this._messagesElement.classList.add("monospace"); | 90 this._messagesElement.classList.add("monospace"); |
91 this._messagesElement.addEventListener("click", this._messagesClicked.bind(t
his), true); | 91 this._messagesElement.addEventListener("click", this._messagesClicked.bind(t
his), true); |
92 this._scrolledToBottom = true; | |
93 | 92 |
94 this._viewportThrottler = new WebInspector.Throttler(50); | 93 this._viewportThrottler = new WebInspector.Throttler(50); |
95 | 94 |
96 this._filterStatusMessageElement = document.createElementWithClass("div", "c
onsole-message"); | 95 this._filterStatusMessageElement = document.createElementWithClass("div", "c
onsole-message"); |
97 this._messagesElement.insertBefore(this._filterStatusMessageElement, this._m
essagesElement.firstChild); | 96 this._messagesElement.insertBefore(this._filterStatusMessageElement, this._m
essagesElement.firstChild); |
98 this._filterStatusTextElement = this._filterStatusMessageElement.createChild
("span", "console-info"); | 97 this._filterStatusTextElement = this._filterStatusMessageElement.createChild
("span", "console-info"); |
99 this._filterStatusMessageElement.createTextChild(" "); | 98 this._filterStatusMessageElement.createTextChild(" "); |
100 var resetFiltersLink = this._filterStatusMessageElement.createChild("span",
"console-info node-link"); | 99 var resetFiltersLink = this._filterStatusMessageElement.createChild("span",
"console-info node-link"); |
101 resetFiltersLink.textContent = WebInspector.UIString("Show all messages."); | 100 resetFiltersLink.textContent = WebInspector.UIString("Show all messages."); |
102 resetFiltersLink.addEventListener("click", this._filter.reset.bind(this._fil
ter), true); | 101 resetFiltersLink.addEventListener("click", this._filter.reset.bind(this._fil
ter), true); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 }, | 407 }, |
409 | 408 |
410 focus: function() | 409 focus: function() |
411 { | 410 { |
412 if (this._promptElement === WebInspector.currentFocusElement()) | 411 if (this._promptElement === WebInspector.currentFocusElement()) |
413 return; | 412 return; |
414 WebInspector.setCurrentFocusElement(this._promptElement); | 413 WebInspector.setCurrentFocusElement(this._promptElement); |
415 this._prompt.moveCaretToEndOfPrompt(); | 414 this._prompt.moveCaretToEndOfPrompt(); |
416 }, | 415 }, |
417 | 416 |
418 storeScrollPositions: function() | |
419 { | |
420 WebInspector.View.prototype.storeScrollPositions.call(this); | |
421 this._scrolledToBottom = this._messagesElement.isScrolledToBottom(); | |
422 }, | |
423 | |
424 restoreScrollPositions: function() | 417 restoreScrollPositions: function() |
425 { | 418 { |
426 if (this._scrolledToBottom) | 419 if (this._viewport.scrolledToBottom()) |
427 this._immediatelyScrollIntoView(); | 420 this._immediatelyScrollToBottom(); |
428 else | 421 else |
429 WebInspector.View.prototype.restoreScrollPositions.call(this); | 422 WebInspector.View.prototype.restoreScrollPositions.call(this); |
430 }, | 423 }, |
431 | 424 |
432 onResize: function() | 425 onResize: function() |
433 { | 426 { |
434 this._scheduleViewportRefresh(); | 427 this._scheduleViewportRefresh(); |
435 this._prompt.hideSuggestBox(); | 428 this._prompt.hideSuggestBox(); |
436 this.restoreScrollPositions(); | 429 if (this._viewport.scrolledToBottom()) |
| 430 this._immediatelyScrollToBottom(); |
437 }, | 431 }, |
438 | 432 |
439 _scheduleViewportRefresh: function() | 433 _scheduleViewportRefresh: function() |
440 { | 434 { |
441 /** | 435 /** |
442 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 436 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
443 * @this {WebInspector.ConsoleView} | 437 * @this {WebInspector.ConsoleView} |
444 */ | 438 */ |
445 function invalidateViewport(finishCallback) | 439 function invalidateViewport(finishCallback) |
446 { | 440 { |
447 this._viewport.invalidate(); | 441 this._viewport.invalidate(); |
448 finishCallback(); | 442 finishCallback(); |
449 } | 443 } |
450 this._viewportThrottler.schedule(invalidateViewport.bind(this)); | 444 this._viewportThrottler.schedule(invalidateViewport.bind(this)); |
451 }, | 445 }, |
452 | 446 |
453 _immediatelyScrollIntoView: function() | 447 _immediatelyScrollToBottom: function() |
454 { | 448 { |
455 // This will scroll viewport and trigger its refresh. | 449 // This will scroll viewport and trigger its refresh. |
456 this._promptElement.scrollIntoView(true); | 450 this._promptElement.scrollIntoView(true); |
457 }, | 451 }, |
458 | 452 |
459 _updateFilterStatus: function() | 453 _updateFilterStatus: function() |
460 { | 454 { |
461 this._filterStatusTextElement.textContent = WebInspector.UIString(this._
hiddenByFilterCount === 1 ? "%d message is hidden by filters." : "%d messages ar
e hidden by filters.", this._hiddenByFilterCount); | 455 this._filterStatusTextElement.textContent = WebInspector.UIString(this._
hiddenByFilterCount === 1 ? "%d message is hidden by filters." : "%d messages ar
e hidden by filters.", this._hiddenByFilterCount); |
462 this._filterStatusMessageElement.style.display = this._hiddenByFilterCou
nt ? "" : "none"; | 456 this._filterStatusMessageElement.style.display = this._hiddenByFilterCou
nt ? "" : "none"; |
463 }, | 457 }, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 return new WebInspector.ConsoleGroupViewMessage(message, this._linki
fier, nestingLevel); | 555 return new WebInspector.ConsoleGroupViewMessage(message, this._linki
fier, nestingLevel); |
562 default: | 556 default: |
563 return new WebInspector.ConsoleViewMessage(message, this._linkifier,
nestingLevel); | 557 return new WebInspector.ConsoleViewMessage(message, this._linkifier,
nestingLevel); |
564 } | 558 } |
565 }, | 559 }, |
566 | 560 |
567 _consoleCleared: function() | 561 _consoleCleared: function() |
568 { | 562 { |
569 this._clearCurrentSearchResultHighlight(); | 563 this._clearCurrentSearchResultHighlight(); |
570 this._consoleMessages = []; | 564 this._consoleMessages = []; |
571 this._scrolledToBottom = true; | |
572 this._updateMessageList(); | 565 this._updateMessageList(); |
573 | 566 |
574 if (this._searchRegex) | 567 if (this._searchRegex) |
575 this._searchableView.updateSearchMatchesCount(0); | 568 this._searchableView.updateSearchMatchesCount(0); |
576 | 569 |
577 this._linkifier.reset(); | 570 this._linkifier.reset(); |
578 }, | 571 }, |
579 | 572 |
580 _handleContextMenuEvent: function(event) | 573 _handleContextMenuEvent: function(event) |
581 { | 574 { |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { | 1214 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
1222 /** | 1215 /** |
1223 * @return {boolean} | 1216 * @return {boolean} |
1224 */ | 1217 */ |
1225 handleAction: function() | 1218 handleAction: function() |
1226 { | 1219 { |
1227 WebInspector.console.show(); | 1220 WebInspector.console.show(); |
1228 return true; | 1221 return true; |
1229 } | 1222 } |
1230 } | 1223 } |
OLD | NEW |