Changeset 271236 in webkit


Ignore:
Timestamp:
Jan 7, 2021 8:36:44 AM (19 months ago)
Author:
Patrick Angle
Message:

Web Inspector: console.takeHeapSnapshot() appears to have no effect
https://bugs.webkit.org/show_bug.cgi?id=219987

Reviewed by Devin Rousso.

Added a banner that appears above the snapshots data grid when there are new (unseen) snapshots that are being
filtered by either the selected time range or filter text.

  • Localizations/en.lproj/localizedStrings.js:
  • UserInterface/Main.html:
  • UserInterface/Views/BannerView.css: Added.

(.banner-view):
(.banner-view > button):
(.banner-view > .dismiss):

  • UserInterface/Views/BannerView.js: Added.

(WI.BannerView.prototype._handleActionButtonClicked):
(WI.BannerView.prototype._handleDismissButtonClicked):
(WI.BannerView):

  • Added WI.BannerView to handle layout and styling of banners.
  • UserInterface/Views/HeapAllocationsTimelineView.css:

(.timeline-view.heap-allocations > .banner-view + .data-grid):

  • UserInterface/Views/HeapAllocationsTimelineView.js:

(WI.HeapAllocationsTimelineView):
(WI.HeapAllocationsTimelineView.prototype.layout):

  • Take note of any new records that are immediately hidden.

(WI.HeapAllocationsTimelineView.prototype.reset):
(WI.HeapAllocationsTimelineView.prototype.filterDidChange):
(WI.HeapAllocationsTimelineView.prototype._updateUnseenRecordsBannerView):

  • Check that unseen messages are still hidden and add/remove the banner as appropriate.

(WI.HeapAllocationsTimelineView.prototype._handleUnseenRecordsBannerClearFiltersClicked):
(WI.HeapAllocationsTimelineView.prototype._handleUnseenRecordsBannerDismissClicked):

  • UserInterface/Views/TimelineRecordingContentView.js:

(WI.TimelineRecordingContentView):
(WI.TimelineRecordingContentView.prototype._handleTimelineViewNeedsFiltersCleared):

  • Handle the WI.TimelineView.Event.NeedsFiltersCleared event.
  • UserInterface/Views/TimelineView.js:
  • Added WI.TimelineView.Event.NeedsFiltersCleared event.
Location:
trunk/Source/WebInspectorUI
Files:
1 added
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r270637 r271236  
     12021-01-07  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: console.takeHeapSnapshot() appears to have no effect
     4        https://bugs.webkit.org/show_bug.cgi?id=219987
     5
     6        Reviewed by Devin Rousso.
     7
     8        Added a banner that appears above the snapshots data grid when there are new (unseen) snapshots that are being
     9        filtered by either the selected time range or filter text.
     10
     11        * Localizations/en.lproj/localizedStrings.js:
     12        * UserInterface/Main.html:
     13        * UserInterface/Views/BannerView.css: Added.
     14        (.banner-view):
     15        (.banner-view > button):
     16        (.banner-view > .dismiss):
     17        * UserInterface/Views/BannerView.js: Added.
     18        (WI.BannerView.prototype._handleActionButtonClicked):
     19        (WI.BannerView.prototype._handleDismissButtonClicked):
     20        (WI.BannerView):
     21        - Added `WI.BannerView` to handle layout and styling of banners.
     22        * UserInterface/Views/HeapAllocationsTimelineView.css:
     23        (.timeline-view.heap-allocations > .banner-view + .data-grid):
     24        * UserInterface/Views/HeapAllocationsTimelineView.js:
     25        (WI.HeapAllocationsTimelineView):
     26        (WI.HeapAllocationsTimelineView.prototype.layout):
     27        - Take note of any new records that are immediately hidden.
     28        (WI.HeapAllocationsTimelineView.prototype.reset):
     29        (WI.HeapAllocationsTimelineView.prototype.filterDidChange):
     30        (WI.HeapAllocationsTimelineView.prototype._updateUnseenRecordsBannerView):
     31        - Check that unseen messages are still hidden and add/remove the banner as appropriate.
     32        (WI.HeapAllocationsTimelineView.prototype._handleUnseenRecordsBannerClearFiltersClicked):
     33        (WI.HeapAllocationsTimelineView.prototype._handleUnseenRecordsBannerDismissClicked):
     34        * UserInterface/Views/TimelineRecordingContentView.js:
     35        (WI.TimelineRecordingContentView):
     36        (WI.TimelineRecordingContentView.prototype._handleTimelineViewNeedsFiltersCleared):
     37        - Handle the `WI.TimelineView.Event.NeedsFiltersCleared` event.
     38        * UserInterface/Views/TimelineView.js:
     39        - Added `WI.TimelineView.Event.NeedsFiltersCleared` event.
     40
    1412020-12-10  Patrick Angle  <pangle@apple.com>
    242
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r270637 r271236  
    292292localizedStrings["Clear Cookies"] = "Clear Cookies";
    293293localizedStrings["Clear Filters"] = "Clear Filters";
     294/* Text for button that will clear both text filters and time range filters. */
     295localizedStrings["Clear Filters @ Heap Allocations Timeline View"] = "Clear Filters";
    294296localizedStrings["Clear Local Storage"] = "Clear Local Storage";
    295297localizedStrings["Clear Log"] = "Clear Log";
     
    469471localizedStrings["Disk Cache"] = "Disk Cache";
    470472localizedStrings["Dismiss"] = "Dismiss";
     473/* Tooltip for the dismiss button in banner views. */
     474localizedStrings["Dismiss @ Banner View"] = "Dismiss";
    471475localizedStrings["Displayed Columns"] = "Displayed Columns";
    472476localizedStrings["Do not clear network items on new page loads"] = "Do not clear network items on new page loads";
     
    14351439localizedStrings["The page's content has changed"] = "The page's content has changed";
    14361440localizedStrings["The resource was requested insecurely."] = "The resource was requested insecurely.";
     1441/* Message displayed in a banner when one or more snapshots that the user has not yet seen are being filtered. */
     1442localizedStrings["There are new snapshots that have been filtered @ Heap Allocations Timeline View"] = "There are new snapshots that have been filtered";
    14371443localizedStrings["There are unread messages that have been filtered"] = "There are unread messages that have been filtered";
    14381444localizedStrings["There is an incurred energy penalty each time the page enters script. This commonly happens with timers, event handlers, and observers."] = "There is an incurred energy penalty each time the page enters script. This commonly happens with timers, event handlers, and observers.";
  • trunk/Source/WebInspectorUI/UserInterface/Main.html

    r270637 r271236  
    4040    <link rel="stylesheet" href="Views/AuditTestGroupContentView.css">
    4141    <link rel="stylesheet" href="Views/AuditTreeElement.css">
     42    <link rel="stylesheet" href="Views/BannerView.css">
    4243    <link rel="stylesheet" href="Views/BezierEditor.css">
    4344    <link rel="stylesheet" href="Views/BlackboxSettingsView.css">
     
    616617    <script src="Views/AuditTestGroupContentView.js"></script>
    617618    <script src="Views/AuditTreeElement.js"></script>
     619    <script src="Views/BannerView.js"></script>
    618620    <script src="Views/BezierEditor.js"></script>
    619621    <script src="Views/BlackboxSettingsView.js"></script>
  • trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.css

    r271235 r271236  
    11/*
    2  * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 .timeline-view.heap-allocations > .data-grid {
    27     position: absolute;
    28     top: 0;
    29     left: 0;
    30     right: 0;
    31     bottom: 0;
     26.banner-view {
     27    display: flex;
     28    flex-shrink: 0;
     29    justify-content: center;
     30    align-items: center;
     31    position: relative;
     32    height: var(--navigation-bar-height);
     33    padding: 0 4px;
     34    color: var(--yellow-highlight-text-color);
     35    white-space: nowrap;
     36    text-overflow: ellipsis;
     37    overflow: hidden;
     38    background-color: var(--yellow-highlight-background-color);
     39    border-bottom: 1px solid var(--border-color);
    3240}
    3341
    34 .timeline-view.heap-allocations > .data-grid td .icon.heap-snapshot {
    35     content: url(../Images/TypeIcons.svg#HeapSnapshot-light);
     42.banner-view > button {
     43    margin-inline-start: 4px;
    3644}
    3745
    38 .timeline-view.heap-allocations > .data-grid tr.invalid {
    39     color: gray;
     46.banner-view > .dismiss {
     47    position: absolute;
     48    inset-inline-end: 5px;
     49    width: 16px;
     50    height: 16px;
     51    padding-bottom: 2px;
    4052}
    41 
    42 .timeline-view.heap-allocations > .data-grid:not(:focus) tr.selected.invalid {
    43     color: gray !important;
    44 }
    45 
    46 .timeline-view.heap-allocations > .data-grid tr.baseline {
    47     background: hsl(129, 29%, 77%);
    48 }
    49 
    50 .timeline-view.heap-allocations > .content-view-container {
    51     position: absolute;
    52     top: 0;
    53     bottom: 0;
    54     left: 0;
    55     right: 0;
    56 }
    57 
    58 @media (prefers-color-scheme: dark) {
    59     .timeline-view.heap-allocations > .data-grid td .icon.heap-snapshot {
    60         content: url(../Images/TypeIcons.svg#HeapSnapshot-dark);
    61     }
    62 }
  • trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css

    r256774 r271236  
    3232}
    3333
     34.timeline-view.heap-allocations > .banner-view + .data-grid {
     35    top: var(--navigation-bar-height);
     36}
     37
    3438.timeline-view.heap-allocations > .data-grid td .icon.heap-snapshot {
    3539    content: url(../Images/TypeIcons.svg#HeapSnapshot-light);
  • trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js

    r270134 r271236  
    8989        this._snapshotListPathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._snapshotListPathComponentClicked, this);
    9090
     91        this._unseenRecords = [];
     92        this._unseenRecordsBannerView = new WI.BannerView(WI.UIString("There are new snapshots that have been filtered", "There are new snapshots that have been filtered @ Heap Allocations Timeline View", "Message displayed in a banner when one or more snapshots that the user has not yet seen are being filtered."), {
     93            actionButtonMessage: WI.UIString("Clear Filters", "Clear Filters @ Heap Allocations Timeline View", "Text for button that will clear both text filters and time range filters."),
     94            showDismissButton: true,
     95        });
     96        this._unseenRecordsBannerView.addEventListener(WI.BannerView.Event.ActionButtonClicked, this._handleUnseenRecordsBannerClearFiltersClicked, this);
     97        this._unseenRecordsBannerView.addEventListener(WI.BannerView.Event.DismissButtonClicked, this._handleUnseenRecordsBannerDismissClicked, this);
     98
    9199        this._dataGrid = new WI.TimelineDataGrid(columns);
    92100        this._dataGrid.sortColumnIdentifier = "timestamp";
     
    249257
    250258        for (let heapAllocationsTimelineRecord of this._pendingRecords) {
    251             this._dataGrid.addRowInSortOrder(new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, {
     259            let dataGridNode = new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, {
    252260                graphDataSource: this,
    253261                heapAllocationsView: this,
    254             }));
     262            });
     263            this._dataGrid.addRowInSortOrder(dataGridNode);
     264            if (dataGridNode.hidden)
     265                this._unseenRecords.push(dataGridNode);
    255266        }
    256267
    257268        this._pendingRecords = [];
     269        this._updateUnseenRecordsBannerView();
    258270        this._updateCompareHeapSnapshotButton();
    259271    }
     
    267279        this.showHeapSnapshotList();
    268280        this._pendingRecords = [];
     281        this._unseenRecords = [];
     282        this._updateUnseenRecordsBannerView();
    269283        this._updateCompareHeapSnapshotButton();
    270284    }
     
    279293        console.assert(this._contentViewContainer.currentContentView);
    280294        this._contentViewContainer.currentContentView.updateFilter(filters);
     295    }
     296
     297    filterDidChange()
     298    {
     299        super.filterDidChange();
     300
     301        this._updateUnseenRecordsBannerView();
    281302    }
    282303
     
    366387
    367388        this._compareHeapSnapshotsButtonItem.enabled = hasAtLeastTwoValidSnapshots;
     389    }
     390
     391    _updateUnseenRecordsBannerView()
     392    {
     393        this._unseenRecords = this._unseenRecords.filter((record) => record.hidden);
     394        if (this._unseenRecords.length) {
     395            if (this._unseenRecordsBannerView.parentView !== this)
     396                this.insertSubviewBefore(this._unseenRecordsBannerView, this._dataGrid);
     397        } else {
     398            if (this._unseenRecordsBannerView.parentView === this)
     399                this.removeSubview(this._unseenRecordsBannerView);
     400        }
    368401    }
    369402
     
    478511        this._compareHeapSnapshotsButtonItem.activated = false;
    479512    }
     513
     514    _handleUnseenRecordsBannerClearFiltersClicked(event)
     515    {
     516        this.dispatchEventToListeners(WI.TimelineView.Event.NeedsFiltersCleared);
     517        this.dispatchEventToListeners(WI.TimelineView.Event.NeedsEntireSelectedRange);
     518    }
     519
     520    _handleUnseenRecordsBannerDismissClicked(event)
     521    {
     522        this._unseenRecords = [];
     523        this._updateUnseenRecordsBannerView();
     524    }
    480525};
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js

    r270134 r271236  
    115115        WI.TimelineView.addEventListener(WI.TimelineView.Event.ScannerHide, this._handleTimelineViewScannerHide, this);
    116116        WI.TimelineView.addEventListener(WI.TimelineView.Event.NeedsEntireSelectedRange, this._handleTimelineViewNeedsEntireSelectedRange, this);
     117        WI.TimelineView.addEventListener(WI.TimelineView.Event.NeedsFiltersCleared, this._handleTimelineViewNeedsFiltersCleared, this);
     118
    117119
    118120        WI.notifications.addEventListener(WI.Notification.VisibilityStateDidChange, this._inspectorVisibilityStateChanged, this);
     
    971973    }
    972974
     975    _handleTimelineViewNeedsFiltersCleared(event)
     976    {
     977        if (!this.isAttached)
     978            return;
     979
     980        this._filterBarNavigationItem.filterBar.clear();
     981    }
     982
    973983    _updateProgressView()
    974984    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js

    r270134 r271236  
    338338    ScannerHide: "timeline-view-scanner-hide",
    339339    NeedsEntireSelectedRange: "timeline-view-needs-entire-selected-range",
     340    NeedsFiltersCleared: "timeline-view-needs-filters-cleared",
    340341};
Note: See TracChangeset for help on using the changeset viewer.