[FragmentItem] Recalculate ink overflow for self-painting layers
This patch fixes the logic to recalculate ink overflow, especially for self-painting layers. |PaintLayer| calls |RecalcVisualOverflow| for its owner |LayoutObject|. |LayoutBlockFlow| already redirects this to |NGFragmentItems|, but inline boxes and atomic inlines did not handle this. They have ink overflow stored in corresponding |NGFragmentItem|s, and they need to be recalculated. This patch handles this situation by adding |LayoutBoxModelObject::RecalcVisualOverflow|. Currently, there are multiple workarounds added to pass all tests, but they are causing sometimes redundant, or sometimes missing recalculations. This fix allows to remove one of such workarounds in |NGFragmentItem::RecalcInkOverflowForCursor|, that calls |RecalcInkOverflow| even if the child is |HasSelfPaintingLayer|. Removing this workaround reduces redundant recalculations. Three sets of tests cover this change: 1. This patch adds a unit test that demonstrates when the current code fails to recalculate ink overflow, originally found while investigating <crbug.com/1128199>. 2. When |NGFragmentItem| is enabled, reading dirty self ink overflow hits DCHECK. Not hitting DCHECK can ensure that this change calculate ink overflow for all cases where we read self ink overflow. 3. This patch adds a DCHECK when reading dirty self-and- container ink overflow. 215 unit tests and 653 web tests fail this DCHECK <crrev.com/c/2432707> but pass with this patch (except when NG block fragmentation is enabled, see notes below.) Note: * Both legacy and |NGPaintFragment| have the same issue. This patch addresses only for |NGFragmentItem|. * |LayoutBlockFlow| does not handle |RecalcVisualOverflow| correctly for multicol. This was fixed in r810561 <crrev.com/c/2428516>. Many `virtual/layout_ng_block_frag` tests fail without that fix when this patch is applied. * 3 `virtual/layout_ng_block_frag` tests still fail the new test #3 above, even after the fix above. crbug.com/1132619 tracks this issue. Bug: 1128199, 1130856 Change-Id: I42a75e1dad7c2b35146cca4ddaaf9763df4e7440 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428530 Commit-Queue: Koji Ishii <kojii@chromium.org> Reviewed-by:Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by:
Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#811125}
Showing
Please register or sign in to comment