Commit b9533281 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

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
parent 6f979f20
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -1044,9 +1044,10 @@ static nsIFrame* ContainingBlockForFrame(nsIFrame* aFrame) {
  }
  }
  // Combobox frames are easy as well because they can't have positioned
  // Combobox frames are easy as well because they can't have positioned
  // children anyways.
  // children anyways.
  // Button frames are also easy because the containing block is the frame
  // Button and table cell frames are also easy because the containing block is
  // itself.
  // the frame itself.
  if (aFrame->IsComboboxControlFrame() || aFrame->IsHTMLButtonControlFrame()) {
  if (aFrame->IsComboboxControlFrame() || aFrame->IsHTMLButtonControlFrame() ||
      aFrame->IsTableCellFrame()) {
    return aFrame;
    return aFrame;
  }
  }
  return nullptr;
  return nullptr;
+29 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1131371
    top: 0;
    top: 0;
    position: absolute;
    position: absolute;
  }
  }
  #tableCell,
  #tableCellWithAbsPosChild {
    display: table-cell;
  }
</style>
</style>
<div id="display">
<div id="display">
  <div id="content">
  <div id="content">
@@ -68,6 +72,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1131371
    Something
    Something
  </button>
  </button>
  <button id="buttonElemWithAbsPosChild"><div style="position:absolute"></div></button>
  <button id="buttonElemWithAbsPosChild"><div style="position:absolute"></div></button>
  <div id="tableCell"></div>
  <div id="tableCellWithAbsPosChild">
    <div style="position: absolute"></div>
  </div>
</div>
</div>
<pre id="test">
<pre id="test">
<script>
<script>
@@ -84,6 +92,8 @@ const textareaElem = document.getElementById("textareaElem");
const selectElem = document.getElementById("selectElem");
const selectElem = document.getElementById("selectElem");
const buttonElem = document.getElementById("buttonElem");
const buttonElem = document.getElementById("buttonElem");
const buttonElemWithAbsPosChild = document.getElementById("buttonElemWithAbsPosChild");
const buttonElemWithAbsPosChild = document.getElementById("buttonElemWithAbsPosChild");
const tableCell = document.getElementById("tableCell");
const tableCellWithAbsPosChild = document.getElementById("tableCellWithAbsPosChild");


for (let scroller of document.querySelectorAll(".flexScrollerWithTransformedItems")) {
for (let scroller of document.querySelectorAll(".flexScrollerWithTransformedItems")) {
  scroller.scrollLeft = 10000;
  scroller.scrollLeft = 10000;
@@ -438,6 +448,18 @@ const gTestcases = [
    beforeStyle:  "position: relative; overflow: auto;",
    beforeStyle:  "position: relative; overflow: auto;",
    expectReflow: true,
    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.
  // These ones do though.
  {
  {
@@ -461,6 +483,13 @@ const gTestcases = [
    expectConstruction: true,
    expectConstruction: true,
    expectReflow: 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.
  // Adding transform to a scrollframe without abspos / fixedpos children shouldn't reframe.
  {
  {
+0 −7
Original line number Original line Diff line number Diff line
@@ -774,13 +774,6 @@ void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
    nsRect kidRect = kidFrame->GetRect();
    nsRect kidRect = kidFrame->GetRect();
    LogicalPoint origKidNormalPosition =
    LogicalPoint origKidNormalPosition =
        kidFrame->GetLogicalNormalPosition(wm, containerSize);
        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();
    nsRect kidInkOverflow = kidFrame->InkOverflowRect();
    LogicalPoint kidPosition(wm, iCoord, 0);
    LogicalPoint kidPosition(wm, iCoord, 0);