From 47bc85e2724195c6a96b1cef1a5c3a7b157d5773 Mon Sep 17 00:00:00 2001 From: "mattbaker@apple.com" Date: Thu, 13 Aug 2015 20:29:20 +0000 Subject: [PATCH 1/1] 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. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188398 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebInspectorUI/ChangeLog | 18 +++++++++++ .../Models/RenderingFrameTimelineRecord.js | 32 +++++++++---------- .../Views/TimelineSidebarPanel.js | 15 +++------ 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog index 06494585070c..2efca65fd636 100644 --- a/Source/WebInspectorUI/ChangeLog +++ b/Source/WebInspectorUI/ChangeLog @@ -1,3 +1,21 @@ +2015-08-13 Matt Baker + + 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 Web Inspector: Clearing frames timeline doesn't remove current time marker diff --git a/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js index 8738bab589d8..5c9ec0c13bb5 100644 --- a/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js +++ b/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js @@ -54,6 +54,21 @@ WebInspector.RenderingFrameTimelineRecord = class RenderingFrameTimelineRecord e } } + 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 @@ WebInspector.RenderingFrameTimelineRecord = class RenderingFrameTimelineRecord e 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; diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js index ffa05e593ce7..d5fbe2822f1c 100644 --- a/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js +++ b/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js @@ -395,23 +395,18 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec 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) -- 2.36.0