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_
9 #include "mozilla/WritingModes.h"
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.
25 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
28 * An alphabetical baseline is at the end edge of aFrame's margin-box with
29 * respect to aWM's block-axis, and a central baseline is halfway between the
30 * start and end edges. (aWM tells which baseline to use.)
31 * https://drafts.csswg.org/css-align-3/#synthesize-baseline
33 * @note This works only when aFrame's writing-mode is parallel to aWM.
34 * @param aWM the writing-mode of the alignment context.
35 * @return an offset from aFrame's border-box start(end) edge in aWM's
36 * block-axis for a first(last) baseline, respectively.
38 static nscoord
SynthesizeBOffsetFromMarginBox(const nsIFrame
* aFrame
,
40 BaselineSharingGroup
);
43 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
46 * An alphabetical baseline is at the end edge of aFrame's border-box with
47 * respect to aWM's block-axis, and a central baseline is halfway between the
48 * start and end edges. (aWM tells which baseline to use.)
49 * https://drafts.csswg.org/css-align-3/#synthesize-baseline
51 * @param aWM the writing-mode of the alignment context.
52 * @return an offset from aFrame's border-box start(end) edge in aWM's
53 * block-axis for a first(last) baseline, respectively.
55 static nscoord
SynthesizeBOffsetFromBorderBox(const nsIFrame
* aFrame
,
57 BaselineSharingGroup
);
60 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
63 * An alphabetical baseline is at the end edge of aFrame's content-box with
64 * respect to aWM's block-axis, and a central baseline is halfway between the
65 * start and end edges. (aWM tells which baseline to use.)
66 * https://drafts.csswg.org/css-align-3/#synthesize-baseline
68 * @note This works only when aFrame's writing-mode is parallel to aWM.
69 * @param aWM the writing-mode of the alignment context.
70 * @return an offset from aFrame's border-box start(end) edge in aWM's
71 * block-axis for a first(last) baseline, respectively.
73 static nscoord
SynthesizeBOffsetFromContentBox(const nsIFrame
* aFrame
,
75 BaselineSharingGroup
);
78 } // namespace mozilla
80 #endif // LAYOUT_BASE_BASELINE_H_