/// <summary> /// Applies special vertical alignment for table-cells /// </summary> /// <param name="g"></param> /// <param name="cell"></param> static void ApplyCellVerticalAlignment(CssBox cell, float tableBoxOffset) { float dist = 0f; switch (cell.VerticalAlign) { case CssVerticalAlign.Bottom: dist = cell.GetClientHeight() - cell.CalculateInnerContentHeight(); break; case CssVerticalAlign.Middle: dist = (cell.GetClientHeight() - cell.CalculateInnerContentHeight()) / 2; break; default: return; } if (dist > CssBoxConstConfig.TABLE_VERT_OFFSET_THESHOLD) { //more than our threshold if (cell.LineBoxCount > 0) { var linebox = cell.GetFirstLineBox(); while (linebox != null) { linebox.OffsetTop(dist); linebox = linebox.NextLine; } } else { foreach (CssBox b in cell.GetChildBoxIter()) { b.OffsetLocalTop(dist); } } } }