2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Author:
|
|
|
|
Eric D Vaughan
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef nsBoxLayoutState_h___
|
|
|
|
#define nsBoxLayoutState_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
class nsRenderingContext;
|
2012-08-06 07:00:56 +04:00
|
|
|
struct nsHTMLReflowState;
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2013-04-12 07:20:45 +04:00
|
|
|
class MOZ_STACK_CLASS nsBoxLayoutState
|
2000-03-31 11:02:06 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsBoxLayoutState(nsPresContext* aPresContext,
|
|
|
|
nsRenderingContext* aRenderingContext = nullptr,
|
|
|
|
// see OuterReflowState() below
|
|
|
|
const nsHTMLReflowState* aOuterReflowState = nullptr,
|
|
|
|
uint16_t aReflowDepth = 0);
|
2014-06-02 16:08:24 +04:00
|
|
|
nsBoxLayoutState(const nsBoxLayoutState& aState);
|
2004-06-22 06:55:04 +04: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 08:38:33 +03:00
|
|
|
nsPresContext* PresContext() const { return mPresContext; }
|
|
|
|
nsIPresShell* PresShell() const { return mPresContext->PresShell(); }
|
2004-06-22 06:55:04 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t LayoutFlags() const { return mLayoutFlags; }
|
|
|
|
void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; }
|
2000-04-25 11:10:48 +04:00
|
|
|
|
2000-10-07 04:49:08 +04:00
|
|
|
// if true no one under us will paint during reflow.
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; }
|
|
|
|
bool PaintingDisabled() const { return mPaintingDisabled; }
|
2000-10-07 04:49:08 +04: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 08:38:33 +03: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 05:04:40 +04:00
|
|
|
nsRenderingContext* GetRenderingContext() const { return mRenderingContext; }
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2012-05-04 04:14:02 +04:00
|
|
|
struct AutoReflowDepth {
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit AutoReflowDepth(nsBoxLayoutState& aState)
|
2012-05-04 04:14:02 +04:00
|
|
|
: mState(aState) { ++mState.mReflowDepth; }
|
|
|
|
~AutoReflowDepth() { --mState.mReflowDepth; }
|
|
|
|
nsBoxLayoutState& mState;
|
|
|
|
};
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2011-11-24 06:48:23 +04: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 19:56:38 +04:00
|
|
|
uint16_t GetReflowDepth() { return mReflowDepth; }
|
2008-04-10 08:39:41 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
private:
|
2010-03-25 16:17:11 +03:00
|
|
|
nsRefPtr<nsPresContext> mPresContext;
|
2011-04-08 05:04:40 +04:00
|
|
|
nsRenderingContext *mRenderingContext;
|
2011-11-24 06:48:23 +04:00
|
|
|
const nsHTMLReflowState *mOuterReflowState;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLayoutFlags;
|
|
|
|
uint16_t mReflowDepth;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPaintingDisabled;
|
2000-03-31 11:02:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|