1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/xul/grid/nsGridLayout2.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 + 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef nsGridLayout2_h___ 1.11 +#define nsGridLayout2_h___ 1.12 + 1.13 +#include "mozilla/Attributes.h" 1.14 +#include "nsStackLayout.h" 1.15 +#include "nsIGridPart.h" 1.16 +#include "nsCoord.h" 1.17 +#include "nsGrid.h" 1.18 + 1.19 +class nsIPresContext; 1.20 +class nsGridRowGroupLayout; 1.21 +class nsGridRowLayout; 1.22 +class nsGridRow; 1.23 +class nsBoxLayoutState; 1.24 +class nsGridCell; 1.25 + 1.26 +/** 1.27 + * The nsBoxLayout implementation for a grid. 1.28 + */ 1.29 +class nsGridLayout2 : public nsStackLayout, 1.30 + public nsIGridPart 1.31 +{ 1.32 +public: 1.33 + 1.34 + friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsBoxLayout** aNewLayout); 1.35 + 1.36 + NS_DECL_ISUPPORTS_INHERITED 1.37 + 1.38 + NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; 1.39 + virtual void IntrinsicWidthsDirty(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; 1.40 + 1.41 + virtual nsGridRowGroupLayout* CastToRowGroupLayout() MOZ_OVERRIDE { return nullptr; } 1.42 + virtual nsGridLayout2* CastToGridLayout() MOZ_OVERRIDE { return this; } 1.43 + virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor=nullptr) MOZ_OVERRIDE; 1.44 + virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox, nsIFrame** aParentBox) MOZ_OVERRIDE { 1.45 + NS_NOTREACHED("Should not be called"); return nullptr; 1.46 + } 1.47 + virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; 1.48 + virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; 1.49 + virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; 1.50 + virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount, int32_t& aComputedColumnCount) MOZ_OVERRIDE { aRowCount++; } 1.51 + virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) MOZ_OVERRIDE { } 1.52 + virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) MOZ_OVERRIDE; 1.53 + virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) MOZ_OVERRIDE; 1.54 + virtual Type GetType() MOZ_OVERRIDE { return eGrid; } 1.55 + virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState, 1.56 + nsIFrame* aPrevBox, 1.57 + const nsFrameList::Slice& aNewChildren) MOZ_OVERRIDE; 1.58 + virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState, 1.59 + const nsFrameList::Slice& aNewChildren) MOZ_OVERRIDE; 1.60 + virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState, 1.61 + nsIFrame* aChildList) MOZ_OVERRIDE; 1.62 + virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState, 1.63 + nsIFrame* aChildList) MOZ_OVERRIDE; 1.64 + 1.65 + virtual nsIGridPart* AsGridPart() MOZ_OVERRIDE { return this; } 1.66 + 1.67 + static void AddOffset(nsBoxLayoutState& aState, nsIFrame* aChild, nsSize& aSize); 1.68 + 1.69 +protected: 1.70 + 1.71 + nsGridLayout2(nsIPresShell* aShell); 1.72 + nsGrid mGrid; 1.73 + 1.74 +private: 1.75 + void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal); 1.76 + 1.77 + 1.78 +}; // class nsGridLayout2 1.79 + 1.80 + 1.81 +#endif 1.82 +