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/. */
|
2000-03-31 07:02:06 +00:00
|
|
|
|
|
|
|
#ifndef nsBox_h___
|
|
|
|
#define nsBox_h___
|
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2018-09-20 01:20:55 +00:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2004-09-28 18:37:50 +00:00
|
|
|
#include "nsIFrame.h"
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2001-12-17 22:51:39 +00:00
|
|
|
class nsITheme;
|
|
|
|
|
2004-09-28 18:37:50 +00:00
|
|
|
class nsBox : public nsIFrame {
|
2000-03-31 07:02:06 +00:00
|
|
|
public:
|
2004-09-28 18:37:50 +00:00
|
|
|
friend class nsIFrame;
|
|
|
|
|
2002-12-11 02:33:33 +00:00
|
|
|
static void Shutdown();
|
|
|
|
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nscoord GetXULFlex() override;
|
2016-04-21 04:28:32 +00:00
|
|
|
virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
|
2004-09-28 18:37:50 +00:00
|
|
|
|
2016-04-21 04:28:31 +00:00
|
|
|
virtual nsSize GetXULMinSizeForScrollArea(
|
|
|
|
nsBoxLayoutState& aBoxLayoutState) override;
|
2004-11-03 02:52:16 +00:00
|
|
|
|
2016-04-21 04:28:32 +00:00
|
|
|
virtual bool IsXULCollapsed() override;
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2016-04-21 04:28:32 +00:00
|
|
|
virtual void SetXULBounds(nsBoxLayoutState& aBoxLayoutState,
|
|
|
|
const nsRect& aRect,
|
|
|
|
bool aRemoveOverflowAreas = false) override;
|
2004-09-28 18:37:50 +00:00
|
|
|
|
2016-04-21 04:28:33 +00:00
|
|
|
virtual nsresult GetXULBorder(nsMargin& aBorderAndPadding) override;
|
2016-04-21 04:28:33 +00:00
|
|
|
virtual nsresult GetXULPadding(nsMargin& aBorderAndPadding) override;
|
2016-04-21 04:28:33 +00:00
|
|
|
virtual nsresult GetXULMargin(nsMargin& aMargin) override;
|
2004-09-28 18:37:50 +00:00
|
|
|
|
2016-04-21 04:28:33 +00:00
|
|
|
virtual Valignment GetXULVAlign() const override { return vAlign_Top; }
|
2016-04-21 04:28:33 +00:00
|
|
|
virtual Halignment GetXULHAlign() const override { return hAlign_Left; }
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2016-04-21 04:28:34 +00:00
|
|
|
virtual nsresult XULRelayoutChildAtOrdinal(nsIFrame* aChild) override;
|
2004-09-28 18:37:50 +00:00
|
|
|
|
2017-05-26 10:11:11 +00:00
|
|
|
nsBox(ClassID aID);
|
2001-12-17 22:51:39 +00:00
|
|
|
virtual ~nsBox();
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2004-07-16 16:56:21 +00:00
|
|
|
/**
|
2018-05-02 14:32:54 +00:00
|
|
|
* Returns true if this box clips its children, e.g., if this box is an
|
|
|
|
* scrollbox.
|
2004-09-28 18:37:50 +00:00
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool DoesClipChildren();
|
|
|
|
virtual bool ComputesOwnOverflowArea() = 0;
|
2004-07-16 16:56:21 +00:00
|
|
|
|
2014-06-02 12:08:21 +00:00
|
|
|
nsresult SyncLayout(nsBoxLayoutState& aBoxLayoutState);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool DoesNeedRecalc(const nsSize& aSize);
|
|
|
|
bool DoesNeedRecalc(nscoord aCoord);
|
2004-09-28 18:37:50 +00:00
|
|
|
void SizeNeedsRecalc(nsSize& aSize);
|
|
|
|
void CoordNeedsRecalc(nscoord& aCoord);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2004-09-28 18:37:50 +00:00
|
|
|
void AddBorderAndPadding(nsSize& aSize);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2012-08-06 03:00:57 +00:00
|
|
|
static void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
|
|
|
|
static void AddMargin(nsIFrame* aChild, nsSize& aSize);
|
2000-03-31 07:02:06 +00:00
|
|
|
static void AddMargin(nsSize& aSize, const nsMargin& aMargin);
|
|
|
|
|
2008-01-05 05:49:44 +00:00
|
|
|
static nsSize BoundsCheckMinMax(const nsSize& aMinSize,
|
|
|
|
const nsSize& aMaxSize);
|
|
|
|
static nsSize BoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize,
|
|
|
|
const nsSize& aMaxSize);
|
|
|
|
static nscoord BoundsCheck(nscoord aMinSize, nscoord aPrefSize,
|
|
|
|
nscoord aMaxSize);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2016-04-21 04:28:32 +00:00
|
|
|
static nsIFrame* GetChildXULBox(const nsIFrame* aFrame);
|
2016-04-21 04:28:32 +00:00
|
|
|
static nsIFrame* GetNextXULBox(const nsIFrame* aFrame);
|
2016-04-21 04:28:32 +00:00
|
|
|
static nsIFrame* GetParentXULBox(const nsIFrame* aFrame);
|
2014-05-24 22:20:41 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
protected:
|
2016-04-21 04:28:34 +00:00
|
|
|
nsresult BeginXULLayout(nsBoxLayoutState& aState);
|
2016-04-21 04:28:35 +00:00
|
|
|
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
|
2016-04-21 04:28:35 +00:00
|
|
|
nsresult EndXULLayout(nsBoxLayoutState& aState);
|
2000-07-07 22:24:06 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool gGotTheme;
|
2018-09-20 01:20:55 +00:00
|
|
|
static mozilla::StaticRefPtr<nsITheme> gTheme;
|
2001-12-17 22:51:39 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
enum eMouseThrough { unset, never, always };
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|