DL: Dealing with forced layouts |
|||
Issue descriptionIn https://github.com/chrishtr/display-locking/issues/21 we've resolved to force a layout when a layout is forced. I think one way to accomplish this would be to separate the position/size of the locked element for siblings/ancestors and for the descendants. This is to ensure that percent height/width children see the right value from the container. That is, we would lay out and have the "pending size/position" which is directly visible to the descendants but not visible to the siblings or ancestors. I think it's a pretty big change and somewhat difficult to get all the cases right (hence a separate bug). One question: I think there are cases where the size of the element is determined by the ancestor in conjunction with other siblings. (I'm thinking of flexbox or something, but I'm not entirely sure if it can size the children divs). If that's possible then it becomes extra weird: the ancestor would determine the size for the element, which would only be visible to the children of that element, but then it still needs to size its siblings, so... does it read off the value again and see that it's 0 or something? If this is not possible, then I don't think that's a big issue.
,
Nov 21
,
Nov 22
I think that if we force layouts then it should just force the whole page's layout, including the locked subtrees. This will cause the layout to reflect the size and position of the locked elements, and may cause layout instability/etc. I think this should be straightforward to implement without the complexity mentioned...WDYT?
,
Nov 22
I don't think I understand what your idea is, vmpstr. Testcase?
,
Nov 23
To elaborate a bit, the idea of display locking is that one would lock an element before inserting it into the tree, then insert it. However, at this point the element does not contribute to layout. That is, it doesn't move boxes around and it does not, itself, take up any space. If, however, while in this state, the dev calls something like offsetTop on an element in a locked subtree, a value that can only be computed after layout has happened, we would need to force a layout. My initial comment was that we _could_ do this _and_ preserve the fact that the element takes no space on the page by layout out the subtree in such a way that it can see how much the locked element _would_ take up. That is, a size that is only available to the descendants. However, that's pretty difficult. I like chrishtr's comment that we should just force a true layout meaning the locked element would now take up space, and move neighbouring boxes around. And yes, I think that's straightforward to implement. I'll go ahead and do that.
,
Dec 6
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/43a377d1697ac74ec5e45f739ee90becbcf253df commit 43a377d1697ac74ec5e45f739ee90becbcf253df Author: Vladimir Levin <vmpstr@chromium.org> Date: Thu Dec 06 16:15:58 2018 [DL] Don't immediately update the locked element frame rect. This patch ensures that we do layout in a pending frame rect, which is only put in place for children of the locked element during layout. After the promise is resolved, we put the pending frame rect as the active one and ensure that we relayout the previously locked box itself. This means that if the promise resolution, for example, removed the element as is the case in https://docs.google.com/document/d/1VrcVA5JyBmYn0Yi4wjPt1l9ce5Mhf-zu6o63p_mt98w/edit Then we never commit what was a pending layout and never see a flash of laid out content. R=chrishtr@chromium.org, mstensho@chromium.org Bug: 907613 , 882663 Change-Id: I7d03ae73ea4cb96c17ce8bb4162718155c2072be Reviewed-on: https://chromium-review.googlesource.com/c/1358969 Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Commit-Queue: vmpstr <vmpstr@chromium.org> Cr-Commit-Position: refs/heads/master@{#614373} [modify] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/renderer/core/display_lock/display_lock_context.cc [modify] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/renderer/core/display_lock/display_lock_context.h [modify] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/renderer/core/layout/layout_block.cc [modify] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/renderer/core/layout/layout_box.h [modify] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/renderer/core/layout/layout_object.h [add] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/web_tests/display-lock/lock-before-append/measure-and-remove-expected.html [add] https://crrev.com/43a377d1697ac74ec5e45f739ee90becbcf253df/third_party/blink/web_tests/display-lock/lock-before-append/measure-and-remove.html
,
Dec 11
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/26cbade5de8d3803d9bf83ee1686022056e2d295 commit 26cbade5de8d3803d9bf83ee1686022056e2d295 Author: Vladimir Levin <vmpstr@chromium.org> Date: Tue Dec 11 16:56:36 2018 [DL] Handle forced layouts. If the layout is forced, then we temporarily allow the processing of the subtree. The locked element's frame rect still remains to be the same as at the time the lock was acquired. R=chrishtr@chromium.org, mstensho@chromium.org, futhark@chromium.org Bug: 907613 , 882663 Change-Id: I9d1f63c287a73e7a8f3cbc9cb5acc2a009ddd024 Reviewed-on: https://chromium-review.googlesource.com/c/1363957 Commit-Queue: vmpstr <vmpstr@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Cr-Commit-Position: refs/heads/master@{#615556} [modify] https://crrev.com/26cbade5de8d3803d9bf83ee1686022056e2d295/third_party/blink/renderer/core/display_lock/display_lock_context.cc [modify] https://crrev.com/26cbade5de8d3803d9bf83ee1686022056e2d295/third_party/blink/renderer/core/display_lock/display_lock_context.h [modify] https://crrev.com/26cbade5de8d3803d9bf83ee1686022056e2d295/third_party/blink/renderer/core/dom/document.cc [add] https://crrev.com/26cbade5de8d3803d9bf83ee1686022056e2d295/third_party/blink/web_tests/display-lock/lock-before-append/measure-forced-layout.html
,
Jan 4
|
|||
►
Sign in to add a comment |
|||
Comment 1 by vmp...@chromium.org
, Nov 21