Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Web Inspector: [Meta] Implement Timelines Film Strip
https://bugs.webkit.org/show_bug.cgi?id=239350 Patch by Anjali Kumar <anjalik_22@apple.com> on 2022-05-13 Reviewed by Devin Rousso and Patrick Angle. Source/JavaScriptCore: * inspector/protocol/Timeline.json: Source/WebCore: Test: inspector/timeline/timeline-event-screenshots.html * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createScreenshotData): * inspector/TimelineRecordFactory.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::didComposite): (WebCore::InspectorTimelineAgent::willPaint): (WebCore::InspectorTimelineAgent::didPaint): (WebCore::InspectorTimelineAgent::toggleInstruments): (WebCore::InspectorTimelineAgent::captureScreenshot): (WebCore::toProtocol): (WebCore::InspectorTimelineAgent::createRecordEntry): (WebCore::InspectorTimelineAgent::pushCurrentRecord): * inspector/agents/InspectorTimelineAgent.h: Source/WebInspectorUI: Add the ability to see screenshots taken of the viewport within the Timelines tab. The purpose of the screenshots is to provide more context to the other data presented within the Timelines tab, so that developers can improve the efficiency of their page loading times. They can see what is painting on their pages in addition to when the paints are occuring. The screenshots presented are taken immediately after each composite. They are designed to be layered on top of one another as opposed to being presented in a non-overlapping fashion in order to provide developers with the exact screenshot that occured during a particular point in time on the timeline. This allows developers to zoom in and pinpoint the exact moment the page looked like that particularly rendered screenshot. When a screenshot is clicked on, the details section opens up to an enlarged view of that particular image. Developers can utilize this to view each screenshot in greater detail. This feature is named "Screenshots" (one word), as in the UI we currently have existing strings for "Capture Screenshot" and "Could not capture screenshot". * Localizations/en.lproj/localizedStrings.js: * UserInterface/Base/Setting.js: * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.defaultTimelineTypes): (WI.TimelineManager.prototype._processRecord): (WI.TimelineManager.prototype._updateAutoCaptureInstruments): * UserInterface/Images/IdentifierIcons.svg: * UserInterface/Main.html: * UserInterface/Models/Instrument.js: (WI.Instrument.createForTimelineType): * UserInterface/Models/ScreenshotsInstrument.js: Added. (WI.ScreenshotsInstrument): (WI.ScreenshotsInstrument.supported): (WI.ScreenshotsInstrument.prototype.get timelineRecordType): * UserInterface/Models/ScreenshotsTimelineRecord.js: Added. (WI.ScreenshotsTimelineRecord): (WI.ScreenshotsTimelineRecord.async fromJSON): (WI.ScreenshotsTimelineRecord.prototype.toJSON): (WI.ScreenshotsTimelineRecord.prototype.get imageData): (WI.ScreenshotsTimelineRecord.prototype.get width): (WI.ScreenshotsTimelineRecord.prototype.get height): * UserInterface/Models/TimelineRecord.js: (WI.TimelineRecord.async fromJSON): * UserInterface/Models/TimelineRecording.js: (WI.TimelineRecording.prototype.addRecord): * UserInterface/Test.html: * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): * UserInterface/Views/ScreenshotsTimelineOverviewGraph.css: Added. (body .sidebar > .panel.navigation.timeline > .timelines-content li.item.screenshots,): (.timeline-overview-graph.screenshots > img): (.timeline-overview-graph.screenshots > img.selected): * UserInterface/Views/ScreenshotsTimelineOverviewGraph.js: Added. (WI.ScreenshotsTimelineOverviewGraph): (WI.ScreenshotsTimelineOverviewGraph.prototype.get height): (WI.ScreenshotsTimelineOverviewGraph.prototype.layout): (WI.ScreenshotsTimelineOverviewGraph.prototype.updateSelectedRecord): (WI.ScreenshotsTimelineOverviewGraph.prototype._visibleRecords): * UserInterface/Views/ScreenshotsTimelineView.css: Added. (.timeline-view.screenshots): (.timeline-view.screenshots > img): (.timeline-view.screenshots > img.selected): * UserInterface/Views/ScreenshotsTimelineView.js: Added. (WI.ScreenshotsTimelineView): (WI.ScreenshotsTimelineView.prototype.reset): (WI.ScreenshotsTimelineView.prototype.clear): (WI.ScreenshotsTimelineView.prototype.get showsFilterBar): (WI.ScreenshotsTimelineView.prototype.layout): (WI.ScreenshotsTimelineView.prototype.selectRecord): (WI.ScreenshotsTimelineView.prototype._selectTimelineRecord): (WI.ScreenshotsTimelineView.prototype._visibleRecords): * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createExperimentalSettingsView): * UserInterface/Views/TimelineIcons.css: (.screenshots-icon .icon): (@media (prefers-color-scheme: dark) .screenshots-icon .icon): * UserInterface/Views/TimelineOverviewGraph.js: (WI.TimelineOverviewGraph.createForTimeline): * UserInterface/Views/TimelineTabContentView.js: (WI.TimelineTabContentView.displayNameForTimelineType): (WI.TimelineTabContentView.iconClassNameForTimelineType): (WI.TimelineTabContentView.genericClassNameForTimelineType): (WI.TimelineTabContentView.iconClassNameForRecord): (WI.TimelineTabContentView.displayNameForRecord): LayoutTests: * inspector/timeline/resources/timeline-event-utilities.js: (TestPage.registerInitializer.InspectorTest.TimelineEvent.captureTimelineWithScript): (TestPage.registerInitializer): * inspector/timeline/timeline-event-screenshots-expected.txt: Added. * inspector/timeline/timeline-event-screenshots.html: Added. * inspector/timeline/timeline-recording-expected.txt: Canonical link: https://commits.webkit.org/250535@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294166 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
74154df
commit d039cefadcc0c8e2fbe2b09f060b8234a5074ca1
Showing
34 changed files
with
780 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,13 @@ | ||
| Tests 'Screenshot' Timeline event records. | ||
|
|
||
|
|
||
| == Running test suite: TimelineEvent.FireScreenshots | ||
| -- Running test case: TimelineEvent.FireScreenshots.requestScreenshots | ||
| Starting Capture... | ||
| Evaluating... | ||
| Stopping Capture... | ||
| PASS: Should have at least 1 Screenshot record. | ||
| PASS: Screenshot record should contain image data. | ||
| PASS: Screenshot record width should be non-zero. | ||
| PASS: Screenshot record height should be non-zero. | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,55 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> | ||
| <script src="./resources/timeline-event-utilities.js"></script> | ||
| <script> | ||
|
|
||
| function testRequestScreenshots() { | ||
| document.getElementById("test").style.width = "200px"; | ||
|
|
||
| savePageData({invalidatedLayout: true}); | ||
| } | ||
|
|
||
| function test() | ||
| { | ||
| let suite = InspectorTest.createAsyncSuite("TimelineEvent.FireScreenshots"); | ||
|
|
||
| suite.addTestCase({ | ||
| name: "TimelineEvent.FireScreenshots.requestScreenshots", | ||
| async test() { | ||
| WI.timelineManager.enabledTimelineTypes = [WI.TimelineRecord.Type.Screenshots]; | ||
| let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ | ||
| expression: `testRequestScreenshots()`, | ||
| timelineType: WI.TimelineRecord.Type.Screenshots, | ||
| }); | ||
| InspectorTest.assert(pageRecordingData.invalidatedLayout); | ||
|
|
||
| let recording = WI.timelineManager.activeRecording; | ||
| let screenshotTimeline = recording.timelines.get(WI.TimelineRecord.Type.Screenshots); | ||
| let records = screenshotTimeline.records; | ||
| InspectorTest.expectGreaterThan(records.length, 0, "Should have at least 1 Screenshot record."); | ||
|
|
||
| InspectorTest.expectGreaterThan(records[0].imageData.length, 0, "Screenshot record should contain image data."); | ||
| InspectorTest.expectGreaterThan(records[0].width, 0, "Screenshot record width should be non-zero."); | ||
| InspectorTest.expectGreaterThan(records[0].height, 0, "Screenshot record height should be non-zero."); | ||
| } | ||
| }); | ||
|
|
||
| suite.runTestCasesAndFinish(); | ||
| } | ||
|
|
||
| </script> | ||
| <style> | ||
| #test { | ||
| width: 100px; | ||
| height: 100px; | ||
| background-color: darkseagreen; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body onload="runTest()"> | ||
| <p>Tests 'Screenshot' Timeline event records.</p> | ||
| <div id="test"></div> | ||
| </body> | ||
| </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.