RESOLVED FIXED 229488
Re-generalize top layer element concept
https://bugs.webkit.org/show_bug.cgi?id=229488
Summary Re-generalize top layer element concept
Ryosuke Niwa
Reported 2021-08-25 00:41:02 PDT
After https://commits.webkit.org/r281548, the concept of top layer is confined to dialog element. Re-generalize this concept for all elements so that we can use it in the full screen element. We'd introduce a new node flag to avoid incurring any perf cost.
Attachments
Patch (10.45 KB, patch)
2021-08-25 00:49 PDT, Ryosuke Niwa
no flags
Patch for landing (10.91 KB, patch)
2021-08-30 13:13 PDT, Ryosuke Niwa
no flags
Patch for landing (10.91 KB, patch)
2021-08-30 16:13 PDT, Ryosuke Niwa
no flags
Patch for landing (10.91 KB, patch)
2021-08-30 16:15 PDT, Ryosuke Niwa
no flags
Ryosuke Niwa
Comment 1 2021-08-25 00:49:56 PDT
Tim Nguyen (:ntim)
Comment 2 2021-08-25 06:24:30 PDT
Comment on attachment 436377 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=436377&action=review > Source/WebCore/dom/Document.cpp:8474 > m_topLayerElements.appendOrMoveToLast(element); RELEASE_ASSERT(&element.document() == this && element.isConnected() && !element.isInTopLayer()); m_topLayerElements.append(element); Since we're asserting `!element.isInTopLayer()`, let's use append() given the moveToLast case should not be possible. moveToLast was supposed to be to follow spec words: "To add an element to a top layer, remove it from top layer and then append it to top layer." Though according to both the dialog and fullscreen specs, movingToLast is not a case that can't happen: dialog requires checking dialog not being in top layer before adding it in, fullscreen does not allow dialogs to be fullscreened. Some other specs use the top layer (google's <popup> element), but they're not heavily implemented yet.
Antti Koivisto
Comment 3 2021-08-27 08:38:06 PDT
Comment on attachment 436377 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=436377&action=review > Source/WebCore/dom/Element.cpp:3398 > + invalidateStyle(); I think this can use invalidateStyleInternal(). The difference is that invalidateStyle() may also invalidate siblings. That is only needed for things that flip pseudo classes (yes, these need better names).
Ryosuke Niwa
Comment 4 2021-08-30 13:08:43 PDT
(In reply to Tim Nguyen (:ntim) from comment #2) > Comment on attachment 436377 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=436377&action=review > > > Source/WebCore/dom/Document.cpp:8474 > > m_topLayerElements.appendOrMoveToLast(element); > > RELEASE_ASSERT(&element.document() == this && element.isConnected() && > !element.isInTopLayer()); > m_topLayerElements.append(element); > > Since we're asserting `!element.isInTopLayer()`, let's use append() given > the moveToLast case should not be possible. Yeah, I was thinking that. Will do. (In reply to Antti Koivisto from comment #3) > Comment on attachment 436377 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=436377&action=review > > > Source/WebCore/dom/Element.cpp:3398 > > + invalidateStyle(); > > I think this can use invalidateStyleInternal(). The difference is that > invalidateStyle() may also invalidate siblings. That is only needed for > things that flip pseudo classes (yes, these need better names). Okay, will do. I guess I'd let it cycle through EWS again to be safe.
Ryosuke Niwa
Comment 5 2021-08-30 13:11:39 PDT
Huh, I just noticed that we're leaking top layer elements. I'd fix that as well.
Ryosuke Niwa
Comment 6 2021-08-30 13:12:12 PDT
(In reply to Ryosuke Niwa from comment #5) > Huh, I just noticed that we're leaking top layer elements. I'd fix that as > well. Clarify: we'd be leaking the entire document whenever there is a top layer element when the document loses its last ref.
Ryosuke Niwa
Comment 7 2021-08-30 13:13:27 PDT
Created attachment 436804 [details] Patch for landing
Ryosuke Niwa
Comment 8 2021-08-30 13:34:36 PDT
Comment on attachment 436804 [details] Patch for landing Wait for EWS.
EWS
Comment 9 2021-08-30 15:05:32 PDT
Found 5 new test failures: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-cancel-with-select.html, imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-return-value.html, imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/element-removed-from-top-layer-has-original-position.html, imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-display-contents.html, imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-display-none.html
Ryosuke Niwa
Comment 10 2021-08-30 16:13:09 PDT
Created attachment 436823 [details] Patch for landing
Ryosuke Niwa
Comment 11 2021-08-30 16:15:04 PDT
Created attachment 436824 [details] Patch for landing
EWS
Comment 12 2021-08-31 00:40:58 PDT
Committed r281793 (241130@main): <https://commits.webkit.org/241130@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 436824 [details].
Radar WebKit Bug Importer
Comment 13 2021-08-31 00:41:31 PDT
Tim Nguyen (:ntim)
Comment 14 2021-08-31 07:54:07 PDT
*** Bug 229149 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.