style-types.js (1874B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 const { RetVal, types } = require("resource://devtools/shared/protocol.js"); 7 8 // Predeclare the domstylerule actor type 9 types.addActorType("domstylerule"); 10 11 /** 12 * When asking for the styles applied to a node, we return a list of 13 * appliedstyle json objects that lists the rules that apply to the node 14 * and which element they were inherited from (if any). 15 */ 16 types.addDictType("appliedstyle", { 17 rule: "domstylerule", 18 inherited: "nullable:domnode#actorid", 19 keyframes: "nullable:domstylerule", 20 }); 21 22 types.addDictType("matchedselector", { 23 rule: "domstylerule#actorid", 24 selector: "string", 25 value: "string", 26 status: "number", 27 }); 28 29 types.addDictType("appliedStylesReturn", { 30 entries: "array:appliedstyle", 31 }); 32 33 types.addDictType("modifiedStylesReturn", { 34 isMatching: RetVal("boolean"), 35 ruleProps: RetVal("nullable:appliedStylesReturn"), 36 }); 37 38 types.addDictType("fontpreview", { 39 data: "nullable:longstring", 40 size: "json", 41 }); 42 43 types.addDictType("fontvariationaxis", { 44 tag: "string", 45 name: "string", 46 minValue: "number", 47 maxValue: "number", 48 defaultValue: "number", 49 }); 50 51 types.addDictType("fontvariationinstancevalue", { 52 axis: "string", 53 value: "number", 54 }); 55 56 types.addDictType("fontvariationinstance", { 57 name: "string", 58 values: "array:fontvariationinstancevalue", 59 }); 60 61 types.addDictType("fontface", { 62 name: "string", 63 CSSFamilyName: "string", 64 rule: "nullable:domstylerule", 65 srcIndex: "number", 66 URI: "string", 67 format: "string", 68 preview: "nullable:fontpreview", 69 localName: "string", 70 metadata: "string", 71 variationAxes: "array:fontvariationaxis", 72 variationInstances: "array:fontvariationinstance", 73 });