Bug 1869043 allow a device to be specified with MediaTrackGraph::NotifyWhenDeviceStar...
[gecko.git] / layout / base / Baseline.h
blob384ed0d591213cfd7b1f1818bc7d418f68b17e3b
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef LAYOUT_BASE_BASELINE_H_
6 #define LAYOUT_BASE_BASELINE_H_
8 #include "nsCoord.h"
9 #include "mozilla/WritingModes.h"
11 class nsIFrame;
13 namespace mozilla {
15 // https://drafts.csswg.org/css-align-3/#baseline-sharing-group
16 enum class BaselineSharingGroup : uint8_t {
17 // NOTE Used as an array index so must be 0 and 1.
18 First = 0,
19 Last = 1,
22 // Layout context under which the baseline is being exported to.
23 enum class BaselineExportContext : uint8_t {
24 LineLayout = 0,
25 Other = 1,
28 class Baseline {
29 public:
30 /**
31 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
32 * margin-box.
34 * An alphabetical baseline is at the end edge of aFrame's margin-box with
35 * respect to aWM's block-axis, and a central baseline is halfway between the
36 * start and end edges. (aWM tells which baseline to use.)
37 * https://drafts.csswg.org/css-align-3/#synthesize-baseline
39 * @note This works only when aFrame's writing-mode is parallel to aWM.
40 * @param aWM the writing-mode of the alignment context.
41 * @return an offset from aFrame's border-box start(end) edge in aWM's
42 * block-axis for a first(last) baseline, respectively.
44 static nscoord SynthesizeBOffsetFromMarginBox(const nsIFrame* aFrame,
45 WritingMode aWM,
46 BaselineSharingGroup);
48 /**
49 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
50 * border-box.
52 * An alphabetical baseline is at the end edge of aFrame's border-box with
53 * respect to aWM's block-axis, and a central baseline is halfway between the
54 * start and end edges. (aWM tells which baseline to use.)
55 * https://drafts.csswg.org/css-align-3/#synthesize-baseline
57 * @param aWM the writing-mode of the alignment context.
58 * @return an offset from aFrame's border-box start(end) edge in aWM's
59 * block-axis for a first(last) baseline, respectively.
61 static nscoord SynthesizeBOffsetFromBorderBox(const nsIFrame* aFrame,
62 WritingMode aWM,
63 BaselineSharingGroup);
64 /**
65 * As above, but using the content box.
67 static nscoord SynthesizeBOffsetFromContentBox(const nsIFrame*, WritingMode,
68 BaselineSharingGroup);
69 /**
70 * As above, but using the padding box.
72 static nscoord SynthesizeBOffsetFromPaddingBox(const nsIFrame*, WritingMode,
73 BaselineSharingGroup);
76 } // namespace mozilla
78 #endif // LAYOUT_BASE_BASELINE_H_