aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/replaced.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout_2020/replaced.rs')
-rw-r--r--components/layout_2020/replaced.rs50
1 files changed, 18 insertions, 32 deletions
diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs
index ecb8d2433e3..8cb77d267bd 100644
--- a/components/layout_2020/replaced.rs
+++ b/components/layout_2020/replaced.rs
@@ -3,10 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom_traversal::NodeExt;
-use crate::formatting_contexts::IndependentLayout;
use crate::fragments::{Fragment, ImageFragment};
use crate::geom::{flow_relative, physical};
-use crate::ContainingBlock;
use net_traits::image::base::Image;
use servo_arc::Arc as ServoArc;
use std::sync::Arc;
@@ -35,39 +33,27 @@ impl ReplacedContent {
None
}
- pub fn layout<'a>(
+ pub fn make_fragments<'a>(
&'a self,
style: &ServoArc<ComputedValues>,
- containing_block: &ContainingBlock,
- ) -> IndependentLayout {
- let (fragments, content_block_size) = match self.kind {
- ReplacedContentKind::Image(ref image) => {
- // FIXME(nox): We should not assume block size is known.
- let block_size = containing_block.block_size.non_auto().unwrap();
- let fragments = image
- .as_ref()
- .and_then(|image| image.id)
- .map(|image_key| {
- Fragment::Image(ImageFragment {
- style: style.clone(),
- content_rect: flow_relative::Rect {
- start_corner: flow_relative::Vec2::zero(),
- size: flow_relative::Vec2 {
- inline: containing_block.inline_size,
- block: block_size,
- },
- },
- image_key,
- })
+ size: flow_relative::Vec2<Length>,
+ ) -> Vec<Fragment> {
+ match &self.kind {
+ ReplacedContentKind::Image(image) => image
+ .as_ref()
+ .and_then(|image| image.id)
+ .map(|image_key| {
+ Fragment::Image(ImageFragment {
+ style: style.clone(),
+ content_rect: flow_relative::Rect {
+ start_corner: flow_relative::Vec2::zero(),
+ size,
+ },
+ image_key,
})
- .into_iter()
- .collect::<Vec<_>>();
- (fragments, block_size)
- },
- };
- IndependentLayout {
- fragments,
- content_block_size,
+ })
+ .into_iter()
+ .collect(),
}
}
}