Files
tubestation/layout/base/RenderingPhase.h
Emilio Cobos Álvarez cd5c811fe0 Bug 1959927 - Turn layout into a regular render phase. r=dshin
Run it in the right step of the rendering loop as per spec. Keep
the interruptible layout behavior by detecting whether we have any
frame with content-visibility: auto / ResizeObserver / etc around.

Also make the IntersectionObserver phase not unconditional, make it
conditional on needing layout or having scrolled.

I want to look a bit whether we can avoid flushing the whole browsing
context tree, but that is pre-existing so not touching it as part of
this work.

Differential Revision: https://phabricator.services.mozilla.com/D245214
2025-04-14 10:15:13 +00:00

57 lines
1.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_RENDERINGPHASE_H_
#define MOZILLA_RENDERINGPHASE_H_
#include <cstdint>
#include "mozilla/EnumSet.h"
namespace mozilla {
// Steps in https://html.spec.whatwg.org/#update-the-rendering
// When updating this, please update sRenderingPhaseNames in nsRefreshDriver.
enum class RenderingPhase : uint8_t {
// TODO: Reveal docs.
FlushAutoFocusCandidates = 0,
ResizeSteps,
ScrollSteps,
EvaluateMediaQueriesAndReportChanges,
UpdateAnimationsAndSendEvents,
FullscreenSteps,
// TODO: Context lost steps?
AnimationFrameCallbacks,
Layout,
ViewTransitionOperations,
UpdateIntersectionObservations,
// TODO: Record rendering time
// TODO: Mark paint timing
Paint,
// TODO: Process top layer removals.
Count,
};
using RenderingPhases = EnumSet<RenderingPhase, uint16_t>;
inline constexpr RenderingPhases AllRenderingPhases() {
return {
RenderingPhase::FlushAutoFocusCandidates,
RenderingPhase::ResizeSteps,
RenderingPhase::ScrollSteps,
RenderingPhase::EvaluateMediaQueriesAndReportChanges,
RenderingPhase::UpdateAnimationsAndSendEvents,
RenderingPhase::FullscreenSteps,
RenderingPhase::AnimationFrameCallbacks,
RenderingPhase::Layout,
RenderingPhase::ViewTransitionOperations,
RenderingPhase::UpdateIntersectionObservations,
RenderingPhase::Paint,
};
}
} // namespace mozilla
#endif