flexbox-intrinsic-sizing-horiz-1a.xhtml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Any copyright is dedicated to the Public Domain.
  4. http://creativecommons.org/publicdomain/zero/1.0/
  5. -->
  6. <!--
  7. This test has a number of tables, each with 2 flexboxes side-by-side,
  8. whose "width" values depend on the flexbox's min and/or pref widths.
  9. There's not enough space for both flexboxes to fit side-by-side, so their
  10. width preferences must be balanced This exercises
  11. nsFlexContainerFrame::GetPrefWidth() & ::GetMinWidth().
  12. IN EACH CASE, div.a has these intrinsic widths:
  13. Pref width: 2*40 + 1*50 + 2*10 = 150px (2*aaaa + 1*aaaaa + 2*space)
  14. Min width: 50px (width of "aaaaa")
  15. and div.b has these intrinsic widths:
  16. Pref width: 5*20 + 3*10 + 7*10 = 200px (5*bb + 3*b + 7*space)
  17. Min width: 20px (width "bb")
  18. -->
  19. <html xmlns="http://www.w3.org/1999/xhtml">
  20. <head>
  21. <link rel="stylesheet" type="text/css" href="ahem.css" />
  22. <style>
  23. table {
  24. width: 300px;
  25. font: 10px Ahem;
  26. margin-bottom: 2px;
  27. border: 1px dashed black;
  28. }
  29. div.a, div.b { display: flex; }
  30. div.a { background: lightgreen; }
  31. div.b { background: lightblue; }
  32. <!-- helper-classes for assigning pref / min / auto-width to our divs -->
  33. div.prefWidth {
  34. width: -moz-max-content;
  35. }
  36. div.minWidth {
  37. width: -moz-min-content;
  38. }
  39. div.autoWidth {
  40. width: auto;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <!-- both auto width -->
  46. <table cellpadding="0" cellspacing="0"><tr>
  47. <td><div class="a autoWidth">aaaa aaaa aaaaa</div></td>
  48. <td><div class="b autoWidth">bb bb b bb bb b bb b</div></td>
  49. </tr></table>
  50. <!-- MIXING MIN WIDTH & AUTO -->
  51. <!-- both min width -->
  52. <table cellpadding="0" cellspacing="0"><tr>
  53. <td><div class="a minWidth">aaaa aaaa aaaaa</div></td>
  54. <td><div class="b minWidth">bb bb b bb bb b bb b</div></td>
  55. </tr></table>
  56. <!-- min,auto -->
  57. <table cellpadding="0" cellspacing="0"><tr>
  58. <td><div class="a minWidth">aaaa aaaa aaaaa</div></td>
  59. <td><div class="b autoWidth">bb bb b bb bb b bb b</div></td>
  60. </tr></table>
  61. <!-- auto,min -->
  62. <table cellpadding="0" cellspacing="0"><tr>
  63. <td><div class="a autoWidth">aaaa aaaa aaaaa</div></td>
  64. <td><div class="b minWidth">bb bb b bb bb b bb b</div></td>
  65. </tr></table>
  66. <!-- MIXING PREF WIDTH & AUTO -->
  67. <!-- both prefWidth (NOTE: makes the table larger than it wants to be -->
  68. <table cellpadding="0" cellspacing="0"><tr>
  69. <td><div class="a prefWidth">aaaa aaaa aaaaa</div></td>
  70. <td><div class="b prefWidth">bb bb b bb bb b bb b</div></td>
  71. </tr></table>
  72. <!-- pref,auto -->
  73. <table cellpadding="0" cellspacing="0"><tr>
  74. <td><div class="a prefWidth">aaaa aaaa aaaaa</div></td>
  75. <td><div class="b autoWidth">bb bb b bb bb b bb b</div></td>
  76. </tr></table>
  77. <!-- auto,pref -->
  78. <table cellpadding="0" cellspacing="0"><tr>
  79. <td><div class="a autoWidth">aaaa aaaa aaaaa</div></td>
  80. <td><div class="b prefWidth">bb bb b bb bb b bb b</div></td>
  81. </tr></table>
  82. <!-- MIXING PREF WIDTH & MIN WIDTH -->
  83. <!-- min,pref -->
  84. <table cellpadding="0" cellspacing="0"><tr>
  85. <td><div class="a minWidth">aaaa aaaa aaaaa</div></td>
  86. <td><div class="b prefWidth">bb bb b bb bb b bb b</div></td>
  87. </tr></table>
  88. <!-- pref,min -->
  89. <table cellpadding="0" cellspacing="0"><tr>
  90. <td><div class="a prefWidth">aaaa aaaa aaaaa</div></td>
  91. <td><div class="b minWidth">bb bb b bb bb b bb b</div></td>
  92. </tr></table>
  93. </body>
  94. </html>