nsBoxLayout.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. //
  6. // Eric Vaughan
  7. // Netscape Communications
  8. //
  9. // See documentation in associated header file
  10. //
  11. #include "nsBox.h"
  12. #include "nsCOMPtr.h"
  13. #include "nsContainerFrame.h"
  14. #include "nsBoxLayout.h"
  15. void
  16. nsBoxLayout::AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize)
  17. {
  18. nsBox::AddBorderAndPadding(aBox, aSize);
  19. }
  20. void
  21. nsBoxLayout::AddMargin(nsIFrame* aBox, nsSize& aSize)
  22. {
  23. nsBox::AddMargin(aBox, aSize);
  24. }
  25. void
  26. nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin)
  27. {
  28. nsBox::AddMargin(aSize, aMargin);
  29. }
  30. nsSize
  31. nsBoxLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
  32. {
  33. nsSize pref (0, 0);
  34. AddBorderAndPadding(aBox, pref);
  35. return pref;
  36. }
  37. nsSize
  38. nsBoxLayout::GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
  39. {
  40. nsSize minSize (0,0);
  41. AddBorderAndPadding(aBox, minSize);
  42. return minSize;
  43. }
  44. nsSize
  45. nsBoxLayout::GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
  46. {
  47. //AddBorderAndPadding () never changes maxSize (NS_INTRINSICSIZE)
  48. //AddBorderAndPadding(aBox, maxSize);
  49. return nsSize (NS_INTRINSICSIZE,NS_INTRINSICSIZE);
  50. }
  51. nscoord
  52. nsBoxLayout::GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
  53. {
  54. return 0;
  55. }
  56. NS_IMETHODIMP
  57. nsBoxLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
  58. {
  59. return NS_OK;
  60. }
  61. void
  62. nsBoxLayout::AddLargestSize(nsSize& aSize, const nsSize& aSize2)
  63. {
  64. if (aSize2.width > aSize.width)
  65. aSize.width = aSize2.width;
  66. if (aSize2.height > aSize.height)
  67. aSize.height = aSize2.height;
  68. }
  69. void
  70. nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2)
  71. {
  72. if (aSize2.width < aSize.width)
  73. aSize.width = aSize2.width;
  74. if (aSize2.height < aSize.height)
  75. aSize.height = aSize2.height;
  76. }
  77. NS_IMPL_ISUPPORTS(nsBoxLayout, nsBoxLayout)