Skip to content

Commit 2ddbd54

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
RPP AI: add animation reasons to CLS output
Fixed: 413285103 Change-Id: Icafe03dbecfee9bb8e49a92924d779a2c2d5d13d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6976226 Commit-Queue: Jack Franklin <[email protected]> Auto-Submit: Jack Franklin <[email protected]> Reviewed-by: Nikolay Vitkov <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]>
1 parent 1a3a252 commit 2ddbd54

File tree

6 files changed

+129
-1
lines changed

6 files changed

+129
-1
lines changed

front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,104 @@ Layout shifts in this cluster:
338338
- https://web.dev/articles/optimize-cls
339339
=== end content
340340

341+
Title: PerformanceInsightFormatter CLS serializes correctly when there are no layout shifts
342+
Content:
343+
## Insight Title: Layout shift culprits
344+
345+
## Insight Summary:
346+
Cumulative Layout Shifts (CLS) is a measure of the largest burst of layout shifts for every unexpected layout shift that occurs during the lifecycle of a page. This is a Core Web Vital and the thresholds for categorizing a score are:
347+
- Good: 0.1 or less
348+
- Needs improvement: more than 0.1 and less than or equal to 0.25
349+
- Bad: over 0.25
350+
351+
## Detailed analysis:
352+
No layout shifts were found.
353+
354+
## Estimated savings: none
355+
356+
## External resources:
357+
- https://wdeb.dev/articles/cls
358+
- https://web.dev/articles/optimize-cls
359+
=== end content
360+
361+
Title: PerformanceInsightFormatter CLS outputs information on non-composited animations
362+
Content:
363+
## Insight Title: Layout shift culprits
364+
365+
## Insight Summary:
366+
Cumulative Layout Shifts (CLS) is a measure of the largest burst of layout shifts for every unexpected layout shift that occurs during the lifecycle of a page. This is a Core Web Vital and the thresholds for categorizing a score are:
367+
- Good: 0.1 or less
368+
- Needs improvement: more than 0.1 and less than or equal to 0.25
369+
- Bad: over 0.25
370+
371+
## Detailed analysis:
372+
The worst layout shift cluster was the cluster that started at 60 ms and ended at 1,243 ms, with a duration of 1,183 ms.
373+
The score for this cluster is 0.0140.
374+
375+
Layout shifts in this cluster:
376+
### Layout shift 1:
377+
- Start time: 60 ms
378+
- Score: 0.0012
379+
- No potential root causes identified
380+
### Layout shift 2:
381+
- Start time: 76 ms
382+
- Score: 0.0012
383+
- No potential root causes identified
384+
### Layout shift 3:
385+
- Start time: 93 ms
386+
- Score: 0.0012
387+
- No potential root causes identified
388+
### Layout shift 4:
389+
- Start time: 110 ms
390+
- Score: 0.0012
391+
- No potential root causes identified
392+
### Layout shift 5:
393+
- Start time: 126 ms
394+
- Score: 0.0012
395+
- No potential root causes identified
396+
### Layout shift 6:
397+
- Start time: 143 ms
398+
- Score: 0.0012
399+
- No potential root causes identified
400+
### Layout shift 7:
401+
- Start time: 160 ms
402+
- Score: 0.0012
403+
- No potential root causes identified
404+
### Layout shift 8:
405+
- Start time: 176 ms
406+
- Score: 0.0012
407+
- No potential root causes identified
408+
### Layout shift 9:
409+
- Start time: 193 ms
410+
- Score: 0.0012
411+
- No potential root causes identified
412+
### Layout shift 10:
413+
- Start time: 210 ms
414+
- Score: 0.0012
415+
- No potential root causes identified
416+
### Layout shift 11:
417+
- Start time: 226 ms
418+
- Score: 0.0012
419+
- No potential root causes identified
420+
### Layout shift 12:
421+
- Start time: 243 ms
422+
- Score: 0.0012
423+
- Potential root causes:
424+
- A non-composited animation:
425+
- non-composited animation: `change-height`
426+
Animation name: change-height
427+
Unsupported CSS properties:
428+
- height
429+
Failure reasons:
430+
- TARGET_HAS_INVALID_COMPOSITING_STATE, UNSUPPORTED_CSS_PROPERTY
431+
432+
## Estimated savings: none
433+
434+
## External resources:
435+
- https://wdeb.dev/articles/cls
436+
- https://web.dev/articles/optimize-cls
437+
=== end content
438+
341439
Title: PerformanceInsightFormatter INP breakdown serializes the correct details
342440
Content:
343441
## Insight Title: INP breakdown

front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,31 @@ describeWithEnvironment('PerformanceInsightFormatter', () => {
142142
const output = formatter.formatInsight();
143143
snapshotTester.assert(this, output);
144144
});
145+
146+
it('serializes correctly when there are no layout shifts', async function() {
147+
const parsedTrace = await TraceLoader.traceEngine(this, 'render-blocking-requests.json.gz');
148+
assert.isOk(parsedTrace.insights);
149+
const firstNav = getFirstOrError(parsedTrace.data.Meta.navigationsByNavigationId.values());
150+
const insight = getInsightOrError('CLSCulprits', parsedTrace.insights, firstNav);
151+
const focus = AgentFocus.fromParsedTrace(parsedTrace);
152+
153+
const formatter = new PerformanceInsightFormatter(focus, insight);
154+
const output = formatter.formatInsight();
155+
snapshotTester.assert(this, output);
156+
});
157+
158+
it('outputs information on non-composited animations', async function() {
159+
const parsedTrace = await TraceLoader.traceEngine(this, 'layout-shifts-with-animation-culprit.json.gz');
160+
161+
assert.isOk(parsedTrace.insights);
162+
const firstNav = getFirstOrError(parsedTrace.data.Meta.navigationsByNavigationId.values());
163+
const insight = getInsightOrError('CLSCulprits', parsedTrace.insights, firstNav);
164+
const focus = AgentFocus.fromParsedTrace(parsedTrace);
165+
166+
const formatter = new PerformanceInsightFormatter(focus, insight);
167+
const output = formatter.formatInsight();
168+
snapshotTester.assert(this, output);
169+
});
145170
});
146171

147172
describe('INP breakdown', () => {

front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ ${rootCauseText}`;
304304
formatClsCulpritsInsight(insight: Trace.Insights.Models.CLSCulprits.CLSCulpritsInsightModel): string {
305305
const {worstCluster, shifts} = insight;
306306
if (!worstCluster) {
307-
return '';
307+
return 'No layout shifts were found.';
308308
}
309309

310310
const baseTime = this.#parsedTrace.data.Meta.traceBounds.min;

front_end/panels/timeline/fixtures/traces/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ copy_to_gen("traces") {
6161
"large-profile.cpuprofile.gz",
6262
"large-recalc-style.json.gz",
6363
"layout-shifts-root-causes.json.gz",
64+
"layout-shifts-with-animation-culprit.json.gz",
6465
"lcp-discovery-delay.json.gz",
6566
"lcp-fetchpriority-high.json.gz",
6667
"lcp-images-rasterizer.json.gz",

front_end/panels/timeline/fixtures/traces/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,7 @@ https://chromium.googlesource.com/external/github.com/google/perfetto.git/+/aef6
355355
### interaction-events-with-shared-ids
356356

357357
A trace with lots of interactions generated from https://chromedevtools.github.io/performance-stories/long-interaction/index.html?x=30.
358+
359+
### layout-shift-with-animation-culprit
360+
361+
A trace that has a layout shift with a root cause that is a non-composited animation. Generated from https://github.com/ChromeDevTools/performance-stories/tree/main/layout-shift-animations.
Binary file not shown.

0 commit comments

Comments
 (0)