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

@ -7,8 +7,8 @@ use base::id::{BrowsingContextId, PipelineId};
use data_url::DataUrl;
use embedder_traits::ViewportDetails;
use euclid::{Scale, Size2D};
use layout_api::IFrameSize;
use layout_api::wrapper_traits::ThreadSafeLayoutNode;
use layout_api::{IFrameSize, LayoutImageDestination};
use malloc_size_of_derive::MallocSizeOf;
use net_traits::image_cache::{Image, ImageOrMetadataAvailable, UsePlaceholder, VectorImage};
use script::layout_dom::ServoThreadSafeLayoutNode;
@ -189,7 +189,12 @@ impl ReplacedContents {
let result = context
.image_resolver
.get_cached_image_for_url(node.opaque(), svg_source, UsePlaceholder::No)
.get_cached_image_for_url(
node.opaque(),
svg_source,
UsePlaceholder::No,
LayoutImageDestination::BoxTreeConstruction,
)
.ok();
let vector_image = result.map(|result| match result {
@ -230,6 +235,7 @@ impl ReplacedContents {
node.opaque(),
image_url.clone().into(),
UsePlaceholder::No,
LayoutImageDestination::BoxTreeConstruction,
) {
LayoutImageCacheResult::DataAvailable(img_or_meta) => match img_or_meta {
ImageOrMetadataAvailable::ImageAvailable { image, .. } => {