no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / base / nsAutoLayoutPhase.h
blobcba7a644f95f3b229f2fa577335165c16f069d4f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsAutoLayoutPhase_h
8 #define nsAutoLayoutPhase_h
10 #ifdef DEBUG
12 # include <stdint.h>
14 enum class nsLayoutPhase : uint8_t;
15 class nsPresContext;
17 struct nsAutoLayoutPhase {
18 nsAutoLayoutPhase(nsPresContext* aPresContext, nsLayoutPhase aPhase);
19 ~nsAutoLayoutPhase();
21 void Enter();
22 void Exit();
24 private:
25 nsPresContext* mPresContext;
26 nsLayoutPhase mPhase;
27 uint32_t mCount;
30 # define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \
31 nsAutoLayoutPhase autoLayoutPhase((pc_), (nsLayoutPhase::phase_))
32 # define LAYOUT_PHASE_TEMP_EXIT() \
33 PR_BEGIN_MACRO \
34 autoLayoutPhase.Exit(); \
35 PR_END_MACRO
36 # define LAYOUT_PHASE_TEMP_REENTER() \
37 PR_BEGIN_MACRO \
38 autoLayoutPhase.Enter(); \
39 PR_END_MACRO
41 #else // DEBUG
43 # define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) PR_BEGIN_MACRO PR_END_MACRO
44 # define LAYOUT_PHASE_TEMP_EXIT() PR_BEGIN_MACRO PR_END_MACRO
45 # define LAYOUT_PHASE_TEMP_REENTER() PR_BEGIN_MACRO PR_END_MACRO
47 #endif // DEBUG
49 #endif // nsAutoLayoutPhase_h