Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: update cumulative-layout-shift #12554

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,9 @@ module.exports = [
firstContentfulPaintAllFrames: '<5000',
largestContentfulPaint: '>5000',
largestContentfulPaintAllFrames: '<5000',
cumulativeLayoutShift: '0.001 +/- 0.0005',
cumulativeLayoutShiftAllFrames: '0.197 +/- 0.001',
layoutShiftAvgSessionGap5s: '>0',
layoutShiftMaxSessionGap1s: '>0',
layoutShiftMaxSessionGap1sLimit5s: '>0',
layoutShiftMaxSliding1s: '>0',
layoutShiftMaxSliding300ms: '>0',
layoutShiftMaxSessionGap1sLimit5sAllFrames: '0.197 +/- 0.001',
cumulativeLayoutShift: '0.197 +/- 0.001',
cumulativeLayoutShiftMainFrame: '0.001 +/- 0.0005',
totalCumulativeLayoutShift: '0.001 +/- 0.0005',
},
{
lcpInvalidated: false,
Expand Down
12 changes: 4 additions & 8 deletions lighthouse-core/audits/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ const ComputedTimingSummary = require('../computed/metrics/timing-summary.js');
/** @type {Set<keyof LH.Artifacts.TimingSummary>} */
const DECIMAL_METRIC_KEYS = new Set([
'cumulativeLayoutShift',
'cumulativeLayoutShiftAllFrames',
'cumulativeLayoutShiftMainFrame',
'totalCumulativeLayoutShift',
'observedCumulativeLayoutShift',
'observedCumulativeLayoutShiftAllFrames',
'layoutShiftAvgSessionGap5s',
'layoutShiftMaxSessionGap1s',
'layoutShiftMaxSessionGap1sLimit5s',
'layoutShiftMaxSliding1s',
'layoutShiftMaxSliding300ms',
'layoutShiftMaxSessionGap1sLimit5sAllFrames',
'observedCumulativeLayoutShiftMainFrame',
'observedTotalCumulativeLayoutShift',
]);

class Metrics extends Audit {
Expand Down
10 changes: 5 additions & 5 deletions lighthouse-core/audits/metrics/cumulative-layout-shift.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ class CumulativeLayoutShift extends Audit {
*/
static async audit(artifacts, context) {
const trace = artifacts.traces[Audit.DEFAULT_PASS];
const metricResult = await ComputedCLS.request(trace, context);
const {cumulativeLayoutShift, ...rest} = await ComputedCLS.request(trace, context);

/** @type {LH.Audit.Details.DebugData} */
const details = {
type: 'debugdata',
items: [metricResult.debugInfo],
items: [rest],
};

return {
score: Audit.computeLogNormalScore(
{p10: context.options.p10, median: context.options.median},
metricResult.value
cumulativeLayoutShift
),
numericValue: metricResult.value,
numericValue: cumulativeLayoutShift,
numericUnit: 'unitless',
displayValue: metricResult.value.toLocaleString(context.settings.locale),
displayValue: cumulativeLayoutShift.toLocaleString(context.settings.locale),
details,
};
}
Expand Down
200 changes: 0 additions & 200 deletions lighthouse-core/computed/layout-shift-variants.js

This file was deleted.

This file was deleted.

Loading