Title: [188398] trunk/Source/WebInspectorUI
Revision
188398
Author
mattba...@apple.com
Date
2015-08-13 13:29:20 -0700 (Thu, 13 Aug 2015)

Log Message

Web Inspector: Hide child rows for filtered tasks in the Rendering Frames data grid
https://bugs.webkit.org/show_bug.cgi?id=147960

Reviewed by Timothy Hatcher.

* UserInterface/Models/RenderingFrameTimelineRecord.js:
(WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord):
New static method for mapping TimelineRecords to rendering frame tasks.
(WebInspector.RenderingFrameTimelineRecord.prototype.durationForTask):
Refactored to use taskTypeForTimelineRecord.

* UserInterface/Views/TimelineSidebarPanel.js:
(WebInspector.TimelineSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
Task filtering is applied to children of the frame record only. Parent frame
record is hidden by default, and visible by virtue of having unfiltered children.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (188397 => 188398)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-08-13 20:28:12 UTC (rev 188397)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-08-13 20:29:20 UTC (rev 188398)
@@ -1,5 +1,23 @@
 2015-08-13  Matt Baker  <mattba...@apple.com>
 
+        Web Inspector: Hide child rows for filtered tasks in the Rendering Frames data grid
+        https://bugs.webkit.org/show_bug.cgi?id=147960
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/RenderingFrameTimelineRecord.js:
+        (WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord):
+        New static method for mapping TimelineRecords to rendering frame tasks.
+        (WebInspector.RenderingFrameTimelineRecord.prototype.durationForTask):
+        Refactored to use taskTypeForTimelineRecord.
+
+        * UserInterface/Views/TimelineSidebarPanel.js:
+        (WebInspector.TimelineSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
+        Task filtering is applied to children of the frame record only. Parent frame
+        record is hidden by default, and visible by virtue of having unfiltered children.
+
+2015-08-13  Matt Baker  <mattba...@apple.com>
+
         Web Inspector: Clearing frames timeline doesn't remove current time marker
         https://bugs.webkit.org/show_bug.cgi?id=147650
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js (188397 => 188398)


--- trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js	2015-08-13 20:28:12 UTC (rev 188397)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js	2015-08-13 20:29:20 UTC (rev 188398)
@@ -54,6 +54,21 @@
         }
     }
 
+    static taskTypeForTimelineRecord(record)
+    {
+        switch(record.type) {
+        case WebInspector.TimelineRecord.Type.Script:
+            return WebInspector.RenderingFrameTimelineRecord.TaskType.Script;
+        case WebInspector.TimelineRecord.Type.Layout:
+            if (record.eventType  === WebInspector.LayoutTimelineRecord.EventType.Paint || record.eventType === WebInspector.LayoutTimelineRecord.EventType.Composite)
+                return WebInspector.RenderingFrameTimelineRecord.TaskType.Paint;
+            return WebInspector.RenderingFrameTimelineRecord.TaskType.Layout;
+        default:
+            console.error("Unsupported timeline record type: " + record.type);
+            return null;
+        }
+    }
+
     // Public
 
     get frameIndex()
@@ -71,27 +86,12 @@
         if (this._durationByTaskType.has(taskType))
             return this._durationByTaskType.get(taskType);
 
-        function validRecordForTaskType(record)
-        {
-            switch(taskType) {
-            case WebInspector.RenderingFrameTimelineRecord.TaskType.Script:
-                return record.type === WebInspector.TimelineRecord.Type.Script;
-            case WebInspector.RenderingFrameTimelineRecord.TaskType.Layout:
-                return record.type === WebInspector.TimelineRecord.Type.Layout && record.eventType !== WebInspector.LayoutTimelineRecord.EventType.Paint && record.eventType !== WebInspector.LayoutTimelineRecord.EventType.Composite;
-            case WebInspector.RenderingFrameTimelineRecord.TaskType.Paint:
-                return record.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint || record.eventType === WebInspector.LayoutTimelineRecord.EventType.Composite;
-            default:
-                console.error("Unsupported task type: " + taskType);
-                return false;
-            }
-        }
-
         var duration;
         if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
             duration = this._calculateDurationRemainder();
         else {
             duration = this.children.reduce(function(previousValue, currentValue) {
-                if (!validRecordForTaskType(currentValue))
+                if (taskType !== WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord(currentValue))
                     return previousValue;
 
                 var currentDuration = currentValue.duration;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js (188397 => 188398)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2015-08-13 20:28:12 UTC (rev 188397)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2015-08-13 20:29:20 UTC (rev 188398)
@@ -395,23 +395,18 @@
             return true;
 
         if (this._viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames && this._renderingFrameTaskFilter.size) {
-            while (treeElement && !(treeElement.record instanceof WebInspector.RenderingFrameTimelineRecord))
+            while (treeElement && !(treeElement.record instanceof WebInspector.TimelineRecord))
                 treeElement = treeElement.parent;
 
-            console.assert(treeElement, "Cannot apply task filter: no RenderingFrameTimelineRecord found.");
+            console.assert(treeElement, "Cannot apply task filter: no TimelineRecord found.");
             if (!treeElement)
                 return false;
 
             var visible = false;
-            for (var key in WebInspector.RenderingFrameTimelineRecord.TaskType) {
-                var taskType = WebInspector.RenderingFrameTimelineRecord.TaskType[key];
-                if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
-                    continue;
-
-                if (!this._renderingFrameTaskFilter.has(taskType) && treeElement.record.durationForTask(taskType) > 0) {
+            if (!(treeElement.record instanceof WebInspector.RenderingFrameTimelineRecord)) {
+                var taskType = WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord(treeElement.record);
+                if (!this._renderingFrameTaskFilter.has(taskType))
                     visible = true;
-                    break;
-                }
             }
 
             if (!visible)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to