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