image-rendering.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. (function() {
  2. var Declaration, ImageRendering,
  3. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  4. hasProp = {}.hasOwnProperty;
  5. Declaration = require('../declaration');
  6. ImageRendering = (function(superClass) {
  7. extend(ImageRendering, superClass);
  8. function ImageRendering() {
  9. return ImageRendering.__super__.constructor.apply(this, arguments);
  10. }
  11. ImageRendering.names = ['image-rendering', 'interpolation-mode'];
  12. ImageRendering.prototype.check = function(decl) {
  13. return decl.value === 'pixelated';
  14. };
  15. ImageRendering.prototype.prefixed = function(prop, prefix) {
  16. if (prefix === '-ms-') {
  17. return '-ms-interpolation-mode';
  18. } else {
  19. return ImageRendering.__super__.prefixed.apply(this, arguments);
  20. }
  21. };
  22. ImageRendering.prototype.set = function(decl, prefix) {
  23. if (prefix === '-ms-') {
  24. decl.prop = '-ms-interpolation-mode';
  25. decl.value = 'nearest-neighbor';
  26. return decl;
  27. } else {
  28. return ImageRendering.__super__.set.apply(this, arguments);
  29. }
  30. };
  31. ImageRendering.prototype.normalize = function(prop) {
  32. return 'image-rendering';
  33. };
  34. ImageRendering.prototype.process = function(node, result) {
  35. return ImageRendering.__super__.process.apply(this, arguments);
  36. };
  37. return ImageRendering;
  38. })(Declaration);
  39. module.exports = ImageRendering;
  40. }).call(this);