Diff
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog 2016-05-19 08:40:00 UTC (rev 201134)
@@ -1,5 +1,66 @@
2016-05-19 Babak Shafiei <[email protected]>
+ Merge r200767. rdar://problem/26231245
+
+ 2016-05-12 Matt Baker <[email protected]>
+
+ Web Inspector: Improve snapshot selection in heap allocations overview graph
+ https://bugs.webkit.org/show_bug.cgi?id=157588
+ <rdar://problem/26231245>
+
+ Reviewed by Joseph Pecoraro.
+
+ Heap snapshot icon selection now uses the built-in record selection
+ behavior provided by TimelineOverview/TimelineOverviewGraph. The marker
+ representing the selected heap snapshot now has a "selected" style, and
+ clicking an icon when the HeapAllocationsTimeline is not selected causes
+ the timeline to become selected.
+
+ * UserInterface/Images/HeapSnapshotSelected.svg: Added.
+ New art for selected snapshot icon.
+
+ * UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css:
+ (.timeline-overview-graph.heap-allocations > img.snapshot.selected):
+ (.timeline-overview-graph.heap-allocations:not(.selected) > img.snapshot.selected):
+ Selected icon styles for selected/unselected overview graph.
+
+ * UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js:
+ (WebInspector.HeapAllocationsTimelineOverviewGraph):
+ Track selected image element.
+
+ (WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.layout):
+ Associate image elements with their snapshot record, and reuse image
+ elements between layouts. Image element click handler can just set the
+ selectedRecord in the TimelineOverviewGraph base class.
+
+ (WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.updateSelectedRecord):
+ (WebInspector.HeapAllocationsTimelineOverviewGraph.prototype._updateSnapshotMarkers):
+ Refresh snapshot icon styles when selected record changes.
+
+ * UserInterface/Views/HeapAllocationsTimelineView.js:
+ (WebInspector.HeapAllocationsTimelineView.prototype.selectRecord):
+ Show snapshot list if no record selected.
+ (WebInspector.HeapAllocationsTimelineView.prototype.userSelectedRecordFromOverview): Deleted.
+ No longer needed.
+
+ * UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
+ (WebInspector.RenderingFrameTimelineOverviewGraph.prototype._updateFrameMarker):
+ No need to call dispatchSelectedRecordChangedEvent manually anymore,
+ method has been removed from base class.
+
+ * UserInterface/Views/TimelineOverviewGraph.js:
+ (WebInspector.TimelineOverviewGraph.prototype._needsSelectedRecordLayout):
+ (WebInspector.TimelineOverviewGraph):
+ (WebInspector.TimelineOverviewGraph.prototype.dispatchSelectedRecordChangedEvent): Deleted.
+ No longer needed. Event dispatched automatically by the rAF callback.
+
+ * UserInterface/Views/TimelineRecordingContentView.js:
+ (WebInspector.TimelineRecordingContentView.prototype._recordSelected):
+ Allow switching to another timeline, if the selected record does not
+ belong to the current timeline.
+
+2016-05-19 Babak Shafiei <[email protected]>
+
Merge r200716. rdar://problem/26232856
2016-05-11 Matt Baker <[email protected]>
Added: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Images/HeapSnapshotSelected.svg (0 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Images/HeapSnapshotSelected.svg (rev 0)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Images/HeapSnapshotSelected.svg 2016-05-19 08:40:00 UTC (rev 201134)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2016 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
+ <path fill="hsl(212, 92%, 54%)" d="M 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 L 3 1 Z M 3 1"/>
+ <path fill="hsl(212, 92%, 54%)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 M 13 2 C 13.550781 2 14 2.449219 14 3 L 14 13 C 14 13.550781 13.550781 14 13 14 L 3 14 C 2.449219 14 2 13.550781 2 13 L 2 3 C 2 2.449219 2.449219 2 3 2 L 13 2"/>
+ <path fill="hsl(212, 92%, 54%)" d="M 5.19849793 12.6584609 C 5.2831472 12.676395 6.98277851 12.9487305 7.62939453 12.9487305 C 8.79640591 12.9487305 9.76331344 12.6806542 10.5034462 12.1146703 C 11.3037555 11.5026691 11.7177734 10.6286312 11.7177734 9.58544922 C 11.7177734 8.84534902 11.4998181 8.18341061 11.0628295 7.63852362 C 10.6767371 7.15709971 10.0557113 6.69185669 9.18734192 6.20492057 L 8.61524891 5.88648574 C 8.27558142 5.69523066 8.15431716 5.69238281 8.23632812 5.69238281 C 8.56703836 5.69238281 9.10333246 5.81936052 9.8138795 6.08542439 L 11.1645508 6.59118236 L 11.1645508 5.14892578 L 11.1645508 3.87597656 L 11.1645508 3.07965768 L 10.3884483 2.90136387 C 9.52406853 2.70279014 8.73593121 2.60205078 8.02148438 2.60205078 C 7.01081351 2.60205078 6.14909735 2.87110984 5.47554965 3.42697448 C 4.76046595 4.01711791 4.38964844 4.82767811 4.38964844 5.77734375 C 4.38964844 6.49239045 4.61205052 7.14196725 5.04920932 7.68841575 C 5.43639142 8.1723
9338 6.03437082 8.62885808 6.84888633 9.08727887 L 7.38545082 9.38538774 C 7.71699471 9.57330366 7.92926232 9.72631865 7.99164827 9.79813503 C 7.94460492 9.81851991 7.82252674 9.85302734 7.60253906 9.85302734 C 7.14294036 9.85302734 6.53493744 9.70437137 5.79174704 9.39341305 L 4.40576172 8.81350287 L 4.40576172 10.315918 L 4.40576172 11.6801758 L 4.40576172 12.4905083 L 5.19849793 12.6584609 C 5.52713094 12.7280865 5.52713094 12.7280865 5.57407851 12.738033 L 5.19849793 12.6584609 Z M 5.19849793 12.6584609"/>
+ <path fill="white" d="M 5.40576172 11.6801758 L 5.40576172 10.315918 C 6.26156027 10.6739927 6.99381206 10.8530273 7.60253906 10.8530273 C 8.02864796 10.8530273 8.36433797 10.758139 8.60961914 10.5683594 C 8.85490031 10.3785798 8.97753906 10.1207699 8.97753906 9.79492188 C 8.97753906 9.53710809 8.90055416 9.31958096 8.74658203 9.14233398 C 8.59260991 8.965087 8.3007834 8.75472127 7.87109375 8.51123047 L 7.33935547 8.21582031 C 6.6267868 7.81477664 6.12369938 7.43074728 5.83007812 7.0637207 C 5.53645687 6.69669413 5.38964844 6.2679061 5.38964844 5.77734375 C 5.38964844 5.12206704 5.63045007 4.59570511 6.11206055 4.19824219 C 6.59367103 3.80077926 7.23013927 3.60205078 8.02148438 3.60205078 C 8.65527661 3.60205078 9.36962493 3.69335846 10.1645508 3.87597656 L 10.1645508 5.14892578 C 9.3517212 4.84456228 8.70898674 4.69238281 8.23632812 4.69238281 C 7.87109192 4.69238281 7.57837024 4.77384359 7.3581543 4.93676758 C 7.13793835 5.09969157 7.02783203 5.313638
7.02783203 5.57861328 C 7.02783203 5.79703885 7.10481694 5.98860595 7.25878906 6.15332031 C 7.41276119 6.31803468 7.70279735 6.52034385 8.12890625 6.76025391 L 8.69824219 7.07714844 C 9.46452206 7.50683809 9.99267433 7.9025047 10.2827148 8.26416016 C 10.5727554 8.62581561 10.7177734 9.06624089 10.7177734 9.58544922 C 10.7177734 10.3230831 10.4438504 10.9013651 9.89599609 11.3203125 C 9.34814179 11.7392599 8.59261549 11.9487305 7.62939453 11.9487305 C 6.99202155 11.9487305 6.25081803 11.8592131 5.40576172 11.6801758 C 5.40576172 11.6801758 6.25081803 11.8592131 5.40576172 11.6801758 L 5.40576172 11.6801758 L 5.40576172 11.6801758 Z M 5.40576172 11.6801758"/>
+</svg>
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css 2016-05-19 08:40:00 UTC (rev 201134)
@@ -34,3 +34,11 @@
width: 16px;
height: 16px;
}
+
+.timeline-overview-graph.heap-allocations > img.snapshot.selected {
+ content: url(../Images/HeapSnapshotSelected.svg);
+}
+
+.timeline-overview-graph.heap-allocations:not(.selected) > img.snapshot.selected {
+ filter: grayscale(100%) brightness(1.3);
+}
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js 2016-05-19 08:40:00 UTC (rev 201134)
@@ -34,6 +34,8 @@
this._heapAllocationsTimeline = timeline;
this._heapAllocationsTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._heapAllocationTimelineRecordAdded, this);
+ this._selectedImageElement = null;
+
this.reset();
}
@@ -52,6 +54,7 @@
return;
this.element.removeChildren();
+ this._selectedImageElement = null;
// This may display records past the current time marker.
let visibleRecords = this._visibleRecords(this.startTime, this.endTime);
@@ -71,17 +74,46 @@
if (x <= 1)
x = 1;
- let imageElement = this.element.appendChild(document.createElement("img"));
- imageElement.classList.add("snapshot");
+ let imageElement = record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
+ if (!imageElement) {
+ imageElement = document.createElement("img");
+ imageElement.classList.add("snapshot");
+ imageElement.addEventListener("click", () => { this.selectedRecord = record; });
+ record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol] = imageElement;
+ }
+
imageElement.style.left = x + "px";
- imageElement.addEventListener("click", (event) => {
- this.timelineOverview.userSelectedRecord(record);
- });
+
+ this.element.appendChild(imageElement);
}
+
+ this._updateSnapshotMarkers();
}
+ updateSelectedRecord()
+ {
+ this._updateSnapshotMarkers();
+ }
+
// Private
+ _updateSnapshotMarkers()
+ {
+ if (this._selectedImageElement)
+ this._selectedImageElement.classList.remove("selected");
+
+ if (!this.selectedRecord) {
+ this._selectedImageElement = null;
+ return;
+ }
+
+ let imageElement = this.selectedRecord[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
+ console.assert(imageElement, "Missing snapshot image element for selected record", this.selectedRecord);
+ imageElement.classList.add("selected");
+
+ this._selectedImageElement = imageElement;
+ }
+
_visibleRecords(startTime, endTime)
{
let records = this._heapAllocationsTimeline.records;
@@ -95,3 +127,5 @@
this.needsLayout();
}
};
+
+WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol = Symbol("record-element-association");
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js 2016-05-19 08:40:00 UTC (rev 201134)
@@ -191,9 +191,12 @@
return components.concat(this._contentViewContainer.currentContentView.selectionPathComponents);
}
- userSelectedRecordFromOverview(timelineRecord)
+ selectRecord(record)
{
- this.showHeapSnapshotTimelineRecord(timelineRecord);
+ if (record)
+ this.showHeapSnapshotTimelineRecord(record);
+ else
+ this.showHeapSnapshotList();
}
shown()
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js 2016-05-19 08:40:00 UTC (rev 201134)
@@ -219,8 +219,6 @@
if (!this.selectedRecord) {
if (this._selectedFrameMarker.parentElement)
this.element.removeChild(this._selectedFrameMarker);
-
- this.dispatchSelectedRecordChangedEvent();
return;
}
@@ -244,8 +242,6 @@
this._selectedTimelineRecordFrame = this._timelineRecordFrames[index];
this._selectedTimelineRecordFrame.selected = true;
-
- this.dispatchSelectedRecordChangedEvent();
}
_mouseClicked(event)
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js 2016-05-19 08:40:00 UTC (rev 201134)
@@ -226,16 +226,6 @@
// Protected
- dispatchSelectedRecordChangedEvent()
- {
- if (!this._selectedRecordChanged)
- return;
-
- this._selectedRecordChanged = false;
-
- this.dispatchEventToListeners(WebInspector.TimelineOverviewGraph.Event.RecordSelected, {record: this.selectedRecord});
- }
-
updateSelectedRecord()
{
// Implemented by sub-classes if needed.
@@ -252,10 +242,12 @@
if (this._scheduledSelectedRecordLayoutUpdateIdentifier)
return;
- this._scheduledSelectedRecordLayoutUpdateIdentifier = requestAnimationFrame(function() {
+ this._scheduledSelectedRecordLayoutUpdateIdentifier = requestAnimationFrame(() => {
this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
+
this.updateSelectedRecord();
- }.bind(this));
+ this.dispatchEventToListeners(WebInspector.TimelineOverviewGraph.Event.RecordSelected, {record: this.selectedRecord});
+ });
}
};
Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (201133 => 201134)
--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js 2016-05-19 08:39:56 UTC (rev 201133)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js 2016-05-19 08:40:00 UTC (rev 201134)
@@ -630,12 +630,13 @@
_recordSelected(event)
{
- let timelineView = this._timelineViewMap.get(event.data.timeline);
- console.assert(timelineView === this.currentTimelineView, timelineView);
- if (timelineView !== this.currentTimelineView)
- return;
+ let {record, timeline} = event.data;
+ let timelineView = this._timelineViewMap.get(timeline);
- timelineView.selectRecord(event.data.record);
+ if (record && timelineView !== this.currentTimelineView)
+ this.showTimelineViewForTimeline(timeline);
+
+ timelineView.selectRecord(record);
}
_timelineSelected()