mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Pass SharedLayoutContext to ImageFragmentInfo::new.
This commit is contained in:
parent
7524e5549f
commit
938569e3c7
2 changed files with 8 additions and 7 deletions
|
@ -308,13 +308,13 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) => {
|
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) => {
|
||||||
let image_info = box ImageFragmentInfo::new(node,
|
let image_info = box ImageFragmentInfo::new(node,
|
||||||
node.image_url(),
|
node.image_url(),
|
||||||
&self.layout_context);
|
&self.layout_context.shared);
|
||||||
SpecificFragmentInfo::Image(image_info)
|
SpecificFragmentInfo::Image(image_info)
|
||||||
}
|
}
|
||||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => {
|
Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => {
|
||||||
let image_info = box ImageFragmentInfo::new(node,
|
let image_info = box ImageFragmentInfo::new(node,
|
||||||
node.object_data(),
|
node.object_data(),
|
||||||
&self.layout_context);
|
&self.layout_context.shared);
|
||||||
SpecificFragmentInfo::Image(image_info)
|
SpecificFragmentInfo::Image(image_info)
|
||||||
}
|
}
|
||||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLTableElement)) => {
|
Some(LayoutNodeType::Element(LayoutElementType::HTMLTableElement)) => {
|
||||||
|
@ -1267,7 +1267,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
Some(ref url) => {
|
Some(ref url) => {
|
||||||
let image_info = box ImageFragmentInfo::new(node,
|
let image_info = box ImageFragmentInfo::new(node,
|
||||||
Some((*url).clone()),
|
Some((*url).clone()),
|
||||||
&self.layout_context);
|
&self.layout_context.shared);
|
||||||
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)]
|
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)]
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use canvas_traits::CanvasMsg;
|
use canvas_traits::CanvasMsg;
|
||||||
use context::LayoutContext;
|
use context::{LayoutContext, SharedLayoutContext};
|
||||||
use euclid::{Point2D, Rect, Size2D};
|
use euclid::{Point2D, Rect, Size2D};
|
||||||
use floats::ClearType;
|
use floats::ClearType;
|
||||||
use flow::{self, ImmutableFlowUtils};
|
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
|
/// FIXME(pcwalton): The fact that image fragments store the cache in the fragment makes little
|
||||||
/// sense to me.
|
/// sense to me.
|
||||||
pub fn new<N: ThreadSafeLayoutNode>(node: &N, url: Option<Url>,
|
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| {
|
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 {
|
let (image, metadata) = match image_or_metadata {
|
||||||
|
@ -390,7 +391,7 @@ impl ImageFragmentInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
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,
|
image: image,
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue