Bug 1856663 - Add more chunks for Android mochitest-plain. r=jmaher,taskgraph-reviewe...
[gecko.git] / layout / base / Baseline.h
blobfcb85d87b4db7fa57726015f0326f1e172c9ecaa
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);
65 /**
66 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
67 * content-box.
69 * An alphabetical baseline is at the end edge of aFrame's content-box with
70 * respect to aWM's block-axis, and a central baseline is halfway between the
71 * start and end edges. (aWM tells which baseline to use.)
72 * https://drafts.csswg.org/css-align-3/#synthesize-baseline
74 * @note This works only when aFrame's writing-mode is parallel to aWM.
75 * @param aWM the writing-mode of the alignment context.
76 * @return an offset from aFrame's border-box start(end) edge in aWM's
77 * block-axis for a first(last) baseline, respectively.
79 static nscoord SynthesizeBOffsetFromContentBox(const nsIFrame* aFrame,
80 WritingMode aWM,
81 BaselineSharingGroup);
84 } // namespace mozilla
86 #endif // LAYOUT_BASE_BASELINE_H_