tor-browser

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

FontFaceSet.webidl (2454B)


      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 * http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-interface
      8 *
      9 * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C
     10 * liability, trademark and document use rules apply.
     11 */
     12 
     13 // To implement FontFaceSet's iterator until we can use setlike.
     14 dictionary FontFaceSetIteratorResult
     15 {
     16  required any value;
     17  required boolean done;
     18 };
     19 
     20 // To implement FontFaceSet's iterator until we can use setlike.
     21 [LegacyNoInterfaceObject,
     22 Exposed=(Window,Worker)]
     23 interface FontFaceSetIterator {
     24  [Throws] FontFaceSetIteratorResult next();
     25 };
     26 
     27 callback FontFaceSetForEachCallback = undefined (FontFace value, FontFace key, FontFaceSet set);
     28 
     29 enum FontFaceSetLoadStatus { "loading", "loaded" };
     30 
     31 [Exposed=(Window,Worker)]
     32 interface FontFaceSet : EventTarget {
     33  // Bug 1072762 is for the FontFaceSet constructor.
     34  // constructor(sequence<FontFace> initialFaces);
     35 
     36  // Emulate setlike behavior until we can use that directly.
     37  readonly attribute unsigned long size;
     38  [Throws] undefined add(FontFace font);
     39  boolean has(FontFace font);
     40  boolean delete(FontFace font);
     41  undefined clear();
     42  [NewObject] FontFaceSetIterator entries();
     43  // Iterator keys();
     44  [NewObject, Alias=keys, Alias="@@iterator"] FontFaceSetIterator values();
     45  [Throws] undefined forEach(FontFaceSetForEachCallback cb, optional any thisArg);
     46 
     47  // -- events for when loading state changes
     48  attribute EventHandler onloading;
     49  attribute EventHandler onloadingdone;
     50  attribute EventHandler onloadingerror;
     51 
     52  // check and start loads if appropriate
     53  // and fulfill promise when all loads complete
     54  [NewObject] Promise<sequence<FontFace>> load(UTF8String font, optional DOMString text = " ");
     55 
     56  // return whether all fonts in the fontlist are loaded
     57  // (does not initiate load if not available)
     58  [Throws] boolean check(UTF8String font, optional DOMString text = " ");
     59 
     60  // async notification that font loading and layout operations are done
     61  [Throws] readonly attribute Promise<undefined> ready;
     62 
     63  // loading state, "loading" while one or more fonts loading, "loaded" otherwise
     64  readonly attribute FontFaceSetLoadStatus status;
     65 };