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