Bug 1568157 - Part 5: Move the NodePicker initialization into a getter. r=yulia
[gecko.git] / layout / generic / CSSAlignUtils.h
blobcf188f4cf9c78f1b82fbcfd89a5adfc33cf273ad
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 /* Utility code for performing CSS Box Alignment */
9 #ifndef mozilla_CSSAlignUtils_h
10 #define mozilla_CSSAlignUtils_h
12 #include "mozilla/WritingModes.h"
14 namespace mozilla {
16 struct ReflowInput;
18 class CSSAlignUtils {
19 public:
20 /**
21 * Flags to customize the behavior of AlignJustifySelf:
23 enum class AlignJustifyFlags {
24 NoFlags = 0,
25 // Indicates that we have <overflow-position> = safe.
26 OverflowSafe = 1 << 0,
27 // Indicates that the container's start side in aAxis is the same
28 // as the child's start side in the child's parallel axis.
29 SameSide = 1 << 1,
30 // Indicates that AlignJustifySelf() shouldn't expand "auto" margins.
31 // (By default, AlignJustifySelf() *will* expand such margins, to fill the
32 // available space before any alignment is done.)
33 IgnoreAutoMargins = 1 << 2,
36 /**
37 * This computes the aligned offset of a CSS-aligned child within its
38 * alignment container. The returned offset is distance between the
39 * logical "start" edge of the alignment container & the logical "start" edge
40 * of the aligned child (in terms of the alignment container's writing mode).
42 * @param aAlignment An enumerated value representing a keyword for
43 * "align-self" or "justify-self". The values
44 * NS_STYLE_ALIGN_{AUTO,LEFT,RIGHT} must *not* be
45 * passed here; this method expects the caller to have
46 * already resolved those to 'start', 'end', or 'stretch'.
47 * @param aAxis The container's axis in which we're doing alignment.
48 * @param aBaselineAdjust The amount to offset baseline-aligned children.
49 * @param aCBSize The size of the alignment container, in its aAxis.
50 * @param aRI A ReflowInput for the child.
51 * @param aChildSize The child's LogicalSize (in its own writing mode).
53 static nscoord AlignJustifySelf(uint8_t aAlignment, LogicalAxis aAxis,
54 AlignJustifyFlags aFlags,
55 nscoord aBaselineAdjust, nscoord aCBSize,
56 const ReflowInput& aRI,
57 const LogicalSize& aChildSize);
60 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSAlignUtils::AlignJustifyFlags)
62 } // namespace mozilla
64 #endif // mozilla_CSSAlignUtils_h