Source/core/frame/ImageBitmapTest.cpp
// Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image.
Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image.
Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image .
TEST_F(ImageBitmapTest, ImageResourceLifetime)
{
    RefPtrWillBeRawPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::create(*Document::create().get());
    canvasElement->setHeight(40);
    canvasElement->setWidth(40);
    RefPtrWillBeRawPtr<ImageBitmap> imageBitmapDerived = nullptr;
    {
        RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::create(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->height()));
        imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), IntRect(0, 0, 20, 20));
    }
    CanvasRenderingContext* context = canvasElement->getContext("2d");
    TrackExceptionState exceptionState;
    toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0, 0, exceptionState);
}
TEST_F ( ImageBitmapTest , ImageResourceLifetime ) { RefPtrWillBeRawPtr < HTMLCanvasElement > canvasElement = HTMLCanvasElement :: create ( * Document :: create ( ) . get ( ) ) ; canvasElement -> setHeight ( 40 ) ; canvasElement -> setWidth ( 40 ) ; RefPtrWillBeRawPtr < ImageBitmap > imageBitmapDerived = nullptr ; { RefPtrWillBeRawPtr < ImageBitmap > imageBitmapFromCanvas = ImageBitmap :: create ( canvasElement . get ( ) , IntRect ( 0 , 0 , canvasElement -> width ( ) , canvasElement -> height ( ) ) ) ; imageBitmapDerived = ImageBitmap :: create ( imageBitmapFromCanvas . get ( ) , IntRect ( 0 , 0 , 20 , 20 ) ) ; } CanvasRenderingContext * context = canvasElement -> getContext ( " " ) ; TrackExceptionState exceptionState ; toCanvasRenderingContext2D ( context ) -> drawImage ( imageBitmapDerived . get ( ) , 0 , 0 , exceptionState ) ; }
Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image.
Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image .