tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

page-style.js (3323B)


      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 {
      7  Arg,
      8  Option,
      9  RetVal,
     10  generateActorSpec,
     11  types,
     12 } = require("resource://devtools/shared/protocol.js");
     13 
     14 // Load the shared types for style actors
     15 require("resource://devtools/shared/specs/style/style-types.js");
     16 
     17 const pageStyleSpec = generateActorSpec({
     18  typeName: "pagestyle",
     19 
     20  events: {
     21    "stylesheet-updated": {
     22      type: "styleSheetUpdated",
     23    },
     24  },
     25 
     26  methods: {
     27    getComputed: {
     28      request: {
     29        node: Arg(0, "domnode"),
     30        markMatched: Option(1, "boolean"),
     31        onlyMatched: Option(1, "boolean"),
     32        clearCache: Option(1, "boolean"),
     33        filter: Option(1, "string"),
     34        filterProperties: Option(1, "nullable:array:string"),
     35      },
     36      response: {
     37        computed: RetVal("json"),
     38      },
     39    },
     40    getAllUsedFontFaces: {
     41      request: {
     42        includePreviews: Option(0, "boolean"),
     43        includeVariations: Option(1, "boolean"),
     44        previewText: Option(0, "string"),
     45        previewFontSize: Option(0, "string"),
     46        previewFillStyle: Option(0, "string"),
     47      },
     48      response: {
     49        fontFaces: RetVal("array:fontface"),
     50      },
     51    },
     52    getUsedFontFaces: {
     53      request: {
     54        node: Arg(0, "domnode"),
     55        includePreviews: Option(1, "boolean"),
     56        includeVariations: Option(1, "boolean"),
     57        previewText: Option(1, "string"),
     58        previewFontSize: Option(1, "string"),
     59        previewFillStyle: Option(1, "string"),
     60      },
     61      response: {
     62        fontFaces: RetVal("array:fontface"),
     63      },
     64    },
     65    getMatchedSelectors: {
     66      request: {
     67        node: Arg(0, "domnode"),
     68        property: Arg(1, "string"),
     69        filter: Option(2, "string"),
     70      },
     71      response: RetVal(
     72        types.addDictType("matchedselectorresponse", {
     73          rules: "array:domstylerule",
     74          matched: "array:matchedselector",
     75        })
     76      ),
     77    },
     78    getRule: {
     79      request: {
     80        ruleId: Arg(0, "string"),
     81      },
     82      response: {
     83        rule: RetVal("nullable:domstylerule"),
     84      },
     85    },
     86    getApplied: {
     87      request: {
     88        node: Arg(0, "domnode"),
     89        inherited: Option(1, "boolean"),
     90        matchedSelectors: Option(1, "boolean"),
     91        skipPseudo: Option(1, "boolean"),
     92        filter: Option(1, "string"),
     93      },
     94      response: RetVal("appliedStylesReturn"),
     95    },
     96    isPositionEditable: {
     97      request: { node: Arg(0, "domnode") },
     98      response: { value: RetVal("boolean") },
     99    },
    100    getLayout: {
    101      request: {
    102        node: Arg(0, "domnode"),
    103        autoMargins: Option(1, "boolean"),
    104      },
    105      response: RetVal("json"),
    106    },
    107    addNewRule: {
    108      request: {
    109        node: Arg(0, "domnode"),
    110        pseudoClasses: Arg(1, "nullable:array:string"),
    111      },
    112      response: RetVal("appliedStylesReturn"),
    113    },
    114    getAttributesInOwnerDocument: {
    115      request: {
    116        search: Arg(0, "string"),
    117        attributeType: Arg(1, "string"),
    118        node: Arg(2, "nullable:domnode"),
    119      },
    120      response: {
    121        attributes: RetVal("array:string"),
    122      },
    123    },
    124  },
    125 });
    126 
    127 exports.pageStyleSpec = pageStyleSpec;