nsICSSUnprefixingService.idl 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* interface for a service that converts certain vendor-prefixed CSS properties
  6. to their unprefixed equivalents */
  7. #include "nsISupports.idl"
  8. [scriptable, uuid(a5d6e2f4-d3ec-11e4-b002-782bcbaebb28)]
  9. interface nsICSSUnprefixingService : nsISupports
  10. {
  11. /**
  12. * This function helps to convert unsupported vendor-prefixed CSS into
  13. * supported unprefixed CSS. Given a vendor-prefixed property name and a
  14. * value (or e.g. value + trailing junk like " !important;}"), this function
  15. * will attempt to produce an equivalent CSS declaration that uses a
  16. * supported unprefixed CSS property.
  17. *
  18. * @param aPropName
  19. * The vendor-prefixed property name.
  20. *
  21. * @param aRightHalfOfDecl
  22. * Everything after the ":" in the CSS declaration. This includes
  23. * the property's value, along with possibly some leading whitespace
  24. * and trailing text like "!important", and possibly a ';' and/or
  25. * '}' (along with any other bogus text the author happens to
  26. * include before those, which will probably make the decl invalid).
  27. *
  28. * @param aUnprefixedDecl[out]
  29. * The resulting unprefixed declaration, if we return true.
  30. *
  31. * @return true if we were able to unprefix -- i.e. if we were able to
  32. * convert the property to a known unprefixed equivalent, and we also
  33. * performed any known-to-be-necessary fixup on the value, and we put
  34. * the result in aUnprefixedDecl.
  35. * Otherwise, this function returns false.
  36. */
  37. boolean generateUnprefixedDeclaration(in AString aPropName,
  38. in AString aRightHalfOfDecl,
  39. out AString aUnprefixedDecl);
  40. /**
  41. * @param aPrefixedFuncName
  42. * The webkit-prefixed gradient function: either
  43. * "-webkit-gradient", "-webkit-linear-gradient", or
  44. * "-webkit-radial-gradient".
  45. *
  46. * @param aPrefixedFuncBody
  47. * The body of the gradient function, inside (& not including) the
  48. * parenthesis.
  49. *
  50. * @param aUnprefixedFuncName[out]
  51. * The resulting unprefixed gradient function name:
  52. * either "linear-gradient" or "radial-gradient".
  53. *
  54. * @param aUnprefixedFuncBody[out]
  55. * The resulting unprefixed gradient function body, suitable for
  56. * including in a "linear-gradient(...)" or "radial-gradient(...)"
  57. * expression.
  58. *
  59. * @returns true if we were able to successfully parse aWebkitGradientStr
  60. * and populate the outparams accordingly; false otherwise.
  61. *
  62. */
  63. boolean generateUnprefixedGradientValue(in AString aPrefixedFuncName,
  64. in AString aPrefixedFuncBody,
  65. out AString aUnprefixedFuncName,
  66. out AString aUnprefixedFuncBody);
  67. };
  68. %{C++
  69. #define NS_CSSUNPREFIXINGSERVICE_CONTRACTID \
  70. "@mozilla.org/css-unprefixing-service;1"
  71. %}