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.
22 // Layout context under which the baseline is being exported to.
23 enum class BaselineExportContext
: uint8_t {
31 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
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
,
46 BaselineSharingGroup
);
49 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
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
,
63 BaselineSharingGroup
);
66 * Synthesize a first(last) inline-axis baseline in aWM based on aFrame's
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
,
81 BaselineSharingGroup
);
84 } // namespace mozilla
86 #endif // LAYOUT_BASE_BASELINE_H_