Repository: servo/servo
File: components/script/dom/window.rs (Rust)

Code before:
    pub(crate) fn layout_reflow(&self, query_msg: QueryMsg) {
        self.reflow(ReflowGoal::LayoutQuery(query_msg));
    }

    pub(crate) fn resolved_font_style_query(
        &self,
        node: &Node,
        value: String,
    ) -> Option<ServoArc<Font>> {
        self.layout_reflow(QueryMsg::ResolvedFontStyleQuery);

        let document = self.Document();
        let animations = document.animations().sets.clone();
        self.layout.borrow().query_resolved_font_style(
            node.to_trusted_node_address(),
            &value,
            animations,
            document.current_animation_timeline_value(),
        )
    }

    /// Do the same kind of query as `Self::padding_top_and_left_query`, but do not force a reflow.
    /// This is used for things like `IntersectionObserver` which should observe the value
    /// from the most recent reflow, but do not need it to reflect the current state of
    /// the DOM / style.
    pub(crate) fn padding_top_and_left_query_without_reflow(
        &self,
        node: &Node,
    ) -> Option<(Au, Au)> {
        let layout = self.layout.borrow();
        layout.query_padding_top_and_left(node.to_trusted_node_address())
    }

    pub(crate) fn padding_top_and_left_query(&self, node: &Node) -> Option<(Au, Au)> {
        self.layout_reflow(QueryMsg::PaddingTopAndLeftQuery);
        self.padding_top_and_left_query_without_reflow(node)
    }

    /// Do the same kind of query as `Self::box_area_query`, but do not force a reflow.
    /// This is used for things like `IntersectionObserver` which should observe the value
    /// from the most recent reflow, but do not need it to reflect the current state of
    /// the DOM / style.
    pub(crate) fn box_area_query_without_reflow(
        &self,
        node: &Node,
        area: BoxAreaType,
    ) -> Option<UntypedRect<Au>> {
        let layout = self.layout.borrow();
        layout.ensure_stacking_context_tree(self.viewport_details.get());
        layout.query_box_area(node.to_trusted_node_address(), area)
    }

Review comment (suggestion):
If this is only used here, I guess it doesn't need to be `pub(crate)`. I'm not sure if you plan was to use this in `ResizeObsever` though...

Code after:
        // See <https://github.com/servo/servo/issues/14719>
        if self.Document().update_the_rendering().needs_frame() {
            self.compositor_api().generate_frame();
        }
    }

    pub(crate) fn layout_blocked(&self) -> bool {
        self.layout_blocker.get().layout_blocked()
    }

    /// Trigger a reflow that is required by a certain queries.
    pub(crate) fn layout_reflow(&self, query_msg: QueryMsg) {
        self.reflow(ReflowGoal::LayoutQuery(query_msg));
    }

    pub(crate) fn resolved_font_style_query(
        &self,
        node: &Node,
        value: String,
    ) -> Option<ServoArc<Font>> {
        self.layout_reflow(QueryMsg::ResolvedFontStyleQuery);

        let document = self.Document();
        let animations = document.animations().sets.clone();
        self.layout.borrow().query_resolved_font_style(
            node.to_trusted_node_address(),
            &value,
            animations,
            document.current_animation_timeline_value(),
        )
    }

    /// Query the used padding values for the given node, but do not force a reflow.
    /// This is used for things like `ResizeObserver` which should observe the value
    /// from the most recent reflow, but do not need it to reflect the current state of
    /// the DOM / style.
    pub(crate) fn padding_query_without_reflow(&self, node: &Node) -> Option<PhysicalSides> {
        let layout = self.layout.borrow();
        layout.query_padding(node.to_trusted_node_address())
    }

    /// Do the same kind of query as `Self::box_area_query`, but do not force a reflow.
    /// This is used for things like `IntersectionObserver` which should observe the value
    /// from the most recent reflow, but do not need it to reflect the current state of
    /// the DOM / style.
    pub(crate) fn box_area_query_without_reflow(
        &self,
        node: &Node,
        area: BoxAreaType,
    ) -> Option<UntypedRect<Au>> {
        let layout = self.layout.borrow();