summaryrefslogtreecommitdiffstats
path: root/layout/style/nsICSSUnprefixingService.idl
blob: 11c3bf43f18a5de781b839c2d63818e2fee7d0c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* interface for a service that converts certain vendor-prefixed CSS properties
   to their unprefixed equivalents */

#include "nsISupports.idl"

[scriptable, uuid(a5d6e2f4-d3ec-11e4-b002-782bcbaebb28)]
interface nsICSSUnprefixingService : nsISupports
{
  /**
   * This function helps to convert unsupported vendor-prefixed CSS into
   * supported unprefixed CSS. Given a vendor-prefixed property name and a
   * value (or e.g. value + trailing junk like " !important;}"), this function
   * will attempt to produce an equivalent CSS declaration that uses a
   * supported unprefixed CSS property.
   *
   * @param   aPropName
   *          The vendor-prefixed property name.
   *
   * @param   aRightHalfOfDecl
   *          Everything after the ":" in the CSS declaration. This includes
   *          the property's value, along with possibly some leading whitespace
   *          and trailing text like "!important", and possibly a ';' and/or
   *          '}' (along with any other bogus text the author happens to
   *          include before those, which will probably make the decl invalid).
   *
   * @param   aUnprefixedDecl[out]
   *          The resulting unprefixed declaration, if we return true.
   *
   * @return true if we were able to unprefix -- i.e. if we were able to
   *         convert the property to a known unprefixed equivalent, and we also
   *         performed any known-to-be-necessary fixup on the value, and we put
   *         the result in aUnprefixedDecl.
   *         Otherwise, this function returns false.
   */
  boolean generateUnprefixedDeclaration(in AString aPropName,
                                        in AString aRightHalfOfDecl,
                                        out AString aUnprefixedDecl);

  /**
   * @param   aPrefixedFuncName
   *          The webkit-prefixed gradient function: either
   *          "-webkit-gradient", "-webkit-linear-gradient", or
   *          "-webkit-radial-gradient".
   *
   * @param   aPrefixedFuncBody
   *          The body of the gradient function, inside (& not including) the
   *          parenthesis.
   *
   * @param   aUnprefixedFuncName[out]
   *          The resulting unprefixed gradient function name:
   *          either "linear-gradient" or "radial-gradient".
   *
   * @param   aUnprefixedFuncBody[out]
   *          The resulting unprefixed gradient function body, suitable for
   *          including in a "linear-gradient(...)" or "radial-gradient(...)"
   *          expression.
   *
   * @returns true if we were able to successfully parse aWebkitGradientStr
   *          and populate the outparams accordingly; false otherwise.
   *
   */
  boolean generateUnprefixedGradientValue(in AString aPrefixedFuncName,
                                          in AString aPrefixedFuncBody,
                                          out AString aUnprefixedFuncName,
                                          out AString aUnprefixedFuncBody);
};

%{C++
#define NS_CSSUNPREFIXINGSERVICE_CONTRACTID \
    "@mozilla.org/css-unprefixing-service;1"
%}