1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * These objects support visualization of flex containers by the
13 * A flex container's main and cross axes are either horizontal or
14 * vertical, each with two possible directions.
16 enum FlexPhysicalDirection {
23 [ChromeOnly, Exposed=Window]
26 sequence<FlexLineValues> getLines();
29 * The physical direction in which successive flex items are placed,
30 * within a flex line in this flex container.
32 readonly attribute FlexPhysicalDirection mainAxisDirection;
35 * The physical direction in which successive flex lines are placed
36 * in this flex container (if it is or were multi-line).
38 readonly attribute FlexPhysicalDirection crossAxisDirection;
42 * This indicates which flex factor (flex-grow vs. flex-shrink) the
43 * flex layout algorithm uses internally when resolving flexible sizes
44 * in a given flex line, per flexbox spec section 9.7 step 1. Note that
45 * this value doesn't necessarily mean that any items on this line
46 * are *actually* growing (or shrinking). This simply indicates what
47 * the layout algorithm "wants" to do, based on the free space --
48 * and items will stretch from their flex base size in the corresponding
49 * direction, if permitted by their min/max constraints and their
50 * corresponding flex factor.
52 enum FlexLineGrowthState { "shrinking", "growing" };
54 [ChromeOnly, Exposed=Window]
55 interface FlexLineValues
57 readonly attribute FlexLineGrowthState growthState;
58 readonly attribute double crossStart;
59 readonly attribute double crossSize;
61 // firstBaselineOffset measures from flex-start edge.
62 readonly attribute double firstBaselineOffset;
64 // lastBaselineOffset measures from flex-end edge.
65 readonly attribute double lastBaselineOffset;
68 * getItems() returns FlexItemValues only for the Elements in
69 * this Flex container -- ignoring struts and abs-pos Elements.
71 sequence<FlexItemValues> getItems();
75 * Item main sizes have either been unclamped, clamped to the minimum,
76 * or clamped to the maximum.
78 enum FlexItemClampState {
79 "unclamped", "clamped_to_min", "clamped_to_max"
82 [ChromeOnly, Exposed=Window]
83 interface FlexItemValues
85 readonly attribute Node? node;
86 readonly attribute DOMRectReadOnly frameRect;
87 readonly attribute double mainBaseSize;
88 readonly attribute double mainDeltaSize;
89 readonly attribute double mainMinSize;
90 readonly attribute double mainMaxSize;
91 readonly attribute double crossMinSize;
92 readonly attribute double crossMaxSize;
93 readonly attribute FlexItemClampState clampState;