Pass SharedLayoutContext to ImageFragmentInfo::new.

This commit is contained in:
Ms2ger 2016-08-23 17:32:06 +02:00
parent 7524e5549f
commit 938569e3c7
2 changed files with 8 additions and 7 deletions

View file

@ -308,13 +308,13 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) => {
let image_info = box ImageFragmentInfo::new(node,
node.image_url(),
&self.layout_context);
&self.layout_context.shared);
SpecificFragmentInfo::Image(image_info)
}
Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => {
let image_info = box ImageFragmentInfo::new(node,
node.object_data(),
&self.layout_context);
&self.layout_context.shared);
SpecificFragmentInfo::Image(image_info)
}
Some(LayoutNodeType::Element(LayoutElementType::HTMLTableElement)) => {
@ -1267,7 +1267,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
Some(ref url) => {
let image_info = box ImageFragmentInfo::new(node,
Some((*url).clone()),
&self.layout_context);
&self.layout_context.shared);
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)]
}
None => {

View file

@ -8,7 +8,7 @@
use app_units::Au;
use canvas_traits::CanvasMsg;
use context::LayoutContext;
use context::{LayoutContext, SharedLayoutContext};
use euclid::{Point2D, Rect, Size2D};
use floats::ClearType;
use flow::{self, ImmutableFlowUtils};
@ -372,9 +372,10 @@ impl ImageFragmentInfo {
/// FIXME(pcwalton): The fact that image fragments store the cache in the fragment makes little
/// sense to me.
pub fn new<N: ThreadSafeLayoutNode>(node: &N, url: Option<Url>,
layout_context: &LayoutContext) -> ImageFragmentInfo {
shared_layout_context: &SharedLayoutContext)
-> ImageFragmentInfo {
let image_or_metadata = url.and_then(|url| {
layout_context.shared.get_or_request_image_or_meta(url, UsePlaceholder::Yes)
shared_layout_context.get_or_request_image_or_meta(url, UsePlaceholder::Yes)
});
let (image, metadata) = match image_or_metadata {
@ -390,7 +391,7 @@ impl ImageFragmentInfo {
};
ImageFragmentInfo {
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, layout_context.style_context()),
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, &shared_layout_context.style_context),
image: image,
metadata: metadata,
}