gecko-dev/layout/style/nsICSSUnprefixingService.idl

77 lines
3.3 KiB
Plaintext

/* -*- 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"
%}