From 4bd1b3a8482171778b156540d530e08cc63787af Mon Sep 17 00:00:00 2001 From: kipp Date: Mon, 11 May 1998 22:57:05 +0000 Subject: [PATCH] Revised image loading API's --- layout/base/nsPresContext.h | 50 ++++++++++++----------------- layout/base/public/nsIPresContext.h | 50 ++++++++++++----------------- layout/base/public/nsPresContext.h | 50 ++++++++++++----------------- layout/base/src/nsPresContext.h | 9 +++--- 4 files changed, 67 insertions(+), 92 deletions(-) diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 447e6baf7b23..d27cc7b133b2 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -20,23 +20,20 @@ #include "nslayout.h" #include "nsISupports.h" -#include "nsIImageObserver.h" #include "nsRect.h" -class nsIImage; +struct nsFont; + +class nsIContent; +class nsIDeviceContext; +class nsIFontMetrics; +class nsIFrame; +class nsIFrameImageLoader; +class nsIImageGroup; class nsILinkHandler; class nsIPresShell; -class nsIRenderingContext; -class nsIFrame; class nsIStyleContext; -class nsIFontMetrics; -class nsIContent; -class nsViewManager; -class nsIView; -class nsIFontCache; -class nsIDeviceContext; class nsString; -struct nsFont; #define NS_IPRESCONTEXT_IID \ { 0x0a5d12e0, 0x944e, 0x11d1, \ @@ -75,27 +72,22 @@ public: */ virtual const nsFont& GetDefaultFont(void) = 0; + NS_IMETHOD GetImageGroup(nsIImageGroup*& aGroupResult) = 0; + /** - * Load an image for the given url name for the given frame. When - * the image is ready for rendering the frame will be repainted. - * - * If the image is ready then this method will return the image, - * otherwise it will return nsnull and guarantee that the frame - * is repained when the image is ready. - * - * If the image dimensions are known then they are returned - * immediately. - * - * This call can be safely made as many times as wanted with - * aImageStatus updated each time indicating what is known about the - * image. + * Load an image for the target frame. This call can be made + * repeated with only a single image every being loaded. If + * aNeedSizeUpdate is PR_TRUE then when the image's size is + * determined the target frame will be reflowed (via a + * ContentChanged notification on the presentation shell). When the + * image's data is ready for rendering the target frames Paint + * method will be invoked (via the ViewManager so that the + * appropriate damage repair is done). */ NS_IMETHOD LoadImage(const nsString& aURL, - nsIFrame* aForFrame, - PRInt32& aLoadImageStatus, - nsImageError& aError, - nsSize& aImageSize, - nsIImage*& aImage) = 0; + nsIFrame* aTargetFrame, + PRBool aNeedSizeUpdate, + nsIFrameImageLoader*& aLoader) = 0; /** * Stop any image loading being done on behalf of the argument frame. diff --git a/layout/base/public/nsIPresContext.h b/layout/base/public/nsIPresContext.h index 447e6baf7b23..d27cc7b133b2 100644 --- a/layout/base/public/nsIPresContext.h +++ b/layout/base/public/nsIPresContext.h @@ -20,23 +20,20 @@ #include "nslayout.h" #include "nsISupports.h" -#include "nsIImageObserver.h" #include "nsRect.h" -class nsIImage; +struct nsFont; + +class nsIContent; +class nsIDeviceContext; +class nsIFontMetrics; +class nsIFrame; +class nsIFrameImageLoader; +class nsIImageGroup; class nsILinkHandler; class nsIPresShell; -class nsIRenderingContext; -class nsIFrame; class nsIStyleContext; -class nsIFontMetrics; -class nsIContent; -class nsViewManager; -class nsIView; -class nsIFontCache; -class nsIDeviceContext; class nsString; -struct nsFont; #define NS_IPRESCONTEXT_IID \ { 0x0a5d12e0, 0x944e, 0x11d1, \ @@ -75,27 +72,22 @@ public: */ virtual const nsFont& GetDefaultFont(void) = 0; + NS_IMETHOD GetImageGroup(nsIImageGroup*& aGroupResult) = 0; + /** - * Load an image for the given url name for the given frame. When - * the image is ready for rendering the frame will be repainted. - * - * If the image is ready then this method will return the image, - * otherwise it will return nsnull and guarantee that the frame - * is repained when the image is ready. - * - * If the image dimensions are known then they are returned - * immediately. - * - * This call can be safely made as many times as wanted with - * aImageStatus updated each time indicating what is known about the - * image. + * Load an image for the target frame. This call can be made + * repeated with only a single image every being loaded. If + * aNeedSizeUpdate is PR_TRUE then when the image's size is + * determined the target frame will be reflowed (via a + * ContentChanged notification on the presentation shell). When the + * image's data is ready for rendering the target frames Paint + * method will be invoked (via the ViewManager so that the + * appropriate damage repair is done). */ NS_IMETHOD LoadImage(const nsString& aURL, - nsIFrame* aForFrame, - PRInt32& aLoadImageStatus, - nsImageError& aError, - nsSize& aImageSize, - nsIImage*& aImage) = 0; + nsIFrame* aTargetFrame, + PRBool aNeedSizeUpdate, + nsIFrameImageLoader*& aLoader) = 0; /** * Stop any image loading being done on behalf of the argument frame. diff --git a/layout/base/public/nsPresContext.h b/layout/base/public/nsPresContext.h index 447e6baf7b23..d27cc7b133b2 100644 --- a/layout/base/public/nsPresContext.h +++ b/layout/base/public/nsPresContext.h @@ -20,23 +20,20 @@ #include "nslayout.h" #include "nsISupports.h" -#include "nsIImageObserver.h" #include "nsRect.h" -class nsIImage; +struct nsFont; + +class nsIContent; +class nsIDeviceContext; +class nsIFontMetrics; +class nsIFrame; +class nsIFrameImageLoader; +class nsIImageGroup; class nsILinkHandler; class nsIPresShell; -class nsIRenderingContext; -class nsIFrame; class nsIStyleContext; -class nsIFontMetrics; -class nsIContent; -class nsViewManager; -class nsIView; -class nsIFontCache; -class nsIDeviceContext; class nsString; -struct nsFont; #define NS_IPRESCONTEXT_IID \ { 0x0a5d12e0, 0x944e, 0x11d1, \ @@ -75,27 +72,22 @@ public: */ virtual const nsFont& GetDefaultFont(void) = 0; + NS_IMETHOD GetImageGroup(nsIImageGroup*& aGroupResult) = 0; + /** - * Load an image for the given url name for the given frame. When - * the image is ready for rendering the frame will be repainted. - * - * If the image is ready then this method will return the image, - * otherwise it will return nsnull and guarantee that the frame - * is repained when the image is ready. - * - * If the image dimensions are known then they are returned - * immediately. - * - * This call can be safely made as many times as wanted with - * aImageStatus updated each time indicating what is known about the - * image. + * Load an image for the target frame. This call can be made + * repeated with only a single image every being loaded. If + * aNeedSizeUpdate is PR_TRUE then when the image's size is + * determined the target frame will be reflowed (via a + * ContentChanged notification on the presentation shell). When the + * image's data is ready for rendering the target frames Paint + * method will be invoked (via the ViewManager so that the + * appropriate damage repair is done). */ NS_IMETHOD LoadImage(const nsString& aURL, - nsIFrame* aForFrame, - PRInt32& aLoadImageStatus, - nsImageError& aError, - nsSize& aImageSize, - nsIImage*& aImage) = 0; + nsIFrame* aTargetFrame, + PRBool aNeedSizeUpdate, + nsIFrameImageLoader*& aLoader) = 0; /** * Stop any image loading being done on behalf of the argument frame. diff --git a/layout/base/src/nsPresContext.h b/layout/base/src/nsPresContext.h index e0c39aec628d..3858e7e4d972 100644 --- a/layout/base/src/nsPresContext.h +++ b/layout/base/src/nsPresContext.h @@ -37,12 +37,11 @@ public: nsIFrame* aParentFrame); virtual nsIFontMetrics* GetMetricsFor(const nsFont& aFont); virtual const nsFont& GetDefaultFont(void); + NS_IMETHOD GetImageGroup(nsIImageGroup*& aGroupResult); NS_IMETHOD LoadImage(const nsString& aURL, - nsIFrame* aForFrame, - PRInt32& aImageStatus, - nsImageError& aError, - nsSize& aImageSize, - nsIImage*& aImage); + nsIFrame* aTargetFrame, + PRBool aNeedSizeUpdate, + nsIFrameImageLoader*& aLoader); NS_IMETHOD StopLoadImage(nsIFrame* aForFrame); NS_IMETHOD SetContainer(nsISupports* aContainer); NS_IMETHOD GetContainer(nsISupports** aResult);