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/. */
|
2011-08-08 19:14:34 +04:00
|
|
|
|
|
|
|
#ifndef nsAutoLayoutPhase_h
|
|
|
|
#define nsAutoLayoutPhase_h
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
2013-01-23 23:37:17 +04:00
|
|
|
// We can't forward declare an enum before C++11 which means we have to include
|
|
|
|
// nsPresContext.h just because nsLayoutPhase is passed to the ctor.
|
2011-08-08 19:14:34 +04:00
|
|
|
# include "nsPresContext.h"
|
|
|
|
|
|
|
|
struct nsAutoLayoutPhase {
|
2013-01-23 23:37:17 +04:00
|
|
|
nsAutoLayoutPhase(nsPresContext* aPresContext, nsLayoutPhase aPhase);
|
|
|
|
~nsAutoLayoutPhase();
|
2011-08-08 19:14:34 +04:00
|
|
|
|
2013-01-23 23:37:17 +04:00
|
|
|
void Enter();
|
|
|
|
void Exit();
|
2011-08-08 19:14:34 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsPresContext* mPresContext;
|
|
|
|
nsLayoutPhase mPhase;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mCount;
|
2011-08-08 19:14:34 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
# define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \
|
|
|
|
nsAutoLayoutPhase autoLayoutPhase((pc_), (eLayoutPhase_##phase_))
|
|
|
|
# define LAYOUT_PHASE_TEMP_EXIT() \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
autoLayoutPhase.Exit(); \
|
|
|
|
PR_END_MACRO
|
|
|
|
# define LAYOUT_PHASE_TEMP_REENTER() \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
autoLayoutPhase.Enter(); \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
2013-01-23 23:37:17 +04:00
|
|
|
#else // DEBUG
|
2011-08-08 19:14:34 +04:00
|
|
|
|
|
|
|
# define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
# define LAYOUT_PHASE_TEMP_EXIT() PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
# define LAYOUT_PHASE_TEMP_REENTER() PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
|
2013-01-23 23:37:17 +04:00
|
|
|
#endif // DEBUG
|
2011-08-08 19:14:34 +04:00
|
|
|
|
|
|
|
#endif // nsAutoLayoutPhase_h
|