@@ -851,28 +851,28 @@ struct TableFormatingContext : FormatingContext {
851851 }
852852 }
853853
854- struct AxisHelper { // FIXME: find me a better name pls
854+ struct AxisAndGroupsIdxs {
855855 Opt<usize> groupIdx = NONE;
856856 Opt<usize> axisIdx = NONE;
857- };
858857
859- Vec<AxisHelper> buildAxisHelper (Vec<TableAxis> const & axes, Vec<TableGroup> const & groups, usize len) {
860- Vec<AxisHelper> helper{Buf<AxisHelper>::init (len)};
861- for (usize groupIdx = 0 ; groupIdx < groups.len (); groupIdx++) {
862- for (usize i = groups[groupIdx].start ; i <= groups[groupIdx].end ; ++i)
863- helper[i].groupIdx = groupIdx;
864- }
865- for (usize axisIdx = 0 ; axisIdx < axes.len (); axisIdx++) {
866- for (usize i = axes[axisIdx].start ; i <= axes[axisIdx].end ; ++i)
867- helper[i].axisIdx = axisIdx;
858+ static Vec<AxisAndGroupsIdxs> build (Vec<TableAxis> const & axes, Vec<TableGroup> const & groups, usize len) {
859+ Vec<AxisAndGroupsIdxs> helper{Buf<AxisAndGroupsIdxs>::init (len)};
860+ for (usize groupIdx = 0 ; groupIdx < groups.len (); groupIdx++) {
861+ for (usize i = groups[groupIdx].start ; i <= groups[groupIdx].end ; ++i)
862+ helper[i].groupIdx = groupIdx;
863+ }
864+ for (usize axisIdx = 0 ; axisIdx < axes.len (); axisIdx++) {
865+ for (usize i = axes[axisIdx].start ; i <= axes[axisIdx].end ; ++i)
866+ helper[i].axisIdx = axisIdx;
867+ }
868+ return helper;
868869 }
869- return helper;
870870 };
871871
872872 InsetsAu boxBorder;
873873 Vec2Au spacing;
874874 Vec2Au tableBoxSize = {}, headerSize = {}, footerSize = {};
875- Vec<AxisHelper> rowHelper, colHelper ;
875+ Vec<AxisAndGroupsIdxs> rowGroupIdxs, colGroupIdxs ;
876876 PrefixSum<Au> colWidthPref, rowHeightPref;
877877 Math::Vec2u dataRowsInterval;
878878 Vec<Au> startPositionOfRow;
@@ -898,8 +898,8 @@ struct TableFormatingContext : FormatingContext {
898898 buildHTMLTable (box);
899899 buildBordersGrid (tree);
900900
901- rowHelper = buildAxisHelper (rows, rowGroups, grid.size .y );
902- colHelper = buildAxisHelper (cols, colGroups, grid.size .x );
901+ rowGroupIdxs = AxisAndGroupsIdxs::build (rows, rowGroups, grid.size .y );
902+ colGroupIdxs = AxisAndGroupsIdxs::build (cols, colGroups, grid.size .x );
903903
904904 startPositionOfRow.clear ();
905905 startPositionOfRow.resize (grid.size .y , 0_au);
@@ -1099,26 +1099,26 @@ struct TableFormatingContext : FormatingContext {
10991099
11001100 // if row is self contained, the <tr> it belongs to has size 1
11011101 bool forcedBreakAfterCurrRow =
1102- rowHelper [i].axisIdx and
1103- rows[rowHelper [i].axisIdx .unwrap ()].el .style ->break_ ->after == BreakBetween::PAGE;
1102+ rowGroupIdxs [i].axisIdx and
1103+ rows[rowGroupIdxs [i].axisIdx .unwrap ()].el .style ->break_ ->after == BreakBetween::PAGE;
11041104
11051105 bool forcedBreakBeforeNextRow =
11061106 i + 1 <= dataRowsInterval.y and
1107- rowHelper [i + 1 ].axisIdx and
1108- rows[rowHelper [i + 1 ].axisIdx .unwrap ()].el .style ->break_ ->before == BreakBetween::PAGE;
1107+ rowGroupIdxs [i + 1 ].axisIdx and
1108+ rows[rowGroupIdxs [i + 1 ].axisIdx .unwrap ()].el .style ->break_ ->before == BreakBetween::PAGE;
11091109
1110- bool limitOfCurrRowGroup = i + 1 <= dataRowsInterval.y and rowHelper [i].groupIdx != rowHelper [i + 1 ].groupIdx ;
1110+ bool limitOfCurrRowGroup = i + 1 <= dataRowsInterval.y and rowGroupIdxs [i].groupIdx != rowGroupIdxs [i + 1 ].groupIdx ;
11111111
11121112 bool forcedBreakAfterCurrRowGroup =
11131113 limitOfCurrRowGroup and
1114- rowHelper [i].groupIdx and
1115- rowGroups[rowHelper [i].groupIdx .unwrap ()].el .style ->break_ ->after == BreakBetween::PAGE;
1114+ rowGroupIdxs [i].groupIdx and
1115+ rowGroups[rowGroupIdxs [i].groupIdx .unwrap ()].el .style ->break_ ->after == BreakBetween::PAGE;
11161116
11171117 bool forcedBreakBeforeNextRowGroup =
11181118 limitOfCurrRowGroup and
11191119 i + 1 <= dataRowsInterval.y and
1120- rowHelper [i + 1 ].groupIdx and
1121- rowGroups[rowHelper [i + 1 ].groupIdx .unwrap ()].el .style ->break_ ->before == BreakBetween::PAGE;
1120+ rowGroupIdxs [i + 1 ].groupIdx and
1121+ rowGroups[rowGroupIdxs [i + 1 ].groupIdx .unwrap ()].el .style ->break_ ->before == BreakBetween::PAGE;
11221122
11231123 if (forcedBreakAfterCurrRow or forcedBreakBeforeNextRow or
11241124 forcedBreakAfterCurrRowGroup or forcedBreakBeforeNextRowGroup) {
@@ -1135,12 +1135,12 @@ struct TableFormatingContext : FormatingContext {
11351135 bool avoidBreakInsideTable = box.style ->break_ ->inside == BreakInside::AVOID;
11361136
11371137 bool avoidBreakInsideRow =
1138- rowHelper [i].axisIdx and
1139- rows[rowHelper [i].axisIdx .unwrap ()].el .style ->break_ ->inside == BreakInside::AVOID;
1138+ rowGroupIdxs [i].axisIdx and
1139+ rows[rowGroupIdxs [i].axisIdx .unwrap ()].el .style ->break_ ->inside == BreakInside::AVOID;
11401140
11411141 bool avoidBreakInsideRowGroup =
1142- rowHelper [i].groupIdx and
1143- rowGroups[rowHelper [i].groupIdx .unwrap ()].el .style ->break_ ->inside == BreakInside::AVOID;
1142+ rowGroupIdxs [i].groupIdx and
1143+ rowGroups[rowGroupIdxs [i].groupIdx .unwrap ()].el .style ->break_ ->inside == BreakInside::AVOID;
11441144
11451145 if (rowIsFreelyFragmentable) {
11461146 // breakpoint inside of row, take in consideration ALL breakpoints
0 commit comments