pixelated.js 819 B

12345678910111213141516171819202122232425262728293031323334
  1. let OldValue = require('../old-value')
  2. let Value = require('../value')
  3. class Pixelated extends Value {
  4. /**
  5. * Use non-standard name for WebKit and Firefox
  6. */
  7. replace(string, prefix) {
  8. if (prefix === '-webkit-') {
  9. return string.replace(this.regexp(), '$1-webkit-optimize-contrast')
  10. }
  11. if (prefix === '-moz-') {
  12. return string.replace(this.regexp(), '$1-moz-crisp-edges')
  13. }
  14. return super.replace(string, prefix)
  15. }
  16. /**
  17. * Different name for WebKit and Firefox
  18. */
  19. old(prefix) {
  20. if (prefix === '-webkit-') {
  21. return new OldValue(this.name, '-webkit-optimize-contrast')
  22. }
  23. if (prefix === '-moz-') {
  24. return new OldValue(this.name, '-moz-crisp-edges')
  25. }
  26. return super.old(prefix)
  27. }
  28. }
  29. Pixelated.names = ['pixelated']
  30. module.exports = Pixelated