2017-10-27 17:33:53 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-10-08 20:37:56 +00:00
|
|
|
|
|
|
|
#ifndef nsGridLayout2_h___
|
|
|
|
#define nsGridLayout2_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-10-08 20:37:56 +00:00
|
|
|
#include "nsStackLayout.h"
|
|
|
|
#include "nsIGridPart.h"
|
2012-08-06 03:00:57 +00:00
|
|
|
#include "nsCoord.h"
|
2001-10-08 20:37:56 +00:00
|
|
|
#include "nsGrid.h"
|
|
|
|
|
|
|
|
class nsGridRowGroupLayout;
|
|
|
|
class nsGridRowLayout;
|
|
|
|
class nsGridRow;
|
|
|
|
class nsBoxLayoutState;
|
|
|
|
|
2005-11-22 05:52:34 +00:00
|
|
|
/**
|
2011-07-11 14:05:10 +00:00
|
|
|
* The nsBoxLayout implementation for a grid.
|
2005-11-22 05:52:34 +00:00
|
|
|
*/
|
2017-07-06 12:00:35 +00:00
|
|
|
class nsGridLayout2 final : public nsStackLayout, public nsIGridPart {
|
2001-10-08 20:37:56 +00:00
|
|
|
public:
|
2011-07-11 14:05:10 +00:00
|
|
|
friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell,
|
|
|
|
nsBoxLayout** aNewLayout);
|
2001-10-08 20:37:56 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2016-04-21 04:28:32 +00:00
|
|
|
NS_IMETHOD XULLayout(nsIFrame* aBox,
|
|
|
|
nsBoxLayoutState& aBoxLayoutState) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void IntrinsicISizesDirty(nsIFrame* aBox,
|
|
|
|
nsBoxLayoutState& aBoxLayoutState) override;
|
2001-10-08 20:37:56 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsGridRowGroupLayout* CastToRowGroupLayout() override {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
virtual nsGridLayout2* CastToGridLayout() override { return this; }
|
|
|
|
virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex,
|
|
|
|
nsGridRowLayout* aRequestor = nullptr) override;
|
|
|
|
virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox,
|
|
|
|
nsIFrame** aParentBox) override {
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Should not be called");
|
|
|
|
return nullptr;
|
2011-07-04 14:39:10 +00:00
|
|
|
}
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULMinSize(nsIFrame* aBox,
|
|
|
|
nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULMaxSize(nsIFrame* aBox,
|
|
|
|
nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULPrefSize(nsIFrame* aBox,
|
|
|
|
nsBoxLayoutState& aBoxLayoutState) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
|
|
|
|
int32_t& aComputedColumnCount) override {
|
|
|
|
aRowCount++;
|
|
|
|
}
|
|
|
|
virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) override {}
|
|
|
|
virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) override;
|
|
|
|
virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) override;
|
|
|
|
virtual Type GetType() override { return eGrid; }
|
2012-08-06 03:00:57 +00:00
|
|
|
virtual void ChildrenInserted(
|
|
|
|
nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aPrevBox,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsFrameList::Slice& aNewChildren) override;
|
2012-08-06 03:00:57 +00:00
|
|
|
virtual void ChildrenAppended(
|
|
|
|
nsIFrame* aBox, nsBoxLayoutState& aState,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsFrameList::Slice& aNewChildren) override;
|
2012-08-06 03:00:57 +00:00
|
|
|
virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIFrame* aChildList) override;
|
2012-08-06 03:00:57 +00:00
|
|
|
virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIFrame* aChildList) override;
|
2009-09-13 21:13:54 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIGridPart* AsGridPart() override { return this; }
|
2011-07-04 14:39:10 +00:00
|
|
|
|
2015-12-07 18:17:47 +00:00
|
|
|
static void AddOffset(nsIFrame* aChild, nsSize& aSize);
|
2009-09-13 21:13:54 +00:00
|
|
|
|
2001-10-08 20:37:56 +00:00
|
|
|
protected:
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsGridLayout2(nsIPresShell* aShell);
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~nsGridLayout2();
|
2001-10-08 20:37:56 +00:00
|
|
|
nsGrid mGrid;
|
|
|
|
|
2001-11-08 20:46:02 +00:00
|
|
|
private:
|
2011-09-29 06:19:26 +00:00
|
|
|
void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal);
|
2001-11-08 20:46:02 +00:00
|
|
|
|
2001-10-08 20:37:56 +00:00
|
|
|
}; // class nsGridLayout2
|
|
|
|
|
|
|
|
#endif
|