Bug 1409114 - Part 8: Create column and column group background display items as part of the cell's BuildDisplayList. r=dbaron
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 20 May 2019 23:16:09 +0000
changeset 474634 69b049f546226b6bcc288986bbf60d792f01bf8f
parent 474633 df9a4342bf9750ad45219104bfd25674260f6080
child 474635 1c9357112b30b32385452b1f8794980fd72fc4b4
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)
reviewersdbaron
bugs1409114
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 1409114 - Part 8: Create column and column group background display items as part of the cell's BuildDisplayList. r=dbaron This is the main performance improvement, and means that we no longer have to iterate all the cells for each column. It has a couple of behaviour changes: The first is that we no longer apply stacking context effects (like opacity) to column and column group backgrounds. I believe this is correct as per both CSS2.1 Appendix E, and css-tables-3 (quoted in nsTableColFrame::BuildDisplayList). This matches the behaviour of blink and WebKit. We also previously created items in column,row ordering, whereas now they will be in row,column. In cases where two cells overlap (using rowspan and colspan to extend multiple neighbours in to the same place) this can render backgrounds in a different order, but the new behaviour matches blink and WebKit. Differential Revision: https://phabricator.services.mozilla.com/D29280
layout/reftests/table-background/border-collapse-opacity-table-column-group-ref.html
layout/reftests/table-background/border-collapse-opacity-table-column-ref.html
layout/reftests/table-background/border-separate-opacity-table-column-group-ref.html
layout/reftests/table-background/border-separate-opacity-table-column-ref.html
layout/reftests/table-background/reftest.list
layout/reftests/table-background/table-col-span-1-ref.html
layout/reftests/table-background/table-col-span-1.html
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
--- a/layout/reftests/table-background/border-collapse-opacity-table-column-group-ref.html
+++ b/layout/reftests/table-background/border-collapse-opacity-table-column-group-ref.html
@@ -5,18 +5,16 @@
 	<title>Table background tests</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 	<meta http-equiv="Content-Style-Type" content="text/css">
 	<style type="text/css">
 
 	html, body { margin: 0; padding: 0; border: 0; font-size: 16px; }
 	body { padding: 15px; }
 
-	.o { opacity: 0.5; }
-
 	/*
 	table { 
 		margin: 0px 3px 2px 4px;
 		border-width: 4px 2px 8px 6px;
 
 		height is 97px:
 		  (2px of border outside height)
 		  extra border width for top row: 0
@@ -50,14 +48,14 @@
 
 	div.imagetl { background-position: 0 0; }
 	div.imagebr { background-position: 171px 97px; }
 
 	</style>
 </head>
 <body>
 
-<div class="color o"></div>
-<div class="imagetl o"></div>
+<div class="color"></div>
+<div class="imagetl"></div>
 <div class="imagebr"></div>
 
 </body>
 </html>
--- a/layout/reftests/table-background/border-collapse-opacity-table-column-ref.html
+++ b/layout/reftests/table-background/border-collapse-opacity-table-column-ref.html
@@ -5,18 +5,16 @@
 	<title>Table background tests</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 	<meta http-equiv="Content-Style-Type" content="text/css">
 	<style type="text/css">
 
 	html, body { margin: 0; padding: 0; border: 0; font-size: 16px; }
 	body { padding: 15px; }
 
-	.o { opacity: 0.5; }
-
 	/*
 	table { 
 		margin: 0px 3px 2px 4px;
 		border-width: 4px 2px 8px 6px;
 
 		height is 97px:
 		  (2px of border outside height)
 		  extra border width for top row: 0
@@ -50,14 +48,14 @@
 
 	div.imagetl { background-position: 0 0; }
 	div.imagebr { background-position: 57px 97px; }
 
 	</style>
 </head>
 <body>
 
-<div class="color o"></div>
-<div class="imagetl o"></div>
+<div class="color"></div>
+<div class="imagetl"></div>
 <div class="imagebr"></div>
 
 </body>
 </html>
--- a/layout/reftests/table-background/border-separate-opacity-table-column-group-ref.html
+++ b/layout/reftests/table-background/border-separate-opacity-table-column-group-ref.html
@@ -5,18 +5,16 @@
 	<title>Table background tests</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 	<meta http-equiv="Content-Style-Type" content="text/css">
 	<style type="text/css">
 
 	html, body { margin: 0; padding: 0; border: 0; font-size: 16px; }
 	body { padding: 15px; }
 
-	.o { opacity: 0.5; }
-
 	/*
 	table { 
 		margin: 0px 3px 2px 4px;
 		border-width: 4px 2px 7px 3px;
 
 		border-box height is 145px:
 		  border-top: 4px;
 		  padding-top: 3px
@@ -60,18 +58,18 @@
 	div.vstripe { top: 0; width: 2px; height: 500px; }
 	div.hstripe { left: 0; height: 3px; width: 400px; }
 
 	</style>
 </head>
 <body>
 
 <div class="color"></div>
-<div class="imagetl o"></div>
-<div class="imagebr o"></div>
+<div class="imagetl"></div>
+<div class="imagebr"></div>
 
 <div class="hstripe" style="top: 46px"></div>
 <div class="hstripe" style="top: 70px"></div>
 <div class="hstripe" style="top: 94px"></div>
 <div class="hstripe" style="top: 118px"></div>
 <div class="hstripe" style="top: 193px"></div>
 <div class="hstripe" style="top: 217px"></div>
 <div class="hstripe" style="top: 241px"></div>
--- a/layout/reftests/table-background/border-separate-opacity-table-column-ref.html
+++ b/layout/reftests/table-background/border-separate-opacity-table-column-ref.html
@@ -5,18 +5,16 @@
 	<title>Table background tests</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 	<meta http-equiv="Content-Style-Type" content="text/css">
 	<style type="text/css">
 
 	html, body { margin: 0; padding: 0; border: 0; font-size: 16px; }
 	body { padding: 15px; }
 
-	.o { opacity: 0.5; }
-
 	/*
 	table { 
 		margin: 0px 3px 2px 4px;
 		border-width: 4px 2px 7px 3px;
 
 		border-box height is 145px:
 		  border-top: 4px;
 		  padding-top: 3px
@@ -60,18 +58,18 @@
 	div.vstripe { top: 0; width: 2px; height: 500px; }
 	div.hstripe { left: 0; height: 3px; width: 400px; }
 
 	</style>
 </head>
 <body>
 
 <div class="color"></div>
-<div class="imagetl o"></div>
-<div class="imagebr o"></div>
+<div class="imagetl"></div>
+<div class="imagebr"></div>
 
 <div class="hstripe" style="top: 46px"></div>
 <div class="hstripe" style="top: 70px"></div>
 <div class="hstripe" style="top: 94px"></div>
 <div class="hstripe" style="top: 118px"></div>
 <div class="hstripe" style="top: 193px"></div>
 <div class="hstripe" style="top: 217px"></div>
 <div class="hstripe" style="top: 241px"></div>
--- a/layout/reftests/table-background/reftest.list
+++ b/layout/reftests/table-background/reftest.list
@@ -61,8 +61,9 @@ fuzzy-if(d2d||skiaContent,0-1,0-95000) =
 fuzzy-if(OSX,0-1,0-113) fuzzy-if(winWidget,0-1,0-12) fuzzy-if(winWidget&&!layersGPUAccelerated,0-82,0-116) fuzzy-if(skiaContent,0-84,0-5500) fuzzy-if(Android,0-2,0-5957) == table-row-opacity-dynamic-1.html table-row-opacity-dynamic-1-ref.html
 == table-row-opacity-dynamic-2.html table-row-opacity-dynamic-2-ref.html
 
 == hidden-cells-1.html about:blank
 == hidden-cells-2.html about:blank
 == hidden-cells-3.html hidden-cells-3-ref.html
 
 == table-col-overlapping.html table-col-overlapping-ref.html
+== table-col-span-1.html table-col-span-1-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-background/table-col-span-1-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <table border>
+    <col style="background:purple"></col>
+    <col style="background:purple"></col>
+    <col style="background:blue"></col>
+    <tr>
+      <td>x</td>
+      <td>y</td>
+      <td>z</td>
+    </tr>
+  </table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-background/table-col-span-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <table border>
+    <col span=2 style="background:purple"></col>
+    <col style="background:blue"></col>
+    <tr>
+      <td>x</td>
+      <td>y</td>
+      <td>z</td>
+    </tr>
+  </table>
+</body>
+</html>
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -469,16 +469,51 @@ void nsTableCellFrame::BuildDisplayList(
     // display borders if we need to
     ProcessBorders(GetTableFrame(), aBuilder, aLists);
 
     // and display the selection border if we need to
     if (IsSelected()) {
       aLists.BorderBackground()->AppendNewToTop<nsDisplayTableCellSelection>(
           aBuilder, this);
     }
+
+    // This can be null if display list building initiated in the middle
+    // of the table, which can happen with background-clip:text and
+    // -moz-element.
+    nsDisplayTableBackgroundSet* backgrounds =
+        aBuilder->GetTableBackgroundSet();
+    if (backgrounds) {
+      // Compute bgRect relative to reference frame, but using the
+      // normal (without position:relative offsets) positions for the
+      // cell, row and row group.
+      bgRect = GetRectRelativeToSelf() + GetNormalPosition();
+
+      nsTableRowFrame* row = GetTableRowFrame();
+      bgRect += row->GetNormalPosition();
+
+      nsTableRowGroupFrame* rowGroup = row->GetTableRowGroupFrame();
+      bgRect += rowGroup->GetNormalPosition();
+
+      bgRect += backgrounds->TableToReferenceFrame();
+
+      // Create backgrounds items as needed for the column and column
+      // group that this cell occupies.
+      nsTableColFrame* col = backgrounds->GetColForIndex(ColIndex());
+      nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
+          aBuilder, col, bgRect, backgrounds->ColBackgrounds(), false, nullptr,
+          col->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(col), this);
+
+      nsIFrame* colGroup = col->GetParent();
+      nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
+          aBuilder, colGroup, bgRect, backgrounds->ColGroupBackgrounds(), false,
+          nullptr,
+          colGroup->GetRectRelativeToSelf() +
+              aBuilder->ToReferenceFrame(colGroup),
+          this);
+    }
   }
 
   // the 'empty-cells' property has no effect on 'outline'
   DisplayOutline(aBuilder, aLists);
 
   nsIFrame* kid = mFrames.FirstChild();
   NS_ASSERTION(kid && !kid->GetNextSibling(),
                "Table cells should have just one child");
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -114,39 +114,17 @@ void nsTableColFrame::Reflow(nsPresConte
 
 void nsTableColFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                        const nsDisplayListSet& aLists) {
   // Per https://drafts.csswg.org/css-tables-3/#global-style-overrides:
   // "All css properties of table-column and table-column-group boxes are
   // ignored, except when explicitly specified by this specification."
   // CSS outlines and box-shadows fall into this category, so we skip them
   // on these boxes.
-
-  // Compute background rect by iterating all cell frame.
-  AutoTArray<uint32_t, 1> colIdx;
-  colIdx.AppendElement(GetColIndex());
-
-  nsTableFrame* table = GetTableFrame();
-  nsTableFrame::RowGroupArray rowGroups;
-  table->OrderRowGroups(rowGroups);
-  for (nsTableRowGroupFrame* rowGroup : rowGroups) {
-    auto offset = rowGroup->GetNormalPosition() - GetNormalPosition() -
-                  GetTableColGroupFrame()->GetNormalPosition();
-    if (!aBuilder->GetDirtyRect().Intersects(
-            nsRect(offset, rowGroup->GetSize()))) {
-      continue;
-    }
-    rowGroup->PaintCellBackgroundsForColumns(
-        this, aBuilder, aBuilder->GetTableBackgroundSet()->ColBackgrounds(),
-        colIdx, offset);
-  }
-
-  for (nsIFrame* kid : PrincipalChildList()) {
-    BuildDisplayListForChild(aBuilder, kid, aLists);
-  }
+  MOZ_ASSERT_UNREACHABLE("Cols don't paint themselves");
 }
 
 int32_t nsTableColFrame::GetSpan() { return StyleTable()->mSpan; }
 
 #ifdef DEBUG
 void nsTableColFrame::Dump(int32_t aIndent) {
   char* indent = new char[aIndent + 1];
   if (!indent) return;
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -352,46 +352,17 @@ void nsTableColGroupFrame::Reflow(nsPres
 
 void nsTableColGroupFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                             const nsDisplayListSet& aLists) {
   // Per https://drafts.csswg.org/css-tables-3/#global-style-overrides:
   // "All css properties of table-column and table-column-group boxes are
   // ignored, except when explicitly specified by this specification."
   // CSS outlines and box-shadows fall into this category, so we skip them
   // on these boxes.
-
-  // Collecting column index.
-  AutoTArray<uint32_t, 1> colIdx;
-  for (nsTableColFrame* col = GetFirstColumn(); col; col = col->GetNextCol()) {
-    MOZ_ASSERT(colIdx.IsEmpty() || static_cast<uint32_t>(col->GetColIndex()) >
-                                       colIdx.LastElement());
-    colIdx.AppendElement(col->GetColIndex());
-  }
-
-  if (!colIdx.IsEmpty()) {
-    // We have some actual cells that live inside this rowgroup.
-    nsTableFrame* table = GetTableFrame();
-    nsTableFrame::RowGroupArray rowGroups;
-    table->OrderRowGroups(rowGroups);
-    for (nsTableRowGroupFrame* rowGroup : rowGroups) {
-      auto offset = rowGroup->GetNormalPosition() - GetNormalPosition();
-      if (!aBuilder->GetDirtyRect().Intersects(
-              nsRect(offset, rowGroup->GetSize()))) {
-        continue;
-      }
-      rowGroup->PaintCellBackgroundsForColumns(
-          this, aBuilder,
-          aBuilder->GetTableBackgroundSet()->ColGroupBackgrounds(), colIdx,
-          offset);
-    }
-  }
-
-  for (nsIFrame* kid : PrincipalChildList()) {
-    BuildDisplayListForChild(aBuilder, kid, aLists);
-  }
+  MOZ_ASSERT_UNREACHABLE("Colgroups don't paint themselves");
 }
 
 nsTableColFrame* nsTableColGroupFrame::GetFirstColumn() {
   return GetNextColumn(nullptr);
 }
 
 nsTableColFrame* nsTableColGroupFrame::GetNextColumn(nsIFrame* aChildFrame) {
   nsTableColFrame* result = nullptr;
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1287,30 +1287,32 @@ void nsTableFrame::CalcHasBCBorders() {
 // table paint code is concerned primarily with borders and bg color
 // SEC: TODO: adjust the rect for captions
 void nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                     const nsDisplayListSet& aLists) {
   DO_GLOBAL_REFLOW_COUNT_DSP_COLOR("nsTableFrame", NS_RGB(255, 128, 255));
 
   DisplayBorderBackgroundOutline(aBuilder, aLists);
 
-  nsDisplayTableBackgroundSet tableBGs(aBuilder);
+  nsDisplayTableBackgroundSet tableBGs(aBuilder, this);
   nsDisplayListCollection lists(aBuilder);
 
   // This is similar to what
   // nsContainerFrame::BuildDisplayListForNonBlockChildren does, except that we
   // allow the children's background and borders to go in our BorderBackground
   // list. This doesn't really affect background painting --- the children won't
   // actually draw their own backgrounds because the nsTableFrame already drew
   // them, unless a child has its own stacking context, in which case the child
   // won't use its passed-in BorderBackground list anyway. It does affect cell
   // borders though; this lets us get cell borders into the nsTableFrame's
   // BorderBackground list.
-  for (nsIFrame* kid : GetChildList(kColGroupList)) {
-    BuildDisplayListForChild(aBuilder, kid, lists);
+  for (nsIFrame* colGroup : FirstContinuation()->GetChildList(kColGroupList)) {
+    for (nsIFrame* col : colGroup->PrincipalChildList()) {
+      tableBGs.AddColumn((nsTableColFrame*)col);
+    }
   }
 
   for (nsIFrame* kid : PrincipalChildList()) {
     BuildDisplayListForChild(aBuilder, kid, lists);
   }
 
   tableBGs.MoveTo(aLists);
   lists.MoveTo(aLists);
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -71,19 +71,22 @@ class nsDisplayTableItem : public nsPain
 };
 
 class nsDisplayTableBackgroundSet {
  public:
   nsDisplayList* ColGroupBackgrounds() { return &mColGroupBackgrounds; }
 
   nsDisplayList* ColBackgrounds() { return &mColBackgrounds; }
 
-  explicit nsDisplayTableBackgroundSet(nsDisplayListBuilder* aBuilder)
+  nsDisplayTableBackgroundSet(nsDisplayListBuilder* aBuilder, nsIFrame* aTable)
       : mBuilder(aBuilder) {
     mPrevTableBackgroundSet = mBuilder->SetTableBackgroundSet(this);
+    mozilla::DebugOnly<const nsIFrame*> reference =
+        mBuilder->FindReferenceFrameFor(aTable, &mToReferenceFrame);
+    MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(reference, aTable));
   }
 
   ~nsDisplayTableBackgroundSet() {
     mozilla::DebugOnly<nsDisplayTableBackgroundSet*> result =
         mBuilder->SetTableBackgroundSet(mPrevTableBackgroundSet);
     MOZ_ASSERT(result == this);
   }
 
@@ -91,27 +94,36 @@ class nsDisplayTableBackgroundSet {
    * Move all display items in our lists to top of the corresponding lists in
    * the destination.
    */
   void MoveTo(const nsDisplayListSet& aDestination) {
     aDestination.BorderBackground()->AppendToTop(ColGroupBackgrounds());
     aDestination.BorderBackground()->AppendToTop(ColBackgrounds());
   }
 
+  void AddColumn(nsTableColFrame* aFrame) { mColumns.AppendElement(aFrame); }
+
+  nsTableColFrame* GetColForIndex(int32_t aIndex) { return mColumns[aIndex]; }
+
+  const nsPoint& TableToReferenceFrame() { return mToReferenceFrame; }
+
  private:
   // This class is only used on stack, so we don't have to worry about leaking
   // it.  Don't let us be heap-allocated!
   void* operator new(size_t sz) CPP_THROW_NEW;
 
  protected:
   nsDisplayListBuilder* mBuilder;
   nsDisplayTableBackgroundSet* mPrevTableBackgroundSet;
 
   nsDisplayList mColGroupBackgrounds;
   nsDisplayList mColBackgrounds;
+
+  nsTArray<nsTableColFrame*> mColumns;
+  nsPoint mToReferenceFrame;
 };
 
 /* ========================================================================== */
 
 enum nsTableColType {
   eColContent = 0,            // there is real col content associated
   eColAnonymousCol = 1,       // the result of a span on a col
   eColAnonymousColGroup = 2,  // the result of a span on a col group
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -231,56 +231,16 @@ static void DisplayRows(nsDisplayListBui
 
     kid = kid->GetNextSibling();
   }
   if (cursor) {
     cursor->FinishBuildingCursor();
   }
 }
 
-void nsTableRowGroupFrame::PaintCellBackgroundsForColumns(
-    nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
-    const nsTArray<uint32_t>& aColIdx, const nsPoint& aOffset) {
-  MOZ_DIAGNOSTIC_ASSERT(!aColIdx.IsEmpty(),
-                        "Must be painting backgrounds for something");
-
-  for (nsTableRowFrame* row = GetFirstRow(); row; row = row->GetNextRow()) {
-    auto rowPos = row->GetNormalPosition() + aOffset;
-    if (!aBuilder->GetDirtyRect().Intersects(nsRect(rowPos, row->GetSize()))) {
-      continue;
-    }
-    for (nsTableCellFrame* cell = row->GetFirstCell(); cell;
-         cell = cell->GetNextCell()) {
-      uint32_t curColIdx = cell->ColIndex();
-      if (!aColIdx.ContainsSorted(curColIdx)) {
-        if (curColIdx > aColIdx.LastElement()) {
-          // We can just stop looking at this row.
-          break;
-        }
-        continue;
-      }
-
-      if (!cell->ShouldPaintBackground(aBuilder)) {
-        continue;
-      }
-
-      auto cellPos = cell->GetNormalPosition() + rowPos +
-                     aBuilder->ToReferenceFrame(aFrame);
-      auto cellRect = nsRect(cellPos, cell->GetSize());
-      if (!aBuilder->GetDirtyRect().Intersects(cellRect)) {
-        continue;
-      }
-      nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
-          aBuilder, aFrame, cellRect, aList, false, nullptr,
-          aFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(aFrame),
-          cell);
-    }
-  }
-}
-
 void nsTableRowGroupFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                             const nsDisplayListSet& aLists) {
   DisplayOutsetBoxShadow(aBuilder, aLists.BorderBackground());
 
   for (nsTableRowFrame* row = GetFirstRow(); row; row = row->GetNextRow()) {
     if (!aBuilder->GetDirtyRect().Intersects(
             nsRect(row->GetNormalPosition(), row->GetSize()))) {
       continue;
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -71,22 +71,16 @@ class nsTableRowGroupFrame final : publi
 
   virtual nsMargin GetUsedMargin() const override;
   virtual nsMargin GetUsedBorder() const override;
   virtual nsMargin GetUsedPadding() const override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
-  void PaintCellBackgroundsForColumns(nsIFrame* aFrame,
-                                      nsDisplayListBuilder* aBuilder,
-                                      nsDisplayList* aList,
-                                      const nsTArray<uint32_t>& aColIdx,
-                                      const nsPoint& aOffset);
-
   /**
    * Calls Reflow for all of its child rows.
    *
    * Rows are all set to the same isize and stacked in the block direction.
    *
    * Rows are not split unless absolutely necessary.
    *
    * @param aDesiredSize isize set to isize of rows, bsize set to