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

Code before:
                                &common,
                            );
                        }

                        let lcp_candidate_id = image
                            .base
                            .tag
                            .map(|tag| LCPCandidateID(tag.node.id()))
                            .unwrap_or(LCPCandidateID(0));
                        builder.collect_lcp_candidate(
                            LargestContentfulPaintType::Image,
                            lcp_candidate_id,
                            common.clip_rect,
                            rect,
                        );
                    },
                    Visibility::Hidden => (),
                    Visibility::Collapse => (),
                }
            },
            Fragment::IFrame(iframe) => {
                let iframe = iframe.borrow();
                let style = iframe.base.style();
                match style.get_inherited_box().visibility {
                    Visibility::Visible => {
                        // TODO: Send FCP for iframe to its own browsing context.
                        let rect = iframe
                            .base
                            .rect
                            .translate(containing_block.origin.to_vector());

                        let common = builder.common_properties(rect.to_webrender(), &style);
                        builder.wr().push_iframe(
                            rect.to_webrender(),
                            common.clip_rect,
                            &wr::SpaceAndClipInfo {
                                spatial_id: common.spatial_id,
                                clip_chain_id: common.clip_chain_id,
                            },
                            iframe.pipeline_id.into(),
                            true,
                        );
                    },
                    Visibility::Hidden => (),
                    Visibility::Collapse => (),
                }
            },
            Fragment::Text(text) => {
                let text = &*text.borrow();
                match text.base.style().get_inherited_box().visibility {
                    Visibility::Visible => self.build_display_list_for_text_fragment(

Review comment (bug):
I think that the TODO is probably wrong, as it's already the case that paint events are sent to their browsing context, right? That said, I think @TimvdLippe original suggestion was to just put the specification text here, so let's do that:


```suggestion
                        // From <https://www.w3.org/TR/paint-timing/>:
                        // > A parent frame should not be aware of the paint events from its child iframes, and
                        // > vice versa. This means that a frame that contains just iframes will have first paint 
                        // > (due to the enclosing boxes of the iframes) but no first contentful paint.
```

Code after:
                                &common,
                            );
                        }

                        let lcp_candidate_id = image
                            .base
                            .tag
                            .map(|tag| LCPCandidateID(tag.node.id()))
                            .unwrap_or(LCPCandidateID(0));
                        builder.collect_lcp_candidate(
                            LargestContentfulPaintType::Image,
                            lcp_candidate_id,
                            common.clip_rect,
                            rect,
                        );
                    },
                    Visibility::Hidden => (),
                    Visibility::Collapse => (),
                }
            },
            Fragment::IFrame(iframe) => {
                let iframe = iframe.borrow();
                let style = iframe.base.style();
                match style.get_inherited_box().visibility {
                    Visibility::Visible => {
                        // From <https://www.w3.org/TR/paint-timing/#mark-paint-timing>:
                        // > A parent frame should not be aware of the paint events from its child iframes, and
                        // > vice versa. This means that a frame that contains just iframes will have first paint
                        // > (due to the enclosing boxes of the iframes) but no first contentful paint.
                        let rect = iframe
                            .base
                            .rect
                            .translate(containing_block.origin.to_vector());

                        let common = builder.common_properties(rect.to_webrender(), &style);
                        builder.wr().push_iframe(
                            rect.to_webrender(),
                            common.clip_rect,
                            &wr::SpaceAndClipInfo {
                                spatial_id: common.spatial_id,
                                clip_chain_id: common.clip_chain_id,
                            },
                            iframe.pipeline_id.into(),
                            true,
                        );
                    },
                    Visibility::Hidden => (),
                    Visibility::Collapse => (),
                }
            },
            Fragment::Text(text) => {