2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Author:
|
|
|
|
Eric D Vaughan
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef nsBoxLayoutState_h___
|
|
|
|
#define nsBoxLayoutState_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2000-03-31 07:02:06 +00:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
class nsRenderingContext;
|
2000-03-31 07:02:06 +00:00
|
|
|
class nsCalculatedBoxInfo;
|
|
|
|
struct nsHTMLReflowMetrics;
|
2012-08-06 03:00:56 +00:00
|
|
|
struct nsHTMLReflowState;
|
2000-03-31 07:02:06 +00:00
|
|
|
class nsString;
|
2001-12-17 22:39:59 +00:00
|
|
|
class nsHTMLReflowCommand;
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2013-04-12 03:20:45 +00:00
|
|
|
class MOZ_STACK_CLASS nsBoxLayoutState
|
2000-03-31 07:02:06 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-11-24 02:48:23 +00:00
|
|
|
nsBoxLayoutState(nsPresContext* aPresContext,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsRenderingContext* aRenderingContext = nullptr,
|
2011-11-24 02:48:23 +00:00
|
|
|
// see OuterReflowState() below
|
2012-07-30 14:20:58 +00:00
|
|
|
const nsHTMLReflowState* aOuterReflowState = nullptr,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint16_t aReflowDepth = 0) NS_HIDDEN;
|
2004-06-22 02:55:04 +00:00
|
|
|
nsBoxLayoutState(const nsBoxLayoutState& aState) NS_HIDDEN;
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
nsPresContext* PresContext() const { return mPresContext; }
|
|
|
|
nsIPresShell* PresShell() const { return mPresContext->PresShell(); }
|
2004-06-22 02:55:04 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t LayoutFlags() const { return mLayoutFlags; }
|
|
|
|
void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; }
|
2000-04-25 07:10:48 +00:00
|
|
|
|
2000-10-07 00:49:08 +00:00
|
|
|
// if true no one under us will paint during reflow.
|
2011-09-29 06:19:26 +00:00
|
|
|
void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; }
|
|
|
|
bool PaintingDisabled() const { return mPaintingDisabled; }
|
2000-10-07 00:49:08 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00: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-08 01:04:40 +00:00
|
|
|
nsRenderingContext* GetRenderingContext() const { return mRenderingContext; }
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2012-05-04 00:14:02 +00:00
|
|
|
struct AutoReflowDepth {
|
|
|
|
AutoReflowDepth(nsBoxLayoutState& aState)
|
|
|
|
: mState(aState) { ++mState.mReflowDepth; }
|
|
|
|
~AutoReflowDepth() { --mState.mReflowDepth; }
|
|
|
|
nsBoxLayoutState& mState;
|
|
|
|
};
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2011-11-24 02:48:23 +00: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 15:56:38 +00:00
|
|
|
uint16_t GetReflowDepth() { return mReflowDepth; }
|
2008-04-10 04:39:41 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
private:
|
2010-03-25 13:17:11 +00:00
|
|
|
nsRefPtr<nsPresContext> mPresContext;
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext *mRenderingContext;
|
2011-11-24 02:48:23 +00:00
|
|
|
const nsHTMLReflowState *mOuterReflowState;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mLayoutFlags;
|
|
|
|
uint16_t mReflowDepth;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mPaintingDisabled;
|
2000-03-31 07:02:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|