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

Code before:
    let parent_style = if node.is_connected() {
        if element.has_data() {
            node.to_threadsafe().as_element().unwrap().style(context)
        } else {
            let mut tlc = ThreadLocalStyleContext::new();
            let mut context = StyleContext {
                shared: context,
                thread_local: &mut tlc,
            };
            let styles = resolve_style(&mut context, element, RuleInclusion::All, None, None);
            styles.primary().clone()
        }
    } else {
        let default_declarations =
            create_font_declaration("10px sans-serif", &url_data, quirks_mode).unwrap();
        resolve_for_declarations::<E>(context, None, default_declarations, shared_lock)
    };

    // 3. Resolve the parsed value with resolved styles of the parent element
    let computed_values =
        resolve_for_declarations::<E>(context, Some(&*parent_style), declarations, shared_lock);

    Some(computed_values.clone_font())
}

pub fn transform_au_rectangle(
    rect_to_transform: Rect<Au>,
    transform: FastLayoutTransform,
) -> Option<Rect<Au>> {
    let rect_to_transform = &au_rect_to_f32_rect(rect_to_transform).cast_unit();
    let outer_transformed_rect = match transform {
        FastLayoutTransform::Offset(offset) => Some(rect_to_transform.translate(offset)),
        FastLayoutTransform::Transform { transform, .. } => {
            transform.outer_transformed_rect(rect_to_transform)
        },
    };
    outer_transformed_rect
        .map(|transformed_rect| f32_rect_to_au_rect(transformed_rect.to_untyped()))
}


Review comment (suggestion):
```suggestion
pub(crate) fn transform_au_rectangle(
```

Code after:
    let parent_style = if node.is_connected() {
        if element.has_data() {
            node.to_threadsafe().as_element().unwrap().style(context)
        } else {
            let mut tlc = ThreadLocalStyleContext::new();
            let mut context = StyleContext {
                shared: context,
                thread_local: &mut tlc,
            };
            let styles = resolve_style(&mut context, element, RuleInclusion::All, None, None);
            styles.primary().clone()
        }
    } else {
        let default_declarations =
            create_font_declaration("10px sans-serif", &url_data, quirks_mode).unwrap();
        resolve_for_declarations::<E>(context, None, default_declarations, shared_lock)
    };

    // 3. Resolve the parsed value with resolved styles of the parent element
    let computed_values =
        resolve_for_declarations::<E>(context, Some(&*parent_style), declarations, shared_lock);

    Some(computed_values.clone_font())
}

pub(crate) fn transform_au_rectangle(
    rect_to_transform: Rect<Au>,
    transform: FastLayoutTransform,
) -> Option<Rect<Au>> {
    let rect_to_transform = &au_rect_to_f32_rect(rect_to_transform).cast_unit();
    let outer_transformed_rect = match transform {
        FastLayoutTransform::Offset(offset) => Some(rect_to_transform.translate(offset)),
        FastLayoutTransform::Transform { transform, .. } => {
            transform.outer_transformed_rect(rect_to_transform)
        },
    };
    outer_transformed_rect
        .map(|transformed_rect| f32_rect_to_au_rect(transformed_rect.to_untyped()))
}