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/.
5 */
6
7/* These objects support visualization of a css-grid by the dev tools. */
8
9/**
10 * Explicit and implicit types apply to tracks, lines, and areas.
11 * https://drafts.csswg.org/css-grid/#explicit-grids
12 * https://drafts.csswg.org/css-grid/#implicit-grids
13 */
14enum GridDeclaration { "explicit", "implicit" };
15
16/**
17 * Tracks expanded from auto-fill are repeat , auto-fits with elements are
18 * also repeat, auto-fits with no elements are removed, other tracks are static.
19 */
20enum GridTrackState { "static", "repeat", "removed" };
21
22[ChromeOnly]
23interface Grid
24{
25  readonly attribute GridDimension rows;
26  readonly attribute GridDimension cols;
27  [Cached, Constant]
28  readonly attribute sequence<GridArea> areas;
29};
30
31[ChromeOnly]
32interface GridDimension
33{
34  readonly attribute GridLines lines;
35  readonly attribute GridTracks tracks;
36};
37
38[ChromeOnly]
39interface GridLines
40{
41  readonly attribute unsigned long length;
42
43  /**
44   * This accessor method allows array-like access to lines.
45   * @param index A 0-indexed value.
46   */
47  getter GridLine? item(unsigned long index);
48};
49
50[ChromeOnly]
51interface GridLine
52{
53  /**
54   * Names include both explicit names and implicit names, which will be
55   * assigned if the line contributes to a named area.
56   * https://drafts.csswg.org/css-grid/#implicit-named-lines
57   */
58  [Cached, Constant]
59  readonly attribute sequence<DOMString> names;
60
61  readonly attribute double start;
62
63  /**
64   * Breadth is the gap between the start of this line and the start of the
65   * next track in flow direction. It primarily is set by use of the -gap
66   * properties.
67   * https://drafts.csswg.org/css-grid/#gutters
68   */
69  readonly attribute double breadth;
70
71  readonly attribute GridDeclaration type;
72
73  /**
74   * Number is the 1-indexed index of the line in flow order. The
75   * first explicit line has number 1, and numbers increment by 1 for
76   * each line after that. Lines before the first explicit line
77   * have number 0, which is not a valid addressable line number, and
78   * should be filtered out by callers.
79   */
80  readonly attribute unsigned long number;
81
82  /**
83   * NegativeNumber is the 1-indexed index of the line in reverse
84   * flow order. The last explicit line has negativeNumber -1, and
85   * negativeNumbers decrement by 1 for each line before that.
86   * Lines after the last explicit line have negativeNumber 0, which
87   * is not a valid addressable line number, and should be filtered
88   * out by callers.
89   */
90  readonly attribute long negativeNumber;
91};
92
93[ChromeOnly]
94interface GridTracks
95{
96  readonly attribute unsigned long length;
97
98  /**
99   * This accessor method allows array-like access to tracks.
100   * @param index A 0-indexed value.
101   */
102  getter GridTrack? item(unsigned long index);
103};
104
105[ChromeOnly]
106interface GridTrack
107{
108  readonly attribute double start;
109  readonly attribute double breadth;
110  readonly attribute GridDeclaration type;
111  readonly attribute GridTrackState state;
112};
113
114[ChromeOnly]
115interface GridArea
116{
117  readonly attribute DOMString name;
118  readonly attribute GridDeclaration type;
119
120  /**
121   * These values are 1-indexed line numbers bounding the area.
122   */
123  readonly attribute unsigned long rowStart;
124  readonly attribute unsigned long rowEnd;
125  readonly attribute unsigned long columnStart;
126  readonly attribute unsigned long columnEnd;
127};
128