AutoTableLayout.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
  3. * (C) 2002 Dirk Mueller (mueller@kde.org)
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this library; see the file COPYING.LIB. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef AutoTableLayout_h
  21. #define AutoTableLayout_h
  22. #include "LayoutUnit.h"
  23. #include "Length.h"
  24. #include "TableLayout.h"
  25. #include <wtf/Vector.h>
  26. namespace WebCore {
  27. class RenderTable;
  28. class RenderTableCell;
  29. class AutoTableLayout : public TableLayout {
  30. public:
  31. AutoTableLayout(RenderTable*);
  32. ~AutoTableLayout();
  33. virtual void computeIntrinsicLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth) OVERRIDE;
  34. virtual void applyPreferredLogicalWidthQuirks(LayoutUnit& minWidth, LayoutUnit& maxWidth) const OVERRIDE;
  35. virtual void layout();
  36. private:
  37. void fullRecalc();
  38. void recalcColumn(unsigned effCol);
  39. int calcEffectiveLogicalWidth();
  40. void insertSpanCell(RenderTableCell*);
  41. struct Layout {
  42. Layout()
  43. : minLogicalWidth(0)
  44. , maxLogicalWidth(0)
  45. , effectiveMinLogicalWidth(0)
  46. , effectiveMaxLogicalWidth(0)
  47. , computedLogicalWidth(0)
  48. , emptyCellsOnly(true)
  49. {
  50. }
  51. Length logicalWidth;
  52. Length effectiveLogicalWidth;
  53. int minLogicalWidth;
  54. int maxLogicalWidth;
  55. int effectiveMinLogicalWidth;
  56. int effectiveMaxLogicalWidth;
  57. int computedLogicalWidth;
  58. bool emptyCellsOnly;
  59. };
  60. Vector<Layout, 4> m_layoutStruct;
  61. Vector<RenderTableCell*, 4> m_spanCells;
  62. bool m_hasPercent : 1;
  63. mutable bool m_effectiveLogicalWidthDirty : 1;
  64. };
  65. } // namespace WebCore
  66. #endif // AutoTableLayout_h