layout: allow only repaint when css background and border image loaded (#39201)

This change allows that only new display list is built when css
background and border image loaded.

Testing: This change should not change any behaviors so covered by
existing WPT tests.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
JoeDow 2025-09-08 21:23:11 +08:00 committed by GitHub
parent e00bfb525b
commit 30d3706a2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 68 additions and 13 deletions

View file

@ -154,6 +154,13 @@ pub enum PendingImageState {
PendingResponse,
}
/// The destination in layout where an image is needed.
#[derive(Debug, MallocSizeOf)]
pub enum LayoutImageDestination {
BoxTreeConstruction,
DisplayListBuilding,
}
/// The data associated with an image that is not yet present in the image cache.
/// Used by the script thread to hold on to DOM elements that need to be repainted
/// when an image fetch is complete.
@ -163,6 +170,7 @@ pub struct PendingImage {
pub node: UntrustedNodeAddress,
pub id: PendingImageId,
pub origin: ImmutableOrigin,
pub destination: LayoutImageDestination,
}
/// A data structure to tarck vector image that are fully loaded (i.e has a parsed SVG
@ -290,6 +298,9 @@ pub trait Layout {
/// Returns true if this layout needs to produce a new display list for rendering updates.
fn needs_new_display_list(&self) -> bool;
/// Marks that this layout needs to produce a new display list for rendering updates.
fn set_needs_new_display_list(&self);
fn query_box_area(&self, node: TrustedNodeAddress, area: BoxAreaType) -> Option<Rect<Au>>;
fn query_box_areas(&self, node: TrustedNodeAddress, area: BoxAreaType) -> Vec<Rect<Au>>;
fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32>;