michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsAutoLayoutPhase_h michael@0: #define nsAutoLayoutPhase_h michael@0: michael@0: #ifdef DEBUG michael@0: michael@0: // We can't forward declare an enum before C++11 which means we have to include michael@0: // nsPresContext.h just because nsLayoutPhase is passed to the ctor. michael@0: #include "nsPresContext.h" michael@0: michael@0: struct nsAutoLayoutPhase { michael@0: nsAutoLayoutPhase(nsPresContext* aPresContext, nsLayoutPhase aPhase); michael@0: ~nsAutoLayoutPhase(); michael@0: michael@0: void Enter(); michael@0: void Exit(); michael@0: michael@0: private: michael@0: nsPresContext* mPresContext; michael@0: nsLayoutPhase mPhase; michael@0: uint32_t mCount; michael@0: }; michael@0: michael@0: #define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \ michael@0: nsAutoLayoutPhase autoLayoutPhase((pc_), (eLayoutPhase_##phase_)) michael@0: #define LAYOUT_PHASE_TEMP_EXIT() \ michael@0: PR_BEGIN_MACRO \ michael@0: autoLayoutPhase.Exit(); \ michael@0: PR_END_MACRO michael@0: #define LAYOUT_PHASE_TEMP_REENTER() \ michael@0: PR_BEGIN_MACRO \ michael@0: autoLayoutPhase.Enter(); \ michael@0: PR_END_MACRO michael@0: michael@0: #else // DEBUG michael@0: michael@0: #define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \ michael@0: PR_BEGIN_MACRO PR_END_MACRO michael@0: #define LAYOUT_PHASE_TEMP_EXIT() \ michael@0: PR_BEGIN_MACRO PR_END_MACRO michael@0: #define LAYOUT_PHASE_TEMP_REENTER() \ michael@0: PR_BEGIN_MACRO PR_END_MACRO michael@0: michael@0: #endif // DEBUG michael@0: michael@0: #endif // nsAutoLayoutPhase_h