CSSNumericValue.webidl (1855B)
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 * The origin of this IDL file is 7 * https://drafts.css-houdini.org/css-typed-om-1/#numeric-objects 8 */ 9 10 // https://drafts.css-houdini.org/css-typed-om-1/#typedefdef-cssnumberish 11 typedef (double or CSSNumericValue) CSSNumberish; 12 13 // https://drafts.css-houdini.org/css-typed-om-1/#enumdef-cssnumericbasetype 14 enum CSSNumericBaseType { 15 "length", 16 "angle", 17 "time", 18 "frequency", 19 "resolution", 20 "flex", 21 "percent", 22 }; 23 24 // https://drafts.css-houdini.org/css-typed-om-1/#dictdef-cssnumerictype 25 dictionary CSSNumericType { 26 long length; 27 long angle; 28 long time; 29 long frequency; 30 long resolution; 31 long flex; 32 long percent; 33 CSSNumericBaseType percentHint; 34 }; 35 36 // https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue 37 // TODO: Expose to LayoutWorklet 38 [Exposed=(Window, Worker, PaintWorklet), Pref="layout.css.typed-om.enabled"] 39 interface CSSNumericValue : CSSStyleValue { 40 [NewObject, Throws] CSSNumericValue add(CSSNumberish... values); 41 [NewObject, Throws] CSSNumericValue sub(CSSNumberish... values); 42 [NewObject, Throws] CSSNumericValue mul(CSSNumberish... values); 43 [NewObject, Throws] CSSNumericValue div(CSSNumberish... values); 44 [NewObject, Throws] CSSNumericValue min(CSSNumberish... values); 45 [NewObject, Throws] CSSNumericValue max(CSSNumberish... values); 46 47 boolean equals(CSSNumberish... value); 48 49 [NewObject, Throws] CSSUnitValue to(UTF8String unit); 50 [NewObject, Throws] CSSMathSum toSum(UTF8String... units); 51 CSSNumericType type(); 52 53 [Exposed=Window, NewObject, Throws] static CSSNumericValue parse(UTF8String cssText); 54 };