diff --git a/AppKit/CoreAnimation/CABackingStore.j b/AppKit/CoreAnimation/CABackingStore.j index 847430f62..068e9205a 100644 --- a/AppKit/CoreAnimation/CABackingStore.j +++ b/AppKit/CoreAnimation/CABackingStore.j @@ -21,54 +21,38 @@ */ @import "CGGeometry.j" -@import "CPCompatibility.j" - -#define PIXEL(pixels) pixels + "px"; +// REMOVED: @import "CPCompatibility.j" - Obsolete legacy compatibility layer removed. +// REMOVED: #define PIXEL(pixels) macro - Eliminated in favour of native inline string concatenation. function CABackingStoreGetContext(aBackingStore) { - return aBackingStore.context; -}; - -if (CPFeatureIsCompatible(CPHTMLCanvasFeature)) -{ - -CABackingStoreCreate = function() -{ - var DOMElement = document.createElement("canvas"); - - DOMElement.style.position = "absolute"; - - // FIXME: Consolidate drawImage to support this. - return { context:DOMElement.getContext("2d"), buffer:DOMElement, _image:DOMElement }; -}; - -CABackingStoreSetSize = function(aBackingStore, aSize) -{ - var buffer = aBackingStore.buffer; - - buffer.width = aSize.width; - buffer.height = aSize.height; - buffer.style.width = PIXEL(aSize.width); - buffer.style.height = PIXEL(aSize.height); -}; - + return aBackingStore.context; } -else + +// REMOVED: if (CPFeatureIsCompatible(CPHTMLCanvasFeature)) - HTMLCanvasElement is natively supported across modern targets. Legacy fallback block completely removed. +function CABackingStoreCreate() { + // MODERNIZED: Replaced legacy 'var' with block-scoped 'const' for immutable DOM reference. + const DOMElement = document.createElement("canvas"); -CABackingStoreCreate = function() -{ - var context = CGBitmapGraphicsContextCreate(); - - context.buffer = ""; - - return { context:context }; -}; - -CABackingStoreSetSize = function(aBackingStore, aSize) -{ -}; + DOMElement.style.position = "absolute"; + // FIXME: Consolidate drawImage to support this. + return { context:DOMElement.getContext("2d"), buffer:DOMElement, _image:DOMElement }; } + +function CABackingStoreSetSize(aBackingStore, aSize) +{ + // MODERNIZED: Replaced legacy 'var' with block-scoped 'const'. + const buffer = aBackingStore.buffer; + + buffer.width = aSize.width; + buffer.height = aSize.height; + + // MODERNIZED: Replaced macro expansion with native inline evaluation. + buffer.style.width = aSize.width + "px"; + buffer.style.height = aSize.height + "px"; +} + +// REMOVED: Legacy else block utilizing CGBitmapGraphicsContextCreate due to guaranteed canvas support.