Commit b7e6bb28 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez Committed by Pier Angelo Vendrame
Browse files

Bug 2045606 - Don't skip layout for fragmented blocks. a=pascalc DONTBUILD

This is the low-risk fix, but ideally we just pull the children up.

For flex / grid normalize child lists before skipping layout.

Original Revision: https://phabricator.services.mozilla.com/D306764

Differential Revision: https://phabricator.services.mozilla.com/D307724
parent 3826f9f6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1375,7 +1375,8 @@ void nsBlockFrame::ClearLineClampEllipsis() { ::ClearLineClampEllipsis(this); }
void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
                          const ReflowInput& aReflowInput,
                          nsReflowStatus& aStatus) {
  if (IsHiddenByContentVisibilityOfInFlowParentForLayout()) {
  if (IsHiddenByContentVisibilityOfInFlowParentForLayout() &&
      !GetNextContinuation()) {
    FinishAndStoreOverflow(&aMetrics, aReflowInput.mStyleDisplay);
    return;
  }
+2 −2
Original line number Diff line number Diff line
@@ -4617,6 +4617,8 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
                                  ReflowOutput& aReflowOutput,
                                  const ReflowInput& aReflowInput,
                                  nsReflowStatus& aStatus) {
  NormalizeChildLists();

  if (IsHiddenByContentVisibilityOfInFlowParentForLayout()) {
    return;
  }
@@ -4636,8 +4638,6 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
    return;
  }

  NormalizeChildLists();

#ifdef DEBUG
  mDidPushItemsBitMayLie = false;
  SanityCheckChildListsBeforeReflow();
+2 −2
Original line number Diff line number Diff line
@@ -9266,6 +9266,8 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
                                  ReflowOutput& aDesiredSize,
                                  const ReflowInput& aReflowInput,
                                  nsReflowStatus& aStatus) {
  NormalizeChildLists();

  if (IsHiddenByContentVisibilityOfInFlowParentForLayout()) {
    return;
  }
@@ -9278,8 +9280,6 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
    return;
  }

  NormalizeChildLists();

#ifdef DEBUG
  mDidPushItemsBitMayLie = false;
  SanityCheckChildListsBeforeReflow();
+27 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2045606">
<style>
  #col { columns: 3; column-fill: auto; height: 150px; width: 450px; column-gap: 0; }
  #w { contain: layout paint style; }
  #k { position: fixed; top: 0; left: 0; width: 60px; }
  #y { position: fixed; top: 10px; left: 100px; width: 30px; height: 30px; background: red; }
</style>
<div id="col">
  <div id="w">
    <div style="height:20px">pre</div>
    <div id="k">
      <div style="height:220px;background:lime"></div>
      <span id="h"><div id="y"></div></span>
      <div style="height:60px;background:cyan"></div>
    </div>
    <div style="height:500px">post</div>
  </div>
</div>
<script>
document.body.offsetHeight;
requestAnimationFrame(function() {
  document.getElementById('w').style.contentVisibility = 'hidden';
  document.body.offsetHeight;
  document.title = 'done';
});
</script>