RESOLVED FIXED 236710
[content-visibility] Add support for css content-visibility: hidden
https://bugs.webkit.org/show_bug.cgi?id=236710
Summary [content-visibility] Add support for css content-visibility: hidden
Attachments
Initial patch (38.42 KB, patch)
2022-02-28 09:38 PST, Rob Buis
no flags
Improved patch (39.19 KB, patch)
2022-03-01 06:29 PST, Rob Buis
no flags
Better ChangeLog. (39.90 KB, patch)
2022-03-02 06:43 PST, Rob Buis
no flags
Fix some more test expectations (41.39 KB, patch)
2022-03-02 08:54 PST, Rob Buis
no flags
Build fix (41.42 KB, patch)
2022-03-10 01:54 PST, Rob Buis
no flags
Improve top layers (41.96 KB, patch)
2022-03-16 04:06 PDT, Rob Buis
no flags
Improve top layer support (43.00 KB, patch)
2022-03-24 08:55 PDT, Rob Buis
no flags
Rebase and adjust containsLayout etc. (51.73 KB, patch)
2022-03-30 07:50 PDT, Rob Buis
no flags
Rebase (51.41 KB, patch)
2022-04-20 07:40 PDT, Rob Buis
no flags
Drop layoutPositionedObject change (51.52 KB, patch)
2022-04-22 02:31 PDT, Rob Buis
no flags
Rebase (51.60 KB, patch)
2022-04-27 03:04 PDT, Rob Buis
no flags
Rebase (51.05 KB, patch)
2022-05-05 01:49 PDT, Rob Buis
no flags
Fix r293943 regression (59.80 KB, patch)
2022-05-11 05:58 PDT, Rob Buis
no flags
Fix ChangeLog and Tim's comment (60.76 KB, patch)
2022-05-11 08:12 PDT, Rob Buis
no flags
Remove ChangeLogs (58.89 KB, patch)
2022-05-18 02:07 PDT, Rob Buis
no flags
New approach to top layers (59.20 KB, patch)
2022-05-18 07:19 PDT, Rob Buis
no flags
Fix content-visibility-with-top-layer-003.tentative.html (59.53 KB, patch)
2022-05-19 09:20 PDT, Rob Buis
no flags
Adapt to https://bugs.webkit.org/show_bug.cgi?id=240906 (49.84 KB, patch)
2022-05-26 04:03 PDT, Rob Buis
no flags
Rebase (49.92 KB, patch)
2022-06-08 01:32 PDT, Rob Buis
no flags
Patch (45.47 KB, patch)
2022-08-12 03:24 PDT, Rob Buis
no flags
Patch (49.80 KB, patch)
2022-08-25 04:31 PDT, Rob Buis
no flags
Patch (51.47 KB, patch)
2022-08-30 06:24 PDT, Rob Buis
no flags
Patch (50.88 KB, patch)
2022-08-31 02:04 PDT, Rob Buis
no flags
Patch (50.33 KB, patch)
2022-08-31 03:23 PDT, Rob Buis
no flags
Patch (50.67 KB, patch)
2022-09-02 07:28 PDT, Rob Buis
no flags
Patch (51.39 KB, patch)
2022-09-28 01:59 PDT, Rob Buis
no flags
Patch (40.39 KB, patch)
2022-09-28 03:29 PDT, Rob Buis
no flags
Patch (45.13 KB, patch)
2022-09-28 06:17 PDT, Rob Buis
no flags
Patch (43.17 KB, patch)
2022-09-28 07:14 PDT, Rob Buis
no flags
Patch (42.80 KB, patch)
2022-09-28 13:24 PDT, Rob Buis
no flags
Patch (43.70 KB, patch)
2022-11-01 03:53 PDT, Rob Buis
no flags
Radar WebKit Bug Importer
Comment 1 2022-02-23 09:24:31 PST
Rob Buis
Comment 2 2022-02-28 09:38:10 PST
Created attachment 453398 [details] Initial patch Initial patch
Rob Buis
Comment 3 2022-03-01 06:29:29 PST
Created attachment 453495 [details] Improved patch This patch keeps track of c-v state even when there is no renderer created (display: none).
Rob Buis
Comment 4 2022-03-02 06:43:30 PST
Created attachment 453602 [details] Better ChangeLog. Better ChangeLog.
Rob Buis
Comment 5 2022-03-02 08:54:07 PST
Created attachment 453619 [details] Fix some more test expectations Fix some more test expectations
Rob Buis
Comment 6 2022-03-10 01:54:36 PST
Created attachment 454326 [details] Build fix
Rob Buis
Comment 7 2022-03-16 04:06:28 PDT
Created attachment 454820 [details] Improve top layers Improve top layers
Rob Buis
Comment 8 2022-03-21 07:18:41 PDT
For some of the top level layer issues we probably need resolution here first: https://github.com/w3c/csswg-drafts/issues/7163
Rob Buis
Comment 9 2022-03-24 08:55:31 PDT
Created attachment 455644 [details] Improve top layer support Improve top layer support
Emilio Cobos Álvarez (:emilio)
Comment 10 2022-03-24 11:41:00 PDT
Comment on attachment 455644 [details] Improve top layer support View in context: https://bugs.webkit.org/attachment.cgi?id=455644&action=review > Source/WebCore/dom/Element.cpp:4806 > + child.updateContentVisibilityData(shouldSkip, contentVisibility); How do you update children on new DOM mutations? Also, shouldn't this use the composed / flattened tree?
Rob Buis
Comment 11 2022-03-30 01:51:41 PDT
Comment on attachment 455644 [details] Improve top layer support View in context: https://bugs.webkit.org/attachment.cgi?id=455644&action=review >> Source/WebCore/dom/Element.cpp:4806 >> + child.updateContentVisibilityData(shouldSkip, contentVisibility); > > How do you update children on new DOM mutations? Also, shouldn't this use the composed / flattened tree? What kind of new DOM mutations do you mean? I did some local tests (create whole c-v tree dynamically, just add a text node or element to the c-v subtree) and things seem to work with c-v: hidden. It is possible the state will not be updated (immediately) in such cases, but the painting will stop at a higher level so it should not cause rendering issues. Having said that, feel free to share some tricky test scenarios :) I am sure more WPT tests here are welcome.
Rob Buis
Comment 12 2022-03-30 07:50:30 PDT
Created attachment 456123 [details] Rebase and adjust containsLayout etc. Rebase and adjust containsLayout etc.
Rob Buis
Comment 13 2022-04-20 07:40:17 PDT
Created attachment 457988 [details] Rebase Rebase.
Rob Buis
Comment 14 2022-04-22 02:31:38 PDT
Created attachment 458124 [details] Drop layoutPositionedObject change Drop layoutPositionedObject change
Rob Buis
Comment 15 2022-04-27 03:04:40 PDT
Created attachment 458435 [details] Rebase Rebase
Rob Buis
Comment 16 2022-05-05 01:49:54 PDT
Created attachment 458860 [details] Rebase Rebase
cathiechen
Comment 17 2022-05-09 08:49:59 PDT
Comment on attachment 458860 [details] Rebase View in context: https://bugs.webkit.org/attachment.cgi?id=458860&action=review > Source/WebCore/dom/Element.cpp:3583 > + return false; It looks like we can remove this one, for `!isFocusableStyle(style)` already be true if `isSkippedContent() == ture`.
cathiechen
Comment 18 2022-05-10 01:58:58 PDT
Comment on attachment 458860 [details] Rebase View in context: https://bugs.webkit.org/attachment.cgi?id=458860&action=review > Source/WebCore/dom/Element.cpp:4780 > + shouldSkip |= parent->isSkippedContent(); Looks like we can move this out of the function, and call `updateContentVisibilityData(parent->isSkippedContent(), newContentVisibility)` instead of `updateContentVisibilityData(false, newContentVisibility)` in `Element::updateContentVisibility`
Tim Nguyen (:ntim)
Comment 19 2022-05-10 03:41:22 PDT
Comment on attachment 458860 [details] Rebase View in context: https://bugs.webkit.org/attachment.cgi?id=458860&action=review > LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-with-top-layer-003.tentative.html:14 > +.hidden { ontent-visibility: hidden } What is this change about? > Source/WebCore/dom/Element.cpp:3405 > + if (isSkippedContent()) > + return; This is kinda surprising to me, what bit of the spec says this? > Source/WebCore/dom/Element.cpp:4820 > +void Element::updateDescendantTopLayerElements(ContentVisibility newContentVisibility) > +{ > + auto topLayers = document().topLayerElements(); > + for (auto topLayerElement : topLayers) { > + for (auto* ancestor = topLayerElement.ptr(); ancestor; ancestor = ancestor->parentElementInComposedTree()) { > + if (ancestor == this) { > + if (newContentVisibility == ContentVisibility::Visible) { > + if (!topLayerElement->isInTopLayer()) > + topLayerElement->addToTopLayer(); > + } else if (newContentVisibility == ContentVisibility::Hidden) { > + if (topLayerElement->isInTopLayer()) > + topLayerElement->removeFromTopLayer(); > + } > + break; > + } > + } > + } > +} Not sure I'm understanding how this works? Is this trying to add/remove layers based on the node flag? I'm confused why the DOM side of the top layer logic should be touched here. Isn't this a layout feature?
Rob Buis
Comment 20 2022-05-10 04:04:59 PDT
Comment on attachment 458860 [details] Rebase View in context: https://bugs.webkit.org/attachment.cgi?id=458860&action=review >> LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-with-top-layer-003.tentative.html:14 >> +.hidden { ontent-visibility: hidden } > > What is this change about? I wanted to try something local at the time, but clearly this change is unwanted indeed. Thanks for pointing that one out! Note that the patch is not up for review for a reason though :) >> Source/WebCore/dom/Element.cpp:3405 >> + return; > > This is kinda surprising to me, what bit of the spec says this? I think this is https://drafts.csswg.org/css-contain/#content-visibility 4.3.11. >> Source/WebCore/dom/Element.cpp:4820 >> +} > > Not sure I'm understanding how this works? Is this trying to add/remove layers based on the node flag? > > I'm confused why the DOM side of the top layer logic should be touched here. Isn't this a layout feature? I am back to work on this tomorrow, will have a look then, this code is from quite some time ago.
Tim Nguyen (:ntim)
Comment 21 2022-05-10 12:25:14 PDT
(In reply to Rob Buis from comment #20) > >> Source/WebCore/dom/Element.cpp:3405 > >> + return; > > > > This is kinda surprising to me, what bit of the spec says this? > > I think this is https://drafts.csswg.org/css-contain/#content-visibility > 4.3.11. > > >> Source/WebCore/dom/Element.cpp:4820 > >> +} > > > > Not sure I'm understanding how this works? Is this trying to add/remove layers based on the node flag? > > > > I'm confused why the DOM side of the top layer logic should be touched here. Isn't this a layout feature? > > I am back to work on this tomorrow, will have a look then, this code is from > quite some time ago. Looking at step 4.3.11, we shouldn't touch the DOM side of things at all for the top layer. Doing this will cause the top layer z-order to change (e.g. when stacking multiple dialogs). I think you probably want more fine-grained code targeted towards the renderer/layers parts.
Rob Buis
Comment 22 2022-05-11 05:57:29 PDT
Comment on attachment 458860 [details] Rebase View in context: https://bugs.webkit.org/attachment.cgi?id=458860&action=review >> Source/WebCore/dom/Element.cpp:3583 >> + return false; > > It looks like we can remove this one, for `!isFocusableStyle(style)` already be true if `isSkippedContent() == ture`. Correct, will remove.
Rob Buis
Comment 23 2022-05-11 05:58:20 PDT
Created attachment 459160 [details] Fix r293943 regression Fix r293943 regression.
Rob Buis
Comment 24 2022-05-11 08:12:25 PDT
Created attachment 459167 [details] Fix ChangeLog and Tim's comment
Rob Buis
Comment 25 2022-05-11 08:13:00 PDT
Comment on attachment 458860 [details] Rebase View in context: https://bugs.webkit.org/attachment.cgi?id=458860&action=review >>> LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-with-top-layer-003.tentative.html:14 >>> +.hidden { ontent-visibility: hidden } >> >> What is this change about? > > I wanted to try something local at the time, but clearly this change is unwanted indeed. Thanks for pointing that one out! Note that the patch is not up for review for a reason though :) I now removed the change, unfortunately we do not pass this test yet.
Rob Buis
Comment 26 2022-05-18 02:07:35 PDT
Created attachment 459532 [details] Remove ChangeLogs Remove ChangeLogs.
Rob Buis
Comment 27 2022-05-18 07:19:07 PDT
Created attachment 459541 [details] New approach to top layers New approach to top layers.
Rob Buis
Comment 28 2022-05-19 09:20:16 PDT
Created attachment 459592 [details] Fix content-visibility-with-top-layer-003.tentative.html
Rob Buis
Comment 29 2022-05-26 04:03:07 PDT
Rob Buis
Comment 30 2022-06-08 01:32:30 PDT
Rob Buis
Comment 31 2022-08-12 03:24:13 PDT
Rob Buis
Comment 32 2022-08-25 04:31:55 PDT
Rob Buis
Comment 33 2022-08-30 06:24:44 PDT
Rob Buis
Comment 34 2022-08-31 02:04:06 PDT
Rob Buis
Comment 35 2022-08-31 03:23:57 PDT
Rob Buis
Comment 36 2022-09-02 07:28:00 PDT
Rob Buis
Comment 37 2022-09-28 01:59:13 PDT
Rob Buis
Comment 38 2022-09-28 03:29:10 PDT
Rob Buis
Comment 39 2022-09-28 06:17:13 PDT
Rob Buis
Comment 40 2022-09-28 07:14:37 PDT
Rob Buis
Comment 41 2022-09-28 13:24:44 PDT
cathiechen
Comment 42 2022-10-03 11:56:17 PDT
Rob Buis
Comment 43 2022-11-01 03:53:33 PDT
EWS
Comment 44 2022-11-01 07:42:34 PDT
Committed 256186@main (34f748c71e8d): <https://commits.webkit.org/256186@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 463339 [details].
Note You need to log in before you can comment on or make changes to this bug.