1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/xul/nsBoxLayout.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// 1.10 +// Eric Vaughan 1.11 +// Netscape Communications 1.12 +// 1.13 +// See documentation in associated header file 1.14 +// 1.15 + 1.16 +#include "nsBox.h" 1.17 +#include "nsCOMPtr.h" 1.18 +#include "nsContainerFrame.h" 1.19 +#include "nsBoxLayout.h" 1.20 + 1.21 +void 1.22 +nsBoxLayout::AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize) 1.23 +{ 1.24 + nsBox::AddBorderAndPadding(aBox, aSize); 1.25 +} 1.26 + 1.27 +void 1.28 +nsBoxLayout::AddMargin(nsIFrame* aBox, nsSize& aSize) 1.29 +{ 1.30 + nsBox::AddMargin(aBox, aSize); 1.31 +} 1.32 + 1.33 +void 1.34 +nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin) 1.35 +{ 1.36 + nsBox::AddMargin(aSize, aMargin); 1.37 +} 1.38 + 1.39 +nsSize 1.40 +nsBoxLayout::GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) 1.41 +{ 1.42 + nsSize pref (0, 0); 1.43 + AddBorderAndPadding(aBox, pref); 1.44 + 1.45 + return pref; 1.46 +} 1.47 + 1.48 +nsSize 1.49 +nsBoxLayout::GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) 1.50 +{ 1.51 + nsSize minSize (0,0); 1.52 + AddBorderAndPadding(aBox, minSize); 1.53 + return minSize; 1.54 +} 1.55 + 1.56 +nsSize 1.57 +nsBoxLayout::GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) 1.58 +{ 1.59 + //AddBorderAndPadding () never changes maxSize (NS_INTRINSICSIZE) 1.60 + //AddBorderAndPadding(aBox, maxSize); 1.61 + return nsSize (NS_INTRINSICSIZE,NS_INTRINSICSIZE); 1.62 +} 1.63 + 1.64 + 1.65 +nscoord 1.66 +nsBoxLayout::GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) 1.67 +{ 1.68 + return 0; 1.69 +} 1.70 + 1.71 +NS_IMETHODIMP 1.72 +nsBoxLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) 1.73 +{ 1.74 + return NS_OK; 1.75 +} 1.76 + 1.77 +void 1.78 +nsBoxLayout::AddLargestSize(nsSize& aSize, const nsSize& aSize2) 1.79 +{ 1.80 + if (aSize2.width > aSize.width) 1.81 + aSize.width = aSize2.width; 1.82 + 1.83 + if (aSize2.height > aSize.height) 1.84 + aSize.height = aSize2.height; 1.85 +} 1.86 + 1.87 +void 1.88 +nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2) 1.89 +{ 1.90 + if (aSize2.width < aSize.width) 1.91 + aSize.width = aSize2.width; 1.92 + 1.93 + if (aSize2.height < aSize.height) 1.94 + aSize.height = aSize2.height; 1.95 +} 1.96 + 1.97 +NS_IMPL_ISUPPORTS(nsBoxLayout, nsBoxLayout)