2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Author:
|
|
|
|
Eric D Vaughan
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef nsBoxLayoutState_h___
|
|
|
|
#define nsBoxLayoutState_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsPresContext.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
class nsRenderingContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsCalculatedBoxInfo;
|
|
|
|
struct nsHTMLReflowMetrics;
|
2012-08-05 20:00:56 -07:00
|
|
|
struct nsHTMLReflowState;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsString;
|
|
|
|
class nsHTMLReflowCommand;
|
|
|
|
|
2013-04-11 20:20:45 -07:00
|
|
|
class MOZ_STACK_CLASS nsBoxLayoutState
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2011-11-23 18:48:23 -08:00
|
|
|
nsBoxLayoutState(nsPresContext* aPresContext,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsRenderingContext* aRenderingContext = nullptr,
|
2011-11-23 18:48:23 -08:00
|
|
|
// see OuterReflowState() below
|
2012-07-30 07:20:58 -07:00
|
|
|
const nsHTMLReflowState* aOuterReflowState = nullptr,
|
2014-06-02 05:08:24 -07:00
|
|
|
uint16_t aReflowDepth = 0);
|
|
|
|
nsBoxLayoutState(const nsBoxLayoutState& aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsPresContext* PresContext() const { return mPresContext; }
|
|
|
|
nsIPresShell* PresShell() const { return mPresContext->PresShell(); }
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t LayoutFlags() const { return mLayoutFlags; }
|
|
|
|
void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// if true no one under us will paint during reflow.
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; }
|
|
|
|
bool PaintingDisabled() const { return mPaintingDisabled; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// The rendering context may be null for specialized uses of
|
|
|
|
// nsBoxLayoutState and should be null-checked before it is used.
|
|
|
|
// However, passing a null rendering context to the constructor when
|
|
|
|
// doing box layout or intrinsic size calculation will cause bugs.
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext* GetRenderingContext() const { return mRenderingContext; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-03 17:14:02 -07:00
|
|
|
struct AutoReflowDepth {
|
|
|
|
AutoReflowDepth(nsBoxLayoutState& aState)
|
|
|
|
: mState(aState) { ++mState.mReflowDepth; }
|
|
|
|
~AutoReflowDepth() { --mState.mReflowDepth; }
|
|
|
|
nsBoxLayoutState& mState;
|
|
|
|
};
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-11-23 18:48:23 -08:00
|
|
|
// The HTML reflow state that lives outside the box-block boundary.
|
|
|
|
// May not be set reliably yet.
|
|
|
|
const nsHTMLReflowState* OuterReflowState() { return mOuterReflowState; }
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint16_t GetReflowDepth() { return mReflowDepth; }
|
2008-04-09 21:39:41 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2010-03-25 06:17:11 -07:00
|
|
|
nsRefPtr<nsPresContext> mPresContext;
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext *mRenderingContext;
|
2011-11-23 18:48:23 -08:00
|
|
|
const nsHTMLReflowState *mOuterReflowState;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mLayoutFlags;
|
|
|
|
uint16_t mReflowDepth;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mPaintingDisabled;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|