pub(crate) struct PaintTimingHandler {
viewport_rect: LayoutRect,
is_document_paintable: bool,
is_document_contentful: bool,
previously_reported_paints: PaintTimingReport,
lcp_next_uuid: u64,
lcp_candidate: Option<LCPCandidate>,
reported_image_nodes: HashSet<OpaqueNode>,
images_pending_rendering: Vec<PendingImageRecord>,
elements_with_rendered_text: HashSet<OpaqueNode>,
elements_with_pending_rendered_text: HashMap<OpaqueNode, TextRecord>,
}Fields§
§viewport_rect: LayoutRectThe rect of viewport.
is_document_paintable: boolWhether the current display list contains paintable items.
is_document_contentful: boolWhether the current display list contains contentful items.
previously_reported_paints: PaintTimingReport§lcp_next_uuid: u64Counter for generating unique LCP candidate UUIDs.
lcp_candidate: Option<LCPCandidate>The LCP candidate, it may be a image or text.
reported_image_nodes: HashSet<OpaqueNode>The set of image nodes that have been reported as LCP candidates.
images_pending_rendering: Vec<PendingImageRecord>§elements_with_rendered_text: HashSet<OpaqueNode>https://www.w3.org/TR/paint-timing/#set-of-elements-with-rendered-text The set of text nodes that have been reported as LCP candidates.
elements_with_pending_rendered_text: HashMap<OpaqueNode, TextRecord>The set of pending text nodes that will fight for LCP candidate.
Implementations§
Source§impl PaintTimingHandler
impl PaintTimingHandler
pub(crate) fn new(viewport_size: LayoutSize) -> Self
Sourcepub(crate) fn mark_document_is_paintable(&mut self)
pub(crate) fn mark_document_is_paintable(&mut self)
Marks the current display list as containing a paintable item.
Sourcepub(crate) fn mark_document_is_contentful(&mut self)
pub(crate) fn mark_document_is_contentful(&mut self)
Marks the current display list as containing a contentful item.
pub(crate) fn append_image_record( &mut self, tag: Option<Tag>, bounds: LayoutRect, clip_rect: LayoutRect, transform: FastLayoutTransform, url: Option<ServoUrl>, natural_width: Option<Au>, natural_height: Option<Au>, )
pub(crate) fn accumulate_text_rect( &mut self, tag: Tag, rect: LayoutRect, transform: FastLayoutTransform, style: &ServoArc<ComputedValues>, )
Sourcefn paintable_bounding_rect(&self, bounds: LayoutRect) -> LayoutRect
fn paintable_bounding_rect(&self, bounds: LayoutRect) -> LayoutRect
Sourcepub(crate) fn paintable(&self, bounds: LayoutRect, opacity: f32) -> bool
pub(crate) fn paintable(&self, bounds: LayoutRect, opacity: f32) -> bool
Sourcepub(crate) fn check_if_paintable(&mut self, bounds: LayoutRect, opacity: f32)
pub(crate) fn check_if_paintable(&mut self, bounds: LayoutRect, opacity: f32)
Marks wether the document is having paintable element
Sourcefn effective_visual_size(
&self,
intersection_rect: LayoutRect,
candidate_type: LCPCandidateType<'_>,
) -> Option<f32>
fn effective_visual_size( &self, intersection_rect: LayoutRect, candidate_type: LCPCandidateType<'_>, ) -> Option<f32>
Sourcefn compute_new_lcp_candidate(
&mut self,
painted_images: Vec<PendingImageRecord>,
painted_text_nodes: HashMap<OpaqueNode, TextRecord>,
) -> Option<LCPCandidate>
fn compute_new_lcp_candidate( &mut self, painted_images: Vec<PendingImageRecord>, painted_text_nodes: HashMap<OpaqueNode, TextRecord>, ) -> Option<LCPCandidate>
Sourcefn report_largest_contentful_paint(
&mut self,
halt_lcp: bool,
painted_images: Vec<PendingImageRecord>,
painted_text_nodes: HashMap<OpaqueNode, TextRecord>,
)
fn report_largest_contentful_paint( &mut self, halt_lcp: bool, painted_images: Vec<PendingImageRecord>, painted_text_nodes: HashMap<OpaqueNode, TextRecord>, )
Sourcefn should_report_first_contentful_paint(&self) -> bool
fn should_report_first_contentful_paint(&self) -> bool
Sourcepub(crate) fn mark_paint_timing(
&mut self,
paint_timing_eligible: bool,
halt_lcp: bool,
) -> PaintTimingReport
pub(crate) fn mark_paint_timing( &mut self, paint_timing_eligible: bool, halt_lcp: bool, ) -> PaintTimingReport
https://www.w3.org/TR/paint-timing/#mark-paint-timing
Note: Step 10 is not in the current version of the specifications. Refer https://github.com/w3c/paint-timing/issues/122 for details on the issue and for the modified steps yet to be merged.
pub(crate) fn largest_contentful_paint_candidate(&self) -> Option<LCPCandidate>
Auto Trait Implementations§
impl Freeze for PaintTimingHandler
impl !RefUnwindSafe for PaintTimingHandler
impl Send for PaintTimingHandler
impl Sync for PaintTimingHandler
impl Unpin for PaintTimingHandler
impl UnsafeUnpin for PaintTimingHandler
impl !UnwindSafe for PaintTimingHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more