layout/xul/nsBoxLayoutState.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /**
michael@0 7
michael@0 8 Author:
michael@0 9 Eric D Vaughan
michael@0 10
michael@0 11 **/
michael@0 12
michael@0 13 #ifndef nsBoxLayoutState_h___
michael@0 14 #define nsBoxLayoutState_h___
michael@0 15
michael@0 16 #include "nsCOMPtr.h"
michael@0 17 #include "nsPresContext.h"
michael@0 18 #include "nsIPresShell.h"
michael@0 19
michael@0 20 class nsRenderingContext;
michael@0 21 class nsCalculatedBoxInfo;
michael@0 22 struct nsHTMLReflowMetrics;
michael@0 23 struct nsHTMLReflowState;
michael@0 24 class nsString;
michael@0 25 class nsHTMLReflowCommand;
michael@0 26
michael@0 27 class MOZ_STACK_CLASS nsBoxLayoutState
michael@0 28 {
michael@0 29 public:
michael@0 30 nsBoxLayoutState(nsPresContext* aPresContext,
michael@0 31 nsRenderingContext* aRenderingContext = nullptr,
michael@0 32 // see OuterReflowState() below
michael@0 33 const nsHTMLReflowState* aOuterReflowState = nullptr,
michael@0 34 uint16_t aReflowDepth = 0) NS_HIDDEN;
michael@0 35 nsBoxLayoutState(const nsBoxLayoutState& aState) NS_HIDDEN;
michael@0 36
michael@0 37 nsPresContext* PresContext() const { return mPresContext; }
michael@0 38 nsIPresShell* PresShell() const { return mPresContext->PresShell(); }
michael@0 39
michael@0 40 uint32_t LayoutFlags() const { return mLayoutFlags; }
michael@0 41 void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; }
michael@0 42
michael@0 43 // if true no one under us will paint during reflow.
michael@0 44 void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; }
michael@0 45 bool PaintingDisabled() const { return mPaintingDisabled; }
michael@0 46
michael@0 47 // The rendering context may be null for specialized uses of
michael@0 48 // nsBoxLayoutState and should be null-checked before it is used.
michael@0 49 // However, passing a null rendering context to the constructor when
michael@0 50 // doing box layout or intrinsic size calculation will cause bugs.
michael@0 51 nsRenderingContext* GetRenderingContext() const { return mRenderingContext; }
michael@0 52
michael@0 53 struct AutoReflowDepth {
michael@0 54 AutoReflowDepth(nsBoxLayoutState& aState)
michael@0 55 : mState(aState) { ++mState.mReflowDepth; }
michael@0 56 ~AutoReflowDepth() { --mState.mReflowDepth; }
michael@0 57 nsBoxLayoutState& mState;
michael@0 58 };
michael@0 59
michael@0 60 // The HTML reflow state that lives outside the box-block boundary.
michael@0 61 // May not be set reliably yet.
michael@0 62 const nsHTMLReflowState* OuterReflowState() { return mOuterReflowState; }
michael@0 63
michael@0 64 uint16_t GetReflowDepth() { return mReflowDepth; }
michael@0 65
michael@0 66 private:
michael@0 67 nsRefPtr<nsPresContext> mPresContext;
michael@0 68 nsRenderingContext *mRenderingContext;
michael@0 69 const nsHTMLReflowState *mOuterReflowState;
michael@0 70 uint32_t mLayoutFlags;
michael@0 71 uint16_t mReflowDepth;
michael@0 72 bool mPaintingDisabled;
michael@0 73 };
michael@0 74
michael@0 75 #endif
michael@0 76

mercurial