Repository: servo/servo
File: components/layout/replaced.rs (Rust)

Code before:
                    .get_cached_image_for_url(
                        node.opaque(),
                        svg_source,
                        LayoutImageDestination::BoxTreeConstruction,
                    )
                    .ok();

                let vector_image = result.map(|result| match result {
                    Image::Vector(vector_image) => vector_image,
                    _ => unreachable!("SVG element can't contain a raster image."),
                });

                let rule_cache_conditions = &mut RuleCacheConditions::default();
                let parent_style = &node.selected_style();
                let style_builder = StyleBuilder::new(
                    context.style_context.stylist.device(),
                    Some(context.style_context.stylist),
                    Some(parent_style),
                    None,
                    None,
                    false,
                );

                let to_computed_context = Context::new(
                    style_builder,
                    QuirksMode::Quirks,
                    rule_cache_conditions,
                    ContainerSizeQuery::none(),
                );

                let attr_to_computed = |attr_val: &AttrValue| {
                    if let AttrValue::Length(_, length) = attr_val {
                        length.to_computed_value(&to_computed_context)
                    } else {
                        None
                    }
                };
                let width = svg_data.width.and_then(attr_to_computed);
                let height = svg_data.height.and_then(attr_to_computed);

                let ratio = if let (Some(width), Some(height)) = (width, height) &&
                    !width.is_zero() &&
                    !height.is_zero()
                {
                    Some(width.px() / height.px())
                } else {
                    svg_data.view_box.and_then(|view_box| {
                        let mut iter = view_box.chars();
                        let _min_x = parse_integer(&mut iter).ok()?;
                        let _min_y = parse_integer(&mut iter).ok()?;
                        let width = parse_unsigned_integer(&mut iter).ok()?;

Review comment (suggestion):
```suggestion
                    context.style_context.quirks_mode(),
```

Code after:
        if let ReplacedContentKind::Image(Some(Image::Raster(ref image)), _) = kind {
            context
                .image_resolver
                .handle_animated_image(node.opaque(), image.clone());
        }

        Some(Self {
            kind,
            natural_size,
            base_fragment_info: node.into(),
        })
    }

    fn svg_kind_size(
        svg_data: SVGElementData,
        context: &LayoutContext,
        node: ServoThreadSafeLayoutNode<'_>,
    ) -> Option<(ReplacedContentKind, NaturalSizes)> {
        let rule_cache_conditions = &mut RuleCacheConditions::default();

        let parent_style = node.style(&context.style_context);
        let style_builder = StyleBuilder::new(
            context.style_context.stylist.device(),
            Some(context.style_context.stylist),
            Some(&parent_style),
            None,
            None,
            false,
        );

        let to_computed_context = Context::new(
            style_builder,
            context.style_context.quirks_mode(),
            rule_cache_conditions,
            ContainerSizeQuery::none(),
        );

        let attr_to_computed = |attr_val: &AttrValue| {
            if let AttrValue::Length(_, length) = attr_val {
                length.to_computed_value(&to_computed_context)
            } else {
                None
            }
        };
        let width = svg_data.width.and_then(attr_to_computed);
        let height = svg_data.height.and_then(attr_to_computed);

        let ratio = if let (Some(width), Some(height)) = (width, height) {
            if !width.is_zero() && !height.is_zero() {
                Some(width.px() / height.px())
            } else {