Bug 1815552 - Deal with table cells in the abspos cb change optimization code-path. r=dholbert

Remove an assertion that doesn't hold if we don't reframe when switching
positions.

Differential Revision: https://phabricator.services.mozilla.com/D169127
This commit is contained in:
Emilio Cobos Álvarez 2023-03-01 19:04:16 +00:00
parent 6f979f20e9
commit b953328172
3 changed files with 33 additions and 10 deletions

View File

@ -1044,9 +1044,10 @@ static nsIFrame* ContainingBlockForFrame(nsIFrame* aFrame) {
}
// Combobox frames are easy as well because they can't have positioned
// children anyways.
// Button frames are also easy because the containing block is the frame
// itself.
if (aFrame->IsComboboxControlFrame() || aFrame->IsHTMLButtonControlFrame()) {
// Button and table cell frames are also easy because the containing block is
// the frame itself.
if (aFrame->IsComboboxControlFrame() || aFrame->IsHTMLButtonControlFrame() ||
aFrame->IsTableCellFrame()) {
return aFrame;
}
return nullptr;

View File

@ -30,6 +30,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1131371
top: 0;
position: absolute;
}
#tableCell,
#tableCellWithAbsPosChild {
display: table-cell;
}
</style>
<div id="display">
<div id="content">
@ -68,6 +72,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1131371
Something
</button>
<button id="buttonElemWithAbsPosChild"><div style="position:absolute"></div></button>
<div id="tableCell"></div>
<div id="tableCellWithAbsPosChild">
<div style="position: absolute"></div>
</div>
</div>
<pre id="test">
<script>
@ -84,6 +92,8 @@ const textareaElem = document.getElementById("textareaElem");
const selectElem = document.getElementById("selectElem");
const buttonElem = document.getElementById("buttonElem");
const buttonElemWithAbsPosChild = document.getElementById("buttonElemWithAbsPosChild");
const tableCell = document.getElementById("tableCell");
const tableCellWithAbsPosChild = document.getElementById("tableCellWithAbsPosChild");
for (let scroller of document.querySelectorAll(".flexScrollerWithTransformedItems")) {
scroller.scrollLeft = 10000;
@ -438,6 +448,18 @@ const gTestcases = [
beforeStyle: "position: relative; overflow: auto;",
expectReflow: true,
},
{
elem: tableCell,
afterStyle: "position: static;",
beforeStyle: "position: relative;",
expectReflow: true,
},
{
elem: tableCell,
afterStyle: "filter: none",
beforeStyle: "filter: saturate(1)",
expectReflow: false,
},
// These ones do though.
{
@ -461,6 +483,13 @@ const gTestcases = [
expectConstruction: true,
expectReflow: true,
},
{
elem: tableCellWithAbsPosChild,
afterStyle: "position: static;",
beforeStyle: "position: relative;",
expectConstruction: true,
expectReflow: true,
},
// Adding transform to a scrollframe without abspos / fixedpos children shouldn't reframe.
{

View File

@ -774,13 +774,6 @@ void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
nsRect kidRect = kidFrame->GetRect();
LogicalPoint origKidNormalPosition =
kidFrame->GetLogicalNormalPosition(wm, containerSize);
// All cells' no-relative-positioning position should be snapped to the
// row's bstart edge.
// This doesn't hold in vertical-rl mode, where we don't yet know the
// correct containerSize for the row frame. In that case, we'll have to
// fix up child positions later, after determining our desiredSize.
NS_ASSERTION(origKidNormalPosition.B(wm) == 0 || wm.IsVerticalRL(),
"unexpected kid position");
nsRect kidInkOverflow = kidFrame->InkOverflowRect();
LogicalPoint kidPosition(wm, iCoord, 0);