https://bugs.webkit.org/show_bug.cgi?id=99959
rdar://80106111
Reviewed by Alan Bujtas.
Source/WebCore:
getBoundingClientRect() and getClientRects() for elements inside multicol had a quick
and dirty implementation that just mapped the element center point into a column. This
resulted in odd, negative top/left in some cases.
Fix by correctly generating multiple rects for elements that span columns, following
the repaint code path that already knew how to do this correctly.
The entry point is RenderFragmentContainer::absoluteQuadsForBox() which now has a
real implementation. For each fragment that the box covers, it calls fragmentRectsForFlowContentRect()
which generates one or more rects; RenderMultiColumnSet overrides this to
compute rects for multicol.
We have to take care not to eliminate empty rects, since the API does return these.
Tested by existing tests.
* dom/Element.cpp:
(WebCore::Element::absoluteEventBounds):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::absoluteQuadsIgnoringContinuation const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::absoluteQuads const):
* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::fragmentedFlowContentRectangle):
(WebCore::RenderFragmentContainer::fragmentRectsForFlowContentRect):
* rendering/RenderFragmentContainer.h:
(WebCore::RenderFragmentContainer::absoluteQuadsForBoxInFragment): Deleted.
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::absoluteQuadsForBox const):
* rendering/RenderFragmentedFlow.h:
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::firstAndLastColumnsFromOffsets const):
(WebCore::RenderMultiColumnSet::repaintFragmentedFlowContent):
(WebCore::RenderMultiColumnSet::fragmentRectsForFlowContentRect):
(WebCore::RenderMultiColumnSet::collectLayerFragments):
* rendering/RenderMultiColumnSet.h:
LayoutTests:
These tests have all progressed.
* fast/multicol/client-rects-spanners-complex.html:
* fast/multicol/client-rects-spanners.html:
* fast/multicol/client-rects.html:
* fast/multicol/newmulticol/client-rects.html:
* imported/blink/fast/multicol/client-rects-rtl-expected.html:
* imported/blink/fast/multicol/client-rects-rtl.html: This test appeared to be hand-coded to the incorrect old behavior.
* platform/ios/fast/multicol/client-rects-expected.txt:
* platform/ios/fast/multicol/client-rects-spanners-complex-expected.txt:
* platform/ios/fast/multicol/client-rects-spanners-expected.txt:
* platform/ios/fast/multicol/newmulticol/client-rects-expected.txt:
* platform/mac/fast/multicol/client-rects-expected.txt:
* platform/mac/fast/multicol/client-rects-spanners-complex-expected.txt:
* platform/mac/fast/multicol/client-rects-spanners-expected.txt:
* platform/mac/fast/multicol/newmulticol/client-rects-expected.txt:
Canonical link: https://commits.webkit.org/239759@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280017 268f45cc-cd09-0410-ab3c-d52691b4dbfc