[LayoutNG] Use offsets relative to the block flow when using legacy APIs. #26333
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We still use the legacy layout engine APIs when calculating offsets
relative to some ancestor (needed by DOM APIs such as offsetLeft,
offsetTop and getClientRects()). This means that we cannot use offsets
relative to the containing box fragment. We need to make them relative
to the containing LayoutBlockFlow instead, or machineries such as
LayoutObject::MapLocalToAncestor() will fail when in block
fragmentation.
Also fixed an issue in the NG-to-legacy-writeback code. It was wrong for
RTL, since we used the inline-size of the column (rather than that oof
the column set) when converting between logical and physical offsets.
This alone doesn't fix any existing tests, but it is needed by the new
tests added in this CL, and also helps fix a couple of the existing
tests that now pass.
Also move one ContainingBlockFlowFragmentOf() call out of the way (we
get nullptr when block-fragmented). Moved it into paint fragment-specific
code, which was the only code that needed it.
Bug: 829028
Change-Id: Ib19b11ecfdd47cdd77aed41c6935be86004fe166
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2508590
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822860}