layout: Do not consider iframe fragments as contentful for paint timing#42498
layout: Do not consider iframe fragments as contentful for paint timing#42498mrobinson merged 2 commits intoservo:mainfrom
iframe fragments as contentful for paint timing#42498Conversation
6b13ac5 to
ae1fa5d
Compare
| let style = iframe.base.style(); | ||
| match style.get_inherited_box().visibility { | ||
| Visibility::Visible => { | ||
| builder.mark_is_contentful(); |
There was a problem hiding this comment.
Nit: please add the spec text as comment here to explain why we aren't calling this anymore.
There was a problem hiding this comment.
Hmm, I don't have a good feeling about adding a comment for not doing something unless it is TODO or else.
IMHO, it should be other way around mentioning which are contentful.
There was a problem hiding this comment.
I think it makes sense for people reading the code that there is a comment explaining this. Consider that without the comment someone will think it is a bug that an <iframe> isn't considered contentful.
I am curious about this though. Is it that <iframe>s are not considered contentful or simply that <iframe>s that haven't loaded yet are not considered contentful?
There was a problem hiding this comment.
A parent frame should not be aware of the paint events from its child iframes
iframeshould sendFCPto its own browsing context, not top level browser context.
The Fragment::IFrame list is not actually the interior contents of the <iframe>. It is a slot that the child frame's display list will be inserted into during the final paint pass. It doesn't have anything to do with paint events that happen in that child iframe, which happen when the child iframe's display list is built for the child iframe's Document.
|
@shubhamg13 For what it's worth, it's a bit rude to simply refuse a reviewer's request because you disagree. If a reviewer is mistaken (this isn't unusual), then generally you try to resolve the misunderstanding or miscommunication. To simply say, "I don't want to do this" is, in general, not a great way to interact in the project. |
|
Ahh my intention was not that to refuse that. I didn't mean to sound rude. Let me correct that comment. Added a TODO. |
ae1fa5d to
45c4d8c
Compare
iframe should not fire first-contentful-paintiframe should not fire first-contentful-paint in top level browsing context
45c4d8c to
1f07dad
Compare
| match style.get_inherited_box().visibility { | ||
| Visibility::Visible => { | ||
| builder.mark_is_contentful(); | ||
| // TODO: Send FCP for iframe to its own browsing context. |
There was a problem hiding this comment.
So, is this not happening? Each <iframe> is a pipeline and each pipeline has a display list. Each display list checks whether it is contentful or not and then tells the pipeline when the first contentful paint happened.
There was a problem hiding this comment.
As far I remember, currently any FCP reported irrespective of display list is sent to global scope, ideally FCP from iframe should be sent to iframe scope instead.
There was a problem hiding this comment.
If that's an issue though, this change is not fixing it. The presence of this display list item is only applicable to the Document that it is found in. It doesn't have anything to do with the display list of the child frame, other than providing a slot for it in the final rendering.
There was a problem hiding this comment.
To clarify, this fragment is about the wrapper <iframe> in the parent document and doesn't have anything to do with the display list of the child <iframe>. It is not affected at all by paint events that happen in the child <iframe>.
There was a problem hiding this comment.
Your last comment sounds little confusing.
In simplified manner, My motive with this patch is stop firing FCP for any iframe either in parent document or child iframe as of now.
|
@shubhamg13 Out of curiosity, is this change solving an actual issue that you are seeing? |
Actually it is solving Intermittent behaviour by not reporting FCP of iframe (to global scope by default). Yeah, it needs some more efforts and time to properly align as per specs. But as far this seems quite reasonable for now to me. WDYS? |
When you say intermittent behavior are you referring to tests that are no longer intermittent with this change? |
Yes, that's what I mean. This will still require a revisit. That's why I added a TODO. cc: @xiaochengh |
Sorry, I meant to also ask which tests those were specifically? Are they WPT tests? |
mrobinson
left a comment
There was a problem hiding this comment.
Looks good, with one change:
| match style.get_inherited_box().visibility { | ||
| Visibility::Visible => { | ||
| builder.mark_is_contentful(); | ||
| // TODO: Send FCP for iframe to its own browsing context. |
There was a problem hiding this comment.
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:
| // TODO: Send FCP for iframe to its own browsing context. | |
| // 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. |
1f07dad to
0bcdd2a
Compare
iframe should not fire first-contentful-paint in top level browsing contextfirst-contentful-paint for iframe only in its own pipeline
| // > A parent frame should not be aware of the paint events from its child iframes, and | ||
| // > vice versa. | ||
| if builder.webrender_display_list_builder.pipeline_id == | ||
| iframe.pipeline_id.into() |
There was a problem hiding this comment.
This check doesn't make sense to me—an iframe will never contain the pipeline that the current display list builder is building for.
There was a problem hiding this comment.
Yeah that's my concern. (But it saves from marking other pipelines as contentful)
You got my intent, any tip how to achieve that.
There was a problem hiding this comment.
It looks like you're focusing on this specification text:
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.
But the reason for making the change in this PR is not related to this text; the current implementation isn't sending FCP notifications for a child frame to the parent frame. Instead, we should focus on this text:
- If document should report first contentful paint, then:
which links to this text:
- If document contains at least one element that is both paintable and contentful, then return true.
which links to https://www.w3.org/TR/paint-timing/#contentful, which does not include any steps that treat an iframe element as contentful.
Therefore, from my reading, we should never mark the display list as contentful when processing an iframe fragment.
There was a problem hiding this comment.
Completely agree with all your explanations.
If I understood completely. Following is summary:
- if iframe contains an image, it will mark FCP within its own scope without notifying parent.
- As iframe will be treated as a separate document, it should have its own paint timings irrespective of parent document.
0bcdd2a to
50a8e1c
Compare
first-contentful-paint for iframe only in its own pipelineiframe should not fire first-contentful-paint in top level browsing context
Signed-off-by: Shubham Gupta <[email protected]>
Signed-off-by: Shubham Gupta <[email protected]>
50a8e1c to
6d0dd39
Compare
iframe should not fire first-contentful-paint in top level browsing contextiframe fragments at contentful for paint timing
iframe fragments at contentful for paint timingiframe fragments as contentful for paint timing
`iframe` should be considered for `first-paint`. TODO of: #42975 Synced: web-platform-tests/wpt#58243 Refer for some history: #42498 Testing: - `wpt/paint-timing/first-paint-only/child-painting-first-image.html` - `wpt/paint-timing/first-paint-only/sibling-painting-first-image.html` Fixes: #42455 --------- Signed-off-by: Shubham Gupta <[email protected]>

This aligns
first-contentful-paintaboutiframeaccording to specs, Step: 10.2.1.Testing: Update WPT tests expectations.