v148 · performance · origin trial
Long Animation Frames style duration
Two new timing fields — styleDuration and forcedStyleDuration — added to the Long Animation Frames (LoAF) API, letting developers distinguish time spent in style and layout from other work inside a slow frame.
at a glance
| Status in Chrome 148 | Origin trial |
|---|---|
| Flag | None when OT token is present |
| Spec PR | w3c/long-animation-frames PR #30 |
| Standards position (Firefox) | No signal |
| Standards position (Safari) | No signal |
| ChromeStatus | 5171478175809536 — Long Animation Frames style duration |
why it exists
The Long Animation Frames API (LoAF) reports every frame that takes more than 50 ms to render. Before this addition, the PerformanceLongAnimationFrameTiming entry exposed total frame duration (duration) and script execution time (blockingDuration), but lumped style recalculation and layout into the general duration bucket. In pages that trigger forced layouts (style reads after DOM writes), style and layout often dominate the slow frame — but developers had no way to confirm this from the LoAF entry alone.
Adding styleDuration (total time for style + layout) and forcedStyleDuration (time for forced style + layout triggered mid-frame) makes it possible to diagnose layout-thrashing patterns directly from the performance timeline.
shape of the API
Two new properties on PerformanceLongAnimationFrameTiming:
| Property | Type | Description |
|---|---|---|
styleDuration | DOMHighResTimeStamp | Total time (ms) spent in style recalculation and layout during the frame |
forcedStyleDuration | DOMHighResTimeStamp | Subset of styleDuration that was forced (layout triggered mid-frame by a script) |
All other existing LoAF properties (duration, blockingDuration, renderStart, scripts, etc.) remain unchanged.
example
const observer = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (entry.entryType !== 'long-animation-frame') continue;
console.log(`LoAF: ${entry.duration.toFixed(1)} ms total`);
console.log(` style+layout: ${entry.styleDuration.toFixed(1)} ms`);
console.log(` forced style+layout: ${entry.forcedStyleDuration.toFixed(1)} ms`);
// Threshold: warn if >50% of the frame is forced layout
const forcedRatio = entry.forcedStyleDuration / entry.duration;
if (forcedRatio > 0.5) {
console.warn('Layout thrashing detected in this frame');
}
}
});
observer.observe({ type: 'long-animation-frame', buffered: true });
Pattern from developer.chrome.com — Long Animation Frames
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 148 | Origin trial | styleDuration and forcedStyleDuration |
| Firefox | No signal | — |
| Safari | No signal | — |