summaryrefslogtreecommitdiffstats
path: root/dom/webidl/Grid.webidl
blob: b10de93832db82fc97b4f7da40a09e08e9336e7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 */

/* These objects support visualization of a css-grid by the dev tools. */

/**
 * Explicit and implicit types apply to tracks, lines, and areas.
 * https://drafts.csswg.org/css-grid/#explicit-grids
 * https://drafts.csswg.org/css-grid/#implicit-grids
 */
enum GridDeclaration { "explicit", "implicit" };

/**
 * Tracks expanded from auto-fill are repeat , auto-fits with elements are
 * also repeat, auto-fits with no elements are removed, other tracks are static.
 */
enum GridTrackState { "static", "repeat", "removed" };

[ChromeOnly]
interface Grid
{
  readonly attribute GridDimension rows;
  readonly attribute GridDimension cols;
  [Cached, Constant]
  readonly attribute sequence<GridArea> areas;
};

[ChromeOnly]
interface GridDimension
{
  readonly attribute GridLines lines;
  readonly attribute GridTracks tracks;
};

[ChromeOnly]
interface GridLines
{
  readonly attribute unsigned long length;

  /**
   * This accessor method allows array-like access to lines.
   * @param index A 0-indexed value.
   */
  getter GridLine? item(unsigned long index);
};

[ChromeOnly]
interface GridLine
{
  /**
   * Names include both explicit names and implicit names, which will be
   * assigned if the line contributes to a named area.
   * https://drafts.csswg.org/css-grid/#implicit-named-lines
   */
  [Cached, Constant]
  readonly attribute sequence<DOMString> names;

  readonly attribute double start;

  /**
   * Breadth is the gap between the start of this line and the start of the
   * next track in flow direction. It primarily is set by use of the -gap
   * properties.
   * https://drafts.csswg.org/css-grid/#gutters
   */
  readonly attribute double breadth;

  readonly attribute GridDeclaration type;

  /**
   * Number is the 1-indexed index of the line in flow order.
   */
  readonly attribute unsigned long number;
};

[ChromeOnly]
interface GridTracks
{
  readonly attribute unsigned long length;

  /**
   * This accessor method allows array-like access to tracks.
   * @param index A 0-indexed value.
   */
  getter GridTrack? item(unsigned long index);
};

[ChromeOnly]
interface GridTrack
{
  readonly attribute double start;
  readonly attribute double breadth;
  readonly attribute GridDeclaration type;
  readonly attribute GridTrackState state;
};

[ChromeOnly]
interface GridArea
{
  readonly attribute DOMString name;
  readonly attribute GridDeclaration type;

  /**
   * These values are 1-indexed line numbers bounding the area.
   */
  readonly attribute unsigned long rowStart;
  readonly attribute unsigned long rowEnd;
  readonly attribute unsigned long columnStart;
  readonly attribute unsigned long columnEnd;
};