Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (271235 => 271236)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-01-07 16:36:44 UTC (rev 271236)
@@ -1,3 +1,43 @@
+2021-01-07 Patrick Angle <[email protected]>
+
+ 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.
+
2020-12-10 Patrick Angle <[email protected]>
Web Inspector: Show current properties for font in new Elements sidebar Font panel
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (271235 => 271236)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2021-01-07 16:36:44 UTC (rev 271236)
@@ -291,6 +291,8 @@
localizedStrings["Classes"] = "Classes";
localizedStrings["Clear Cookies"] = "Clear Cookies";
localizedStrings["Clear Filters"] = "Clear Filters";
+/* Text for button that will clear both text filters and time range filters. */
+localizedStrings["Clear Filters @ Heap Allocations Timeline View"] = "Clear Filters";
localizedStrings["Clear Local Storage"] = "Clear Local Storage";
localizedStrings["Clear Log"] = "Clear Log";
localizedStrings["Clear Network Items (%s)"] = "Clear Network Items (%s)";
@@ -468,6 +470,8 @@
localizedStrings["Discretionary @ Font Details Sidebar Property Value"] = "Discretionary";
localizedStrings["Disk Cache"] = "Disk Cache";
localizedStrings["Dismiss"] = "Dismiss";
+/* Tooltip for the dismiss button in banner views. */
+localizedStrings["Dismiss @ Banner View"] = "Dismiss";
localizedStrings["Displayed Columns"] = "Displayed Columns";
localizedStrings["Do not clear network items on new page loads"] = "Do not clear network items on new page loads";
localizedStrings["Do not clear the console on new page loads"] = "Do not clear the console on new page loads";
@@ -1434,6 +1438,8 @@
localizedStrings["The contents and enabled state will be preserved across Web Inspector sessions."] = "The contents and enabled state will be preserved across Web Inspector sessions.";
localizedStrings["The page's content has changed"] = "The page's content has changed";
localizedStrings["The resource was requested insecurely."] = "The resource was requested insecurely.";
+/* Message displayed in a banner when one or more snapshots that the user has not yet seen are being filtered. */
+localizedStrings["There are new snapshots that have been filtered @ Heap Allocations Timeline View"] = "There are new snapshots that have been filtered";
localizedStrings["There are unread messages that have been filtered"] = "There are unread messages that have been filtered";
localizedStrings["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.";
localizedStrings["These are all of the different test result levels."] = "These are all of the different test result levels.";
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (271235 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2021-01-07 16:36:44 UTC (rev 271236)
@@ -39,6 +39,7 @@
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
+ <link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
@@ -615,6 +616,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Copied: trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.css (from rev 271235, trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css) (0 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.css 2021-01-07 16:36:44 UTC (rev 271236)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.banner-view {
+ display: flex;
+ flex-shrink: 0;
+ justify-content: center;
+ align-items: center;
+ position: relative;
+ height: var(--navigation-bar-height);
+ padding: 0 4px;
+ color: var(--yellow-highlight-text-color);
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ background-color: var(--yellow-highlight-background-color);
+ border-bottom: 1px solid var(--border-color);
+}
+
+.banner-view > button {
+ margin-inline-start: 4px;
+}
+
+.banner-view > .dismiss {
+ position: absolute;
+ inset-inline-end: 5px;
+ width: 16px;
+ height: 16px;
+ padding-bottom: 2px;
+}
\ No newline at end of file
Added: trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.js (0 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BannerView.js 2021-01-07 16:36:44 UTC (rev 271236)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WI.BannerView = class BannerView extends WI.View
+{
+ constructor(message, {actionButtonMessage, showDismissButton} = {})
+ {
+ super();
+
+ this.element.classList.add("banner-view");
+ this.element.appendChild(document.createTextNode(message));
+
+ if (actionButtonMessage) {
+ let actionButtonElement = this.element.appendChild(document.createElement("button"));
+ actionButtonElement.textContent = actionButtonMessage;
+ actionButtonElement.addEventListener("click", this._handleActionButtonClicked.bind(this));
+ }
+
+ if (showDismissButton) {
+ let dismissButtonElement = this.element.appendChild(WI.ImageUtilities.useSVGSymbol("Images/Close.svg", "dismiss", WI.UIString("Dismiss", "Dismiss @ Banner View", "Tooltip for the dismiss button in banner views.")));
+ dismissButtonElement.addEventListener("click", this._handleDismissButtonClicked.bind(this));
+ }
+ }
+
+ // Private
+
+ _handleActionButtonClicked(event)
+ {
+ this.dispatchEventToListeners(WI.BannerView.Event.ActionButtonClicked);
+ }
+
+ _handleDismissButtonClicked(event)
+ {
+ this.dispatchEventToListeners(WI.BannerView.Event.DismissButtonClicked);
+ }
+};
+
+WI.BannerView.Event = {
+ ActionButtonClicked: "banner-view-action-button-clicked",
+ DismissButtonClicked: "banner-view-dismiss-button-clicked",
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css (271235 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css 2021-01-07 16:36:44 UTC (rev 271236)
@@ -31,6 +31,10 @@
bottom: 0;
}
+.timeline-view.heap-allocations > .banner-view + .data-grid {
+ top: var(--navigation-bar-height);
+}
+
.timeline-view.heap-allocations > .data-grid td .icon.heap-snapshot {
content: url(../Images/TypeIcons.svg#HeapSnapshot-light);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js (271235 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js 2021-01-07 16:36:44 UTC (rev 271236)
@@ -88,6 +88,14 @@
this._snapshotListPathComponent = new WI.HierarchicalPathComponent(WI.UIString("Snapshot List"), "snapshot-list-icon", "snapshot-list", false, false);
this._snapshotListPathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._snapshotListPathComponentClicked, this);
+ this._unseenRecords = [];
+ 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."), {
+ actionButtonMessage: WI.UIString("Clear Filters", "Clear Filters @ Heap Allocations Timeline View", "Text for button that will clear both text filters and time range filters."),
+ showDismissButton: true,
+ });
+ this._unseenRecordsBannerView.addEventListener(WI.BannerView.Event.ActionButtonClicked, this._handleUnseenRecordsBannerClearFiltersClicked, this);
+ this._unseenRecordsBannerView.addEventListener(WI.BannerView.Event.DismissButtonClicked, this._handleUnseenRecordsBannerDismissClicked, this);
+
this._dataGrid = new WI.TimelineDataGrid(columns);
this._dataGrid.sortColumnIdentifier = "timestamp";
this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
@@ -248,13 +256,17 @@
return;
for (let heapAllocationsTimelineRecord of this._pendingRecords) {
- this._dataGrid.addRowInSortOrder(new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, {
+ let dataGridNode = new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, {
graphDataSource: this,
heapAllocationsView: this,
- }));
+ });
+ this._dataGrid.addRowInSortOrder(dataGridNode);
+ if (dataGridNode.hidden)
+ this._unseenRecords.push(dataGridNode);
}
this._pendingRecords = [];
+ this._updateUnseenRecordsBannerView();
this._updateCompareHeapSnapshotButton();
}
@@ -266,6 +278,8 @@
this.showHeapSnapshotList();
this._pendingRecords = [];
+ this._unseenRecords = [];
+ this._updateUnseenRecordsBannerView();
this._updateCompareHeapSnapshotButton();
}
@@ -280,6 +294,13 @@
this._contentViewContainer.currentContentView.updateFilter(filters);
}
+ filterDidChange()
+ {
+ super.filterDidChange();
+
+ this._updateUnseenRecordsBannerView();
+ }
+
// Private
_heapAllocationsTimelineRecordAdded(event)
@@ -367,6 +388,18 @@
this._compareHeapSnapshotsButtonItem.enabled = hasAtLeastTwoValidSnapshots;
}
+ _updateUnseenRecordsBannerView()
+ {
+ this._unseenRecords = this._unseenRecords.filter((record) => record.hidden);
+ if (this._unseenRecords.length) {
+ if (this._unseenRecordsBannerView.parentView !== this)
+ this.insertSubviewBefore(this._unseenRecordsBannerView, this._dataGrid);
+ } else {
+ if (this._unseenRecordsBannerView.parentView === this)
+ this.removeSubview(this._unseenRecordsBannerView);
+ }
+ }
+
_importButtonNavigationItemClicked()
{
WI.FileUtilities.importText((result) => {
@@ -477,4 +510,16 @@
this._selectingComparisonHeapSnapshots = false;
this._compareHeapSnapshotsButtonItem.activated = false;
}
+
+ _handleUnseenRecordsBannerClearFiltersClicked(event)
+ {
+ this.dispatchEventToListeners(WI.TimelineView.Event.NeedsFiltersCleared);
+ this.dispatchEventToListeners(WI.TimelineView.Event.NeedsEntireSelectedRange);
+ }
+
+ _handleUnseenRecordsBannerDismissClicked(event)
+ {
+ this._unseenRecords = [];
+ this._updateUnseenRecordsBannerView();
+ }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (271235 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js 2021-01-07 16:36:44 UTC (rev 271236)
@@ -114,7 +114,9 @@
WI.TimelineView.addEventListener(WI.TimelineView.Event.ScannerShow, this._handleTimelineViewScannerShow, this);
WI.TimelineView.addEventListener(WI.TimelineView.Event.ScannerHide, this._handleTimelineViewScannerHide, this);
WI.TimelineView.addEventListener(WI.TimelineView.Event.NeedsEntireSelectedRange, this._handleTimelineViewNeedsEntireSelectedRange, this);
+ WI.TimelineView.addEventListener(WI.TimelineView.Event.NeedsFiltersCleared, this._handleTimelineViewNeedsFiltersCleared, this);
+
WI.notifications.addEventListener(WI.Notification.VisibilityStateDidChange, this._inspectorVisibilityStateChanged, this);
for (let instrument of this._recording.instruments)
@@ -970,6 +972,14 @@
this._timelineOverview.timelineRuler.selectEntireRange();
}
+ _handleTimelineViewNeedsFiltersCleared(event)
+ {
+ if (!this.isAttached)
+ return;
+
+ this._filterBarNavigationItem.filterBar.clear();
+ }
+
_updateProgressView()
{
let isCapturing = WI.timelineManager.isCapturing();
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js (271235 => 271236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js 2021-01-07 15:58:37 UTC (rev 271235)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js 2021-01-07 16:36:44 UTC (rev 271236)
@@ -337,4 +337,5 @@
ScannerShow: "timeline-view-scanner-show",
ScannerHide: "timeline-view-scanner-hide",
NeedsEntireSelectedRange: "timeline-view-needs-entire-selected-range",
+ NeedsFiltersCleared: "timeline-view-needs-filters-cleared",
};