mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Double key image cache by requesting origin, and store CORS status with cached images.
This commit is contained in:
parent
ea46008288
commit
81a67aed9e
11 changed files with 132 additions and 57 deletions
|
@ -18,7 +18,7 @@ use script_layout_interface::{PendingImage, PendingImageState};
|
|||
use script_traits::Painter;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use servo_atoms::Atom;
|
||||
use servo_url::ServoUrl;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::cell::{RefCell, RefMut};
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
|
@ -60,6 +60,9 @@ pub struct LayoutContext<'a> {
|
|||
/// The pipeline id of this LayoutContext.
|
||||
pub id: PipelineId,
|
||||
|
||||
/// The origin of this layout context.
|
||||
pub origin: ImmutableOrigin,
|
||||
|
||||
/// Bits shared by the layout and style system.
|
||||
pub style_context: SharedStyleContext<'a>,
|
||||
|
||||
|
@ -120,9 +123,12 @@ impl<'a> LayoutContext<'a> {
|
|||
};
|
||||
|
||||
// See if the image is already available
|
||||
let result =
|
||||
self.image_cache
|
||||
.find_image_or_metadata(url.clone(), use_placeholder, can_request);
|
||||
let result = self.image_cache.find_image_or_metadata(
|
||||
url.clone(),
|
||||
self.origin.clone(),
|
||||
use_placeholder,
|
||||
can_request,
|
||||
);
|
||||
match result {
|
||||
Ok(image_or_metadata) => Some(image_or_metadata),
|
||||
// Image failed to load, so just return nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue