+ // 1b. Calculate maximum possible width if line wrapping would be disabled
+ // Recalculate total width if m_WidthFloat is zero to keep tables as small
+ // as possible.
+ int maxWidth = 0;
+ for (i = 0; i < m_NumCols; i++)
+ if (m_ColsInfo[i].width == 0)
+ {
+ maxWidth += m_ColsInfo[i].maxWidth;
+ }
+
+ if (!m_WidthFloat)
+ {
+ // Recalculate table width since no table width was initially given
+ int newWidth = m_Width - wpix + maxWidth;
+
+ // Make sure that floating-width columns will have the right size.
+ // Calculate sum of all floating-width columns
+ int percentage = 0;
+ for (i = 0; i < m_NumCols; i++)
+ if ((m_ColsInfo[i].units == wxHTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
+ percentage += m_ColsInfo[i].width;
+
+ if (percentage >= 100)
+ newWidth = w;
+ else
+ newWidth = newWidth * 100 / (100 - percentage);
+
+ newWidth = wxMin(newWidth, w - (m_NumCols + 1) * m_Spacing - 2 * m_Border);
+ wpix -= m_Width - newWidth;
+ m_Width = newWidth;
+ }
+
+
+ // 1c. setup floating-width columns:
+ int wtemp = wpix;