Flex.webidl (2951B)
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 /** 8 * These objects support visualization of flex containers by the 9 * dev tools. 10 */ 11 12 /** 13 * A flex container's main and cross axes are either horizontal or 14 * vertical, each with two possible directions. 15 */ 16 enum FlexPhysicalDirection { 17 "horizontal-lr", 18 "horizontal-rl", 19 "vertical-tb", 20 "vertical-bt", 21 }; 22 23 [ChromeOnly, Exposed=Window] 24 interface Flex 25 { 26 sequence<FlexLineValues> getLines(); 27 28 /** 29 * The physical direction in which successive flex items are placed, 30 * within a flex line in this flex container. 31 */ 32 readonly attribute FlexPhysicalDirection mainAxisDirection; 33 34 /** 35 * The physical direction in which successive flex lines are placed 36 * in this flex container (if it is or were multi-line). 37 */ 38 readonly attribute FlexPhysicalDirection crossAxisDirection; 39 }; 40 41 /** 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. 51 */ 52 enum FlexLineGrowthState { "shrinking", "growing" }; 53 54 [ChromeOnly, Exposed=Window] 55 interface FlexLineValues 56 { 57 readonly attribute FlexLineGrowthState growthState; 58 readonly attribute double crossStart; 59 readonly attribute double crossSize; 60 61 // firstBaselineOffset measures from flex-start edge. 62 readonly attribute double firstBaselineOffset; 63 64 // lastBaselineOffset measures from flex-end edge. 65 readonly attribute double lastBaselineOffset; 66 67 /** 68 * getItems() returns FlexItemValues only for the Elements in 69 * this Flex container -- ignoring struts and abs-pos Elements. 70 */ 71 sequence<FlexItemValues> getItems(); 72 }; 73 74 /** 75 * Item main sizes have either been unclamped, clamped to the minimum, 76 * or clamped to the maximum. 77 */ 78 enum FlexItemClampState { 79 "unclamped", "clamped_to_min", "clamped_to_max" 80 }; 81 82 [ChromeOnly, Exposed=Window] 83 interface FlexItemValues 84 { 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; 94 };