Changeset 109102 in webkit


Ignore:
Timestamp:
Feb 28, 2012 6:22:06 AM (12 years ago)
Author:
yurys@chromium.org
Message:

Web Inspector: show resource dividers on memory counter graphs
https://bugs.webkit.org/show_bug.cgi?id=79782

Resource dividers are drawn on the memory counter graphs.

Reviewed by Pavel Feldman.

  • inspector/front-end/MemoryStatistics.js:

(WebInspector.MemoryStatistics.prototype.updateDividers):
(WebInspector.MemoryStatistics.prototype.setMainTimelineGrid):
(WebInspector.MemoryStatistics.prototype._updateSize):
(WebInspector.MemoryStatistics.prototype.show):
(WebInspector.MemoryStatistics.prototype.refresh):
(WebInspector.MemoryStatistics.prototype._refreshDividers):

  • inspector/front-end/TimelineGrid.js:

(WebInspector.TimelineGrid.prototype.get dividersElement):
(WebInspector.TimelineGrid.prototype.updateDividers):

  • inspector/front-end/TimelinePanel.js:

(WebInspector.TimelinePanel):
(WebInspector.TimelinePanel.prototype._timelinesOverviewModeChanged):
(WebInspector.TimelinePanel.prototype._refreshRecords):
(WebInspector.TimelinePanel.prototype.get timlinePaddingLeft):

  • inspector/front-end/timelinePanel.css:

(#memory-graphs-canvas-container):
(#memory-graphs-canvas-container .resources-dividers):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109097 r109102  
     12012-02-28  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: show resource dividers on memory counter graphs
     4        https://bugs.webkit.org/show_bug.cgi?id=79782
     5
     6        Resource dividers are drawn on the memory counter graphs.
     7
     8        Reviewed by Pavel Feldman.
     9
     10        * inspector/front-end/MemoryStatistics.js:
     11        (WebInspector.MemoryStatistics.prototype.updateDividers):
     12        (WebInspector.MemoryStatistics.prototype.setMainTimelineGrid):
     13        (WebInspector.MemoryStatistics.prototype._updateSize):
     14        (WebInspector.MemoryStatistics.prototype.show):
     15        (WebInspector.MemoryStatistics.prototype.refresh):
     16        (WebInspector.MemoryStatistics.prototype._refreshDividers):
     17        * inspector/front-end/TimelineGrid.js:
     18        (WebInspector.TimelineGrid.prototype.get dividersElement):
     19        (WebInspector.TimelineGrid.prototype.updateDividers):
     20        * inspector/front-end/TimelinePanel.js:
     21        (WebInspector.TimelinePanel):
     22        (WebInspector.TimelinePanel.prototype._timelinesOverviewModeChanged):
     23        (WebInspector.TimelinePanel.prototype._refreshRecords):
     24        (WebInspector.TimelinePanel.prototype.get timlinePaddingLeft):
     25        * inspector/front-end/timelinePanel.css:
     26        (#memory-graphs-canvas-container):
     27        (#memory-graphs-canvas-container .resources-dividers):
     28
    1292012-02-28  Nikolas Zimmermann  <nzimmermann@rim.com>
    230
  • trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js

    r108993 r109102  
    4747
    4848    this._canvasContainer = this._memorySplitView.mainElement;
     49    this._canvasContainer.id = "memory-graphs-canvas-container";
    4950    this._currentValuesBar = this._canvasContainer.createChild("div");
    5051    this._currentValuesBar.id = "counter-values-bar";
     
    5758    this._canvas.addEventListener("mouseout", this._onMouseOut.bind(this), true);
    5859    this._canvas.addEventListener("click", this._onClick.bind(this), true);
     60    // We create extra timeline grid here to reuse its event dividers.
     61    this._timelineGrid = new WebInspector.TimelineGrid();
     62    this._canvasContainer.appendChild(this._timelineGrid.dividersElement);
    5963
    6064    // Populate sidebar
     
    204208
    205209WebInspector.MemoryStatistics.prototype = {
     210    setMainTimelineGrid: function(timelineGrid)
     211    {
     212        this._mainTimelineGrid = timelineGrid;
     213    },
     214
    206215    setTopPosition: function(top)
    207216    {
     
    230239    _updateSize: function()
    231240    {
     241        var width = this._mainTimelineGrid.dividersElement.offsetWidth + 1;
     242        this._canvasContainer.style.width = width + "px";
     243
    232244        var height = this._canvasContainer.offsetHeight - this._currentValuesBar.offsetHeight;
    233         this._canvas.width = this._canvasContainer.offsetWidth;
     245        this._canvas.width = width;
    234246        this._canvas.height = height;
    235247    },
     
    385397        this._memorySplitView.show(this._timelinePanel.element, anchor);
    386398        this._updateSize();
     399        this._refreshDividers();
    387400        setTimeout(this._draw.bind(this), 0);
    388401    },
     
    391404    {
    392405        this._updateSize();
     406        this._refreshDividers();
    393407        this._draw();
    394408        this._refreshCurrentValues();
     
    398412    {
    399413        this._memorySplitView.detach();
     414    },
     415
     416    _refreshDividers: function()
     417    {
     418        this._timelineGrid.updateDividers(true, this._timelinePanel.calculator, this._timelinePanel.timelinePaddingLeft);
    400419    },
    401420
  • trunk/Source/WebCore/inspector/front-end/SidebarOverlay.js

    r109006 r109102  
    114114        if (this._resizerWidgetElement)
    115115            this.element.removeChild(this._resizerWidgetElement);
    116         element.removeEventListener("DOMFocusIn", this._boundContainingElementFocused);
     116        element.removeEventListener("DOMFocusIn", this._boundContainingElementFocused, false);
    117117    },
    118118   
  • trunk/Source/WebCore/inspector/front-end/TimelineGrid.js

    r96939 r109102  
    5959    },
    6060
     61    get dividersElement()
     62    {
     63        return this._dividersElement;
     64    },
     65
    6166    /**
    6267     * @param {number=} paddingLeft
     
    7782        var dividerLabelBar = this._dividersLabelBarElement.firstChild;
    7883
    79         var dividersLabelBarElementClientWidth = this._dividersLabelBarElement.clientWidth;
    80         var clientWidth = dividersLabelBarElementClientWidth - paddingLeft;
     84        var dividersElementClientWidth = this._dividersElement.clientWidth;
     85        var clientWidth = dividersElementClientWidth - paddingLeft;
    8186        for (var i = paddingLeft ? 0 : 1; i <= dividerCount; ++i) {
    8287            if (!divider) {
     
    9297                dividerLabelBar.appendChild(label);
    9398                this._dividersLabelBarElement.appendChild(dividerLabelBar);
    94                 dividersLabelBarElementClientWidth = this._dividersLabelBarElement.clientWidth;
    9599            }
    96100
     
    112116
    113117            var left = paddingLeft + clientWidth * (i / dividerCount);
    114             var percentLeft = 100 * left / dividersLabelBarElementClientWidth;
     118            var percentLeft = 100 * left / dividersElementClientWidth;
    115119            this._setDividerAndBarLeft(divider, dividerLabelBar, percentLeft);
    116120
  • trunk/Source/WebCore/inspector/front-end/TimelinePanel.js

    r109009 r109102  
    8080    this._itemsGraphsElement.addEventListener("mousewheel", this._overviewPane.scrollWindow.bind(this._overviewPane), true);
    8181    this._containerContentElement.appendChild(this._timelineGrid.element);
     82    if (this._memoryStatistics)
     83        this._memoryStatistics.setMainTimelineGrid(this._timelineGrid);
    8284
    8385    this._topGapElement = document.createElement("div");
     
    379381            this.splitView.element.style.height = "auto";
    380382            this.splitView.element.style.bottom = "0";
    381             this.onResize();
    382383        } else {
    383384            this._timelineMemorySplitter.removeStyleClass("hidden");
     
    386387            this._setSplitterPosition(600);
    387388        }
     389        this._refresh();
    388390    },
    389391
     
    788790        this.splitView.sidebarResizerElement.style.height = this.sidebarElement.clientHeight + "px";
    789791        // Reserve some room for expand / collapse controls to the left for records that start at 0ms.
    790         var timelinePaddingLeft = this._calculator.windowLeft === 0 ? this._expandOffset : 0;
    791792        if (updateBoundaries)
    792             this._timelineGrid.updateDividers(true, this._calculator, timelinePaddingLeft);
     793            this._timelineGrid.updateDividers(true, this._calculator, this.timelinePaddingLeft);
    793794        this._adjustScrollPosition((recordsInWindow.length + 1) * rowHeight);
     795    },
     796
     797    get timelinePaddingLeft()
     798    {
     799        return this._calculator.windowLeft === 0 ? this._expandOffset : 0;
    794800    },
    795801
  • trunk/Source/WebCore/inspector/front-end/timelinePanel.css

    r109009 r109102  
    560560}
    561561
     562#memory-graphs-canvas-container {
     563    border-right: 1px solid #AAA;
     564}
     565
     566#memory-graphs-canvas-container .resources-dividers {
     567    top: 15px;
     568}
     569
    562570#memory-graphs-container .split-view-contents {
    563571    overflow: hidden;
Note: See TracChangeset for help on using the changeset viewer.