Bug 1468402 - Part 3: Add test for subgrids in the grid list. r=pbro
[gecko.git] / layout / base / LayoutLogging.h
blob72335ff3eb9e423be52bdb850c793e7d0cd627d5
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 LayoutLogging_h
8 #define LayoutLogging_h
10 #include "mozilla/Logging.h"
12 /**
13 * Retrieves the log module to use for layout logging.
15 static mozilla::LazyLogModule sLayoutLog("layout");
17 /**
18 * Use the layout log to warn if a given condition is false.
20 * This is only enabled in debug builds and the logging is only displayed if
21 * the environmental variable MOZ_LOG includes "layout:2" (or higher).
23 #ifdef DEBUG
24 # define LAYOUT_WARN_IF_FALSE(_cond, _msg) \
25 PR_BEGIN_MACRO \
26 if (MOZ_LOG_TEST(sLayoutLog, mozilla::LogLevel::Warning) && !(_cond)) { \
27 mozilla::detail::LayoutLogWarning(_msg, #_cond, __FILE__, __LINE__); \
28 } \
29 PR_END_MACRO
30 #else
31 # define LAYOUT_WARN_IF_FALSE(_cond, _msg) \
32 PR_BEGIN_MACRO \
33 PR_END_MACRO
34 #endif
36 /**
37 * Use the layout log to emit a warning with the same format as NS_WARNING.
39 * This is only enabled in debug builds and the logging is only displayed if
40 * the environmental variable MOZ_LOG includes "layout:2" (or higher).
42 #ifdef DEBUG
43 # define LAYOUT_WARNING(_msg) \
44 PR_BEGIN_MACRO \
45 if (MOZ_LOG_TEST(sLayoutLog, mozilla::LogLevel::Warning)) { \
46 mozilla::detail::LayoutLogWarning(_msg, nullptr, __FILE__, __LINE__); \
47 } \
48 PR_END_MACRO
49 #else
50 # define LAYOUT_WARNING(_msg) \
51 PR_BEGIN_MACRO \
52 PR_END_MACRO
53 #endif
55 namespace mozilla {
56 namespace detail {
58 void LayoutLogWarning(const char* aStr, const char* aExpr, const char* aFile,
59 int32_t aLine);
61 } // namespace detail
62 } // namespace mozilla
64 #endif // LayoutLogging_h