Bug 1528957 - Use the frame's rect to advance nsTableRowGroupFrame's cursor, since that's what the max overflow values are computed relative to. r=emilio
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 20 May 2019 23:17:12 +0000
changeset 474638 a0195a554c70e14b701be3733d52b3a0305895e6
parent 474637 2543d1e28c3065ec2b0db16c59a69259d49e1d37
child 474639 158156b7af1806b8667b1a4491147c7332da88ab
push id36042
push userdvarga@mozilla.com
push dateTue, 21 May 2019 04:19:40 +0000
treeherdermozilla-central@ca560ff55451 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1528957
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528957 - Use the frame's rect to advance nsTableRowGroupFrame's cursor, since that's what the max overflow values are computed relative to. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D29448
layout/tables/nsTableRowGroupFrame.cpp
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -200,20 +200,19 @@ static void DisplayRows(nsDisplayListBui
                       ? nullptr
                       : f->GetFirstRowContaining(aBuilder->GetVisibleRect().y,
                                                  &overflowAbove);
 
   if (kid) {
     // have a cursor, use it
     while (kid) {
       if (kid->GetRect().y - overflowAbove >=
-              aBuilder->GetVisibleRect().YMost() &&
-          kid->GetNormalRect().y - overflowAbove >=
-              aBuilder->GetVisibleRect().YMost())
+          aBuilder->GetVisibleRect().YMost()) {
         break;
+      }
       f->BuildDisplayListForChild(aBuilder, kid, aLists);
       kid = kid->GetNextSibling();
     }
     return;
   }
 
   // No cursor. Traverse children the hard way and build a cursor while we're at
   // it
@@ -1909,40 +1908,38 @@ nsIFrame* nsTableRowGroupFrame::GetFirst
   // we don't need to check that here.
 
   // We use property->mOverflowBelow here instead of computing the frame's
   // true overflowArea.YMost(), because it is essential for the thresholds
   // to form a monotonically increasing sequence. Otherwise we would break
   // encountering a row whose overflowArea.YMost() is <= aY but which has
   // a row above it containing cell(s) that span to include aY.
   while (cursorIndex > 0 &&
-         cursorFrame->GetNormalRect().YMost() + property->mOverflowBelow > aY) {
+         cursorFrame->GetRect().YMost() + property->mOverflowBelow > aY) {
     --cursorIndex;
     cursorFrame = property->mFrames[cursorIndex];
   }
   while (cursorIndex + 1 < frameCount &&
-         cursorFrame->GetNormalRect().YMost() + property->mOverflowBelow <=
-             aY) {
+         cursorFrame->GetRect().YMost() + property->mOverflowBelow <= aY) {
     ++cursorIndex;
     cursorFrame = property->mFrames[cursorIndex];
   }
 
   property->mCursorIndex = cursorIndex;
   *aOverflowAbove = property->mOverflowAbove;
   return cursorFrame;
 }
 
 bool nsTableRowGroupFrame::FrameCursorData::AppendFrame(nsIFrame* aFrame) {
-  // Relative positioning can cause table parts to move, but we will still paint
-  // the backgrounds for the parts under them at their 'normal' position. That
-  // means that we must consider the overflow rects at both positions. For
-  // example, if we use relative positioning to move a row-spanning cell, we
-  // will still paint the row background for that cell at its normal position,
-  // which will overflow the row.
-  // XXX(seth): This probably isn't correct in the presence of transforms.
+  // The cursor requires a monotonically increasing sequence in order to
+  // identify which rows can be skipped, and position:relative can move
+  // rows around such that the overflow areas don't provide this.
+  // We take the union of the overflow rect, and the frame's 'normal' position
+  // (excluding position:relative changes) and record the max difference between
+  // this combined overflow and the frame's rect.
   nsRect positionedOverflowRect = aFrame->GetVisualOverflowRect();
   nsPoint positionedToNormal =
       aFrame->GetNormalPosition() - aFrame->GetPosition();
   nsRect normalOverflowRect = positionedOverflowRect + positionedToNormal;
 
   nsRect overflowRect = positionedOverflowRect.Union(normalOverflowRect);
   if (overflowRect.IsEmpty()) return true;
   nscoord overflowAbove = -overflowRect.y;