Title: [187929] trunk/Source/WebInspectorUI
Revision
187929
Author
mattba...@apple.com
Date
2015-08-04 18:25:00 -0700 (Tue, 04 Aug 2015)

Log Message

Web Inspector: Layout & Rendering timeline grid should show TimelineRecord parent/child relationships
https://bugs.webkit.org/show_bug.cgi?id=147468

Reviewed by Brian Burg.

Layout timeline data grid now shows record nesting for Layout and Composite events.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded):
* UserInterface/Models/TimelineRecord.js:
(WebInspector.TimelineRecord.prototype.get parent):
(WebInspector.TimelineRecord.prototype.set parent):
Preserve timeline record parent/child relationship.

* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView):
Style change for disclosure triangle support.
(WebInspector.LayoutTimelineView.prototype._layoutTimelineRecordAdded):
Only process immediate children of the rendering frame record.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (187928 => 187929)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-08-05 01:15:22 UTC (rev 187928)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-08-05 01:25:00 UTC (rev 187929)
@@ -1,3 +1,25 @@
+2015-08-04  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: Layout & Rendering timeline grid should show TimelineRecord parent/child relationships
+        https://bugs.webkit.org/show_bug.cgi?id=147468
+
+        Reviewed by Brian Burg.
+
+        Layout timeline data grid now shows record nesting for Layout and Composite events.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype.eventRecorded):
+        * UserInterface/Models/TimelineRecord.js:
+        (WebInspector.TimelineRecord.prototype.get parent):
+        (WebInspector.TimelineRecord.prototype.set parent):
+        Preserve timeline record parent/child relationship.
+
+        * UserInterface/Views/LayoutTimelineView.js:
+        (WebInspector.LayoutTimelineView):
+        Style change for disclosure triangle support.
+        (WebInspector.LayoutTimelineView.prototype._layoutTimelineRecordAdded):
+        Only process immediate children of the rendering frame record.
+
 2015-08-04  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: "No Filter Results" overlaps other UI elements when docked Inspector is small

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (187928 => 187929)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-08-05 01:15:22 UTC (rev 187928)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-08-05 01:25:00 UTC (rev 187929)
@@ -196,6 +196,7 @@
                 var recordPayload = recordPayloads[entry.index];
                 var record = this._processEvent(recordPayload, entry.parent);
                 if (record) {
+                    record.parent = entry.parentRecord;
                     records.push(record);
                     if (entry.parentRecord)
                         entry.parentRecord.children.push(record);

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js (187928 => 187929)


--- trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js	2015-08-05 01:15:22 UTC (rev 187928)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js	2015-08-05 01:25:00 UTC (rev 187929)
@@ -122,6 +122,19 @@
         return this._sourceCodeLocation;
     }
 
+    get parent()
+    {
+        return this._parent;
+    }
+
+    set parent(x)
+    {
+        if (this._parent === x)
+            return;
+
+        this._parent = x;
+    }
+
     get children()
     {
         return this._children;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js (187928 => 187929)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js	2015-08-05 01:15:22 UTC (rev 187928)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js	2015-08-05 01:25:00 UTC (rev 187929)
@@ -31,7 +31,6 @@
 
         console.assert(timeline.type === WebInspector.TimelineRecord.Type.Layout, timeline);
 
-        this.navigationSidebarTreeOutline.element.classList.add(WebInspector.NavigationSidebarPanel.HideDisclosureButtonsStyleClassName);
         this.navigationSidebarTreeOutline.element.classList.add("layout");
 
         var columns = {eventType: {}, location: {}, width: {}, height: {}, startTime: {}, totalTime: {}};
@@ -196,6 +195,27 @@
             var dataGridNode = new WebInspector.LayoutTimelineDataGridNode(layoutTimelineRecord, this.zeroTime);
 
             this._dataGrid.addRowInSortOrder(treeElement, dataGridNode);
+
+            var stack = [{children: layoutTimelineRecord.children, parentTreeElement: treeElement, index: 0}];
+            while (stack.length) {
+                var entry = stack.lastValue;
+                if (entry.index >= entry.children.length) {
+                    stack.pop();
+                    continue;
+                }
+
+                var childRecord = entry.children[entry.index];
+                console.assert(childRecord.type === WebInspector.TimelineRecord.Type.Layout, childRecord);
+
+                var childTreeElement = new WebInspector.TimelineRecordTreeElement(childRecord, WebInspector.SourceCodeLocation.NameStyle.Short);
+                var layoutDataGridNode = new WebInspector.LayoutTimelineDataGridNode(childRecord, this.zeroTime);
+                console.assert(entry.parentTreeElement, "entry without parent!");
+                this._dataGrid.addRowInSortOrder(childTreeElement, layoutDataGridNode, entry.parentTreeElement);
+
+                if (childTreeElement && childRecord.children.length)
+                    stack.push({children: childRecord.children, parentTreeElement: childTreeElement, index: 0});
+                ++entry.index;
+            }
         }
 
         this._pendingRecords = [];
@@ -206,6 +226,10 @@
         var layoutTimelineRecord = event.data.record;
         console.assert(layoutTimelineRecord instanceof WebInspector.LayoutTimelineRecord);
 
+        // Only add top-level records, to avoid processing child records multiple times.
+        if (!(layoutTimelineRecord.parent instanceof WebInspector.RenderingFrameTimelineRecord))
+            return;
+
         this._pendingRecords.push(layoutTimelineRecord);
 
         this.needsLayout();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to