aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/context.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2019-10-01 13:11:50 -0400
committerJosh Matthews <josh@joshmatthews.net>2019-10-04 09:22:21 -0400
commit81a67aed9e0cc866f4689e8d7a5541198d75e445 (patch)
tree65c5496febb57bab609aa1c62a771ae06a9ee49b /components/layout/context.rs
parentea4600828861010da859399d3d432e2252619c2d (diff)
downloadservo-81a67aed9e0cc866f4689e8d7a5541198d75e445.tar.gz
servo-81a67aed9e0cc866f4689e8d7a5541198d75e445.zip
Double key image cache by requesting origin, and store CORS status with cached images.
Diffstat (limited to 'components/layout/context.rs')
-rw-r--r--components/layout/context.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs
index 015cc9ac40d..5c373ac668d 100644
--- a/components/layout/context.rs
+++ b/components/layout/context.rs
@@ -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