2023-08-17 09:47:40 +00:00
|
|
|
let Declaration = require('../declaration')
|
2022-01-21 08:28:41 +00:00
|
|
|
|
2023-08-17 09:47:40 +00:00
|
|
|
class ImageRendering extends Declaration {
|
|
|
|
/**
|
|
|
|
* Add hack only for crisp-edges
|
|
|
|
*/
|
|
|
|
check(decl) {
|
|
|
|
return decl.value === 'pixelated'
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-08-17 09:47:40 +00:00
|
|
|
* Return property name by spec
|
2022-01-21 08:28:41 +00:00
|
|
|
*/
|
2023-08-17 09:47:40 +00:00
|
|
|
normalize() {
|
|
|
|
return 'image-rendering'
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
2023-08-17 09:47:40 +00:00
|
|
|
|
2022-01-21 08:28:41 +00:00
|
|
|
/**
|
|
|
|
* Change property name for IE
|
|
|
|
*/
|
2023-08-17 09:47:40 +00:00
|
|
|
prefixed(prop, prefix) {
|
2022-01-21 08:28:41 +00:00
|
|
|
if (prefix === '-ms-') {
|
2023-08-17 09:47:40 +00:00
|
|
|
return '-ms-interpolation-mode'
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
2023-08-17 09:47:40 +00:00
|
|
|
return super.prefixed(prop, prefix)
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-08-17 09:47:40 +00:00
|
|
|
* Warn on old value
|
2022-01-21 08:28:41 +00:00
|
|
|
*/
|
2023-08-17 09:47:40 +00:00
|
|
|
process(node, result) {
|
|
|
|
return super.process(node, result)
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
2023-08-17 09:47:40 +00:00
|
|
|
|
2022-01-21 08:28:41 +00:00
|
|
|
/**
|
2023-08-17 09:47:40 +00:00
|
|
|
* Change property and value for IE
|
2022-01-21 08:28:41 +00:00
|
|
|
*/
|
2023-08-17 09:47:40 +00:00
|
|
|
set(decl, prefix) {
|
|
|
|
if (prefix !== '-ms-') return super.set(decl, prefix)
|
|
|
|
decl.prop = '-ms-interpolation-mode'
|
|
|
|
decl.value = 'nearest-neighbor'
|
|
|
|
return decl
|
|
|
|
}
|
|
|
|
}
|
2022-01-21 08:28:41 +00:00
|
|
|
|
2023-08-17 09:47:40 +00:00
|
|
|
ImageRendering.names = ['image-rendering', 'interpolation-mode']
|
2022-01-21 08:28:41 +00:00
|
|
|
|
2023-08-17 09:47:40 +00:00
|
|
|
module.exports = ImageRendering
|