RESOLVED FIXED 258907
REGRESSION(265043@main): Fullscreen mode only shows video in some part of the screen on Twitter
https://bugs.webkit.org/show_bug.cgi?id=258907
Summary REGRESSION(265043@main): Fullscreen mode only shows video in some part of the...
Tim Nguyen (:ntim)
Reported 2023-07-05 17:20:04 PDT
Attachments
Patch (5.96 KB, patch)
2023-07-19 21:29 PDT, zalan
no flags
Patch (6.00 KB, patch)
2023-07-19 21:33 PDT, zalan
no flags
Patch (8.85 KB, patch)
2023-07-20 10:55 PDT, zalan
no flags
Patch (12.35 KB, patch)
2023-07-25 17:35 PDT, zalan
no flags
Patch (9.77 KB, patch)
2023-07-25 19:49 PDT, zalan
no flags
Tim Nguyen (:ntim)
Comment 1 2023-07-05 17:44:03 PDT
Tim Nguyen (:ntim)
Comment 2 2023-07-10 04:09:15 PDT
zalan
Comment 3 2023-07-19 21:29:05 PDT
zalan
Comment 4 2023-07-19 21:33:31 PDT
Tim Nguyen (:ntim)
Comment 5 2023-07-19 22:23:57 PDT
Comment on attachment 467078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467078&action=review > Source/WebCore/dom/FullscreenManager.cpp:478 > + RenderBlock::removePositionedObject(downcast<RenderBox>(*renderer)); Note that it's possible that the block is just static before the top layer change (if someone sets `position: static !important;` on a dialog/popover). Not sure if this needs to be guarded conditionally or not, but just mentioning it in case it does. > Source/WebCore/dom/FullscreenManager.cpp:541 > ancestor->addToTopLayer(); We probably want to do this `markRendererDirtyAfterTopLayerChange` logic for all ancestor documents, since when going fullscreen, the ancestor iframe(s) are getting pushed to the top layer as well, so this set up could have the same bug: <div style="width: 500px; height: 500px; will-change: transform"> <iframe src="document-that-calls-request-fullscreen.html" style="container-type: size"> </div>
Tim Nguyen (:ntim)
Comment 6 2023-07-19 22:26:58 PDT
Comment on attachment 467078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467078&action=review >> Source/WebCore/dom/FullscreenManager.cpp:541 >> ancestor->addToTopLayer(); > > We probably want to do this `markRendererDirtyAfterTopLayerChange` logic for all ancestor documents, since when going fullscreen, the ancestor iframe(s) are getting pushed to the top layer as well, so this set up could have the same bug: > > <div style="width: 500px; height: 500px; will-change: transform"> > <iframe src="document-that-calls-request-fullscreen.html" style="container-type: size"> > </div> (So I think the `markRendererDirtyAfterTopLayerChange` logic should either be in `addToTopLayer()` or the for loop)
zalan
Comment 7 2023-07-20 07:25:15 PDT
(In reply to Tim Nguyen (:ntim) from comment #5) > Comment on attachment 467078 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=467078&action=review > > > Source/WebCore/dom/FullscreenManager.cpp:478 > > + RenderBlock::removePositionedObject(downcast<RenderBox>(*renderer)); > > Note that it's possible that the block is just static before the top layer > change (if someone sets `position: static !important;` on a dialog/popover). At this point we are _after_ the style update and from layout perspective, whether or not the author says "static !important", it is still an out-of-flow box and is treated accordingly (see render tree dumps)
Tim Nguyen (:ntim)
Comment 8 2023-07-20 07:51:31 PDT
(In reply to zalan from comment #7) > (In reply to Tim Nguyen (:ntim) from comment #5) > > Comment on attachment 467078 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=467078&action=review > > > > > Source/WebCore/dom/FullscreenManager.cpp:478 > > > + RenderBlock::removePositionedObject(downcast<RenderBox>(*renderer)); > > > > Note that it's possible that the block is just static before the top layer > > change (if someone sets `position: static !important;` on a dialog/popover). > At this point we are _after_ the style update and from layout perspective, > whether or not the author says "static !important", it is still an > out-of-flow box and is treated accordingly (see render tree dumps) In the fullscreen case yes, because of the UA stylesheet forces everything with the fullscreen flag to `position: fixed !important`, but not necessarily dialog/popover (but I guess you're not handling them here so it doesn't matter too much).
Simon Fraser (smfr)
Comment 9 2023-07-20 09:15:23 PDT
Comment on attachment 467078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467078&action=review > Source/WebCore/dom/FullscreenManager.cpp:476 > + ASSERT(renderer->isFixedPositioned()); Can't a top layer element also be position:absolute?
zalan
Comment 10 2023-07-20 09:28:39 PDT
(In reply to Simon Fraser (smfr) from comment #9) > Comment on attachment 467078 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=467078&action=review > > > Source/WebCore/dom/FullscreenManager.cpp:476 > > + ASSERT(renderer->isFixedPositioned()); > > Can't a top layer element also be position:absolute? No, not at this point.
zalan
Comment 11 2023-07-20 10:55:35 PDT
zalan
Comment 12 2023-07-20 10:57:04 PDT
> We probably want to do this `markRendererDirtyAfterTopLayerChange` logic for > all ancestor documents That's a good point. I didn't know subframe could initiate fullscreen all the way to the top.
zalan
Comment 13 2023-07-20 10:58:30 PDT
(In reply to zalan from comment #12) > > We probably want to do this `markRendererDirtyAfterTopLayerChange` logic for > > all ancestor documents > That's a good point. I didn't know subframe could initiate fullscreen all > the way to the top. I haven't managed yet to put such test case together though. iframes work fine when testing manually but for some reason they don't return the correct size when running layout test.
Tim Nguyen (:ntim)
Comment 14 2023-07-20 23:00:22 PDT
Comment on attachment 467081 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467081&action=review I can try to help with the fullscreen testcase > Source/WebCore/dom/FullscreenManager.cpp:532 > + auto containingBlockBeforeStyleUpdate = WeakPtr<RenderBlock> { }; setFullscreenFlag(true) will apply the :fullscreen pseudo class styles, so "BeforeStyleUpdate" is vague here.
zalan
Comment 15 2023-07-21 06:15:07 PDT
(In reply to Tim Nguyen (:ntim) from comment #14) > Comment on attachment 467081 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=467081&action=review > > I can try to help with the fullscreen testcase > > > Source/WebCore/dom/FullscreenManager.cpp:532 > > + auto containingBlockBeforeStyleUpdate = WeakPtr<RenderBlock> { }; > > setFullscreenFlag(true) will apply the :fullscreen pseudo class styles, so > "BeforeStyleUpdate" is vague here. please suggest a better name!
Tim Nguyen (:ntim)
Comment 16 2023-07-24 10:34:59 PDT
(In reply to zalan from comment #15) > (In reply to Tim Nguyen (:ntim) from comment #14) > > Comment on attachment 467081 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=467081&action=review > > > > I can try to help with the fullscreen testcase > > > > > Source/WebCore/dom/FullscreenManager.cpp:532 > > > + auto containingBlockBeforeStyleUpdate = WeakPtr<RenderBlock> { }; > > > > setFullscreenFlag(true) will apply the :fullscreen pseudo class styles, so > > "BeforeStyleUpdate" is vague here. > please suggest a better name! Accurate names could be: - containingBlockBeforeStyleResolution - containingBlockAfterFullscreenStyleChanges oldContainingBlock would be fine too. BeforeStyleUpdate is ambiguous.
Tim Nguyen (:ntim)
Comment 17 2023-07-24 13:27:28 PDT
Comment on attachment 467081 [details] Patch r=me with the var rename + the extra testcase
Tim Nguyen (:ntim)
Comment 18 2023-07-24 13:27:43 PDT
r=me with the var rename + the extra testcase
Tim Nguyen (:ntim)
Comment 19 2023-07-24 13:28:58 PDT
Comment on attachment 467081 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467081&action=review > LayoutTests/fullscreen/fullscreen-containing-block-change.html:14 > + <div style="position: absolute; left: 0; right: 0; top: 100px; bottom: 0; background-color: greenyellow;"></div> optional, but we could assert the width of this descendant too.
zalan
Comment 20 2023-07-25 10:51:47 PDT
I am going to discuss this with Simon before landing.
Simon Fraser (smfr)
Comment 21 2023-07-25 16:20:07 PDT
Comment on attachment 467081 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467081&action=review > Source/WebCore/dom/FullscreenManager.cpp:475 > + // Let's carry out the same set of tasks we would normally do when containg block changes for out-of-flow content. "containg". Can this comment mention the other location this is called? > Source/WebCore/dom/FullscreenManager.cpp:530 > ancestor->setFullscreenFlag(true); Other code uses a Style::PseudoClassChangeInvalidation. Should we do that here? > Source/WebCore/dom/FullscreenManager.cpp:534 > + containingBlockBeforeStyleUpdate = renderer->containingBlock(); Should grab this before setFullscreenFlag(true) > Source/WebCore/dom/FullscreenManager.cpp:543 > + markRendererDirtyAfterTopLayerChange(ancestor->renderer(), containingBlockBeforeStyleUpdate.get()); Do we need the same fix in HTMLElement::showPopover() and HTMLDialogElement::showModal()?
zalan
Comment 22 2023-07-25 17:35:27 PDT
zalan
Comment 23 2023-07-25 19:49:48 PDT
zalan
Comment 24 2023-07-25 19:52:34 PDT
> r=me with the var rename + the extra testcase Had to remove the iframe test case. It was flaky timeout on both of my machines (and that's inline with what I experienced while I was trying to put a test case together)
zalan
Comment 25 2023-07-25 19:58:13 PDT
> Other code uses a Style::PseudoClassChangeInvalidation. Should we do that > here? Maybe? That's a question for Tim. > Do we need the same fix in HTMLElement::showPopover() and > HTMLDialogElement::showModal()? Probably yes, but also we should figure out a better fix to replace this manual handling.
EWS
Comment 26 2023-07-25 20:32:34 PDT
Committed 266309@main (f82dc74981d8): <https://commits.webkit.org/266309@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 467121 [details].
Tim Nguyen (:ntim)
Comment 27 2023-07-25 21:53:57 PDT
(In reply to zalan from comment #25) > > Other code uses a Style::PseudoClassChangeInvalidation. Should we do that > > here? > Maybe? That's a question for Tim. setFullscreenFlag() already uses `Style::PseudoClassChangeInvalidation`, but it's not sufficient, which is why we use `resolveStyle()` (though ideally, we should find out why exactly that is needed and replace it). > > Do we need the same fix in HTMLElement::showPopover() and > > HTMLDialogElement::showModal()? > Probably yes, but also we should figure out a better fix to replace this > manual handling. In showPopover and showModal, we don't resolveStyle() in between adding the styles and adding to the top layer, so this fix isn't needed.
zalan
Comment 28 2023-07-26 08:39:58 PDT
(In reply to Tim Nguyen (:ntim) from comment #27) > (In reply to zalan from comment #25) > > > Other code uses a Style::PseudoClassChangeInvalidation. Should we do that > > > here? > > Maybe? That's a question for Tim. > > setFullscreenFlag() already uses `Style::PseudoClassChangeInvalidation`, but > it's not sufficient, which is why we use `resolveStyle()` (though ideally, > we should find out why exactly that is needed and replace it). > > > > Do we need the same fix in HTMLElement::showPopover() and > > > HTMLDialogElement::showModal()? > > Probably yes, but also we should figure out a better fix to replace this > > manual handling. > > In showPopover and showModal, we don't resolveStyle() in between adding the > styles and adding to the top layer, so this fix isn't needed. Sure, on trunk, but this approach is not future proof (i.e. we should not need to do any kind of manual dirty bit setting at this level)
Tim Nguyen (:ntim)
Comment 29 2023-07-26 08:44:36 PDT
(In reply to zalan from comment #28) > (In reply to Tim Nguyen (:ntim) from comment #27) > > (In reply to zalan from comment #25) > > > > Other code uses a Style::PseudoClassChangeInvalidation. Should we do that > > > > here? > > > Maybe? That's a question for Tim. > > > > setFullscreenFlag() already uses `Style::PseudoClassChangeInvalidation`, but > > it's not sufficient, which is why we use `resolveStyle()` (though ideally, > > we should find out why exactly that is needed and replace it). > > > > > > Do we need the same fix in HTMLElement::showPopover() and > > > > HTMLDialogElement::showModal()? > > > Probably yes, but also we should figure out a better fix to replace this > > > manual handling. > > > > In showPopover and showModal, we don't resolveStyle() in between adding the > > styles and adding to the top layer, so this fix isn't needed. > Sure, on trunk, but this approach is not future proof (i.e. we should not > need to do any kind of manual dirty bit setting at this level) At some point, we'll probably want to rework top layer rendering to be a CSS property, so we can support transitions and other things. I suspect that this will replace this fix.
Simon Fraser (smfr)
Comment 30 2023-07-26 11:29:37 PDT
(In reply to Tim Nguyen (:ntim) from comment #27) > In showPopover and showModal, we don't resolveStyle() in between adding the > styles and adding to the top layer, so this fix isn't needed. Right, but why do we need to resolveStyle in the fullscreen case?
Tim Nguyen (:ntim)
Comment 31 2023-07-26 14:28:55 PDT
(In reply to Simon Fraser (smfr) from comment #30) > (In reply to Tim Nguyen (:ntim) from comment #27) > > In showPopover and showModal, we don't resolveStyle() in between adding the > > styles and adding to the top layer, so this fix isn't needed. > > Right, but why do we need to resolveStyle in the fullscreen case? Needs more investigation, but this predates the new fullscreen API fwiw. If I remove it, I recall a bunch of assertions on fullscreen tests.
Note You need to log in before you can comment on or make changes to this bug.