From 73eaab0ee29a9baa758a3b97c090ab664651d856 Mon Sep 17 00:00:00 2001 From: "cst%yecc.com" Date: Thu, 7 Sep 2006 22:51:57 +0000 Subject: [PATCH] Bug 47475 Need "Show(View) Image" / "Reload Image" on context menu (UI is SeaMonkey-only) r=bz r=biesi sr=neil git-svn-id: svn://10.0.0.236/trunk@209387 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/public/nsIImageLoadingContent.idl | 9 ++++++++- .../content/base/src/nsImageLoadingContent.cpp | 16 ++++++++++++++-- mozilla/content/base/src/nsImageLoadingContent.h | 5 ++++- .../suite/common/contentAreaContextOverlay.xul | 4 ++++ mozilla/suite/common/nsContextMenu.js | 8 ++++++++ .../en-US/chrome/common/contentAreaCommands.dtd | 2 ++ .../content/contentAreaContextOverlay.xul | 4 ++++ .../resources/content/nsContextMenu.js | 8 ++++++++ 8 files changed, 52 insertions(+), 4 deletions(-) diff --git a/mozilla/content/base/public/nsIImageLoadingContent.idl b/mozilla/content/base/public/nsIImageLoadingContent.idl index f14d40e6b66..d91325d3015 100644 --- a/mozilla/content/base/public/nsIImageLoadingContent.idl +++ b/mozilla/content/base/public/nsIImageLoadingContent.idl @@ -64,7 +64,7 @@ interface nsIURI; * sufficient, when combined with the imageBlockingStatus information.) */ -[scriptable, uuid(49b02654-5f96-48a0-bf99-0fe467a3fa52)] +[scriptable, uuid(7744c6d3-5c60-4b7b-a526-4fe9d5ac7e97)] interface nsIImageLoadingContent : imgIDecoderObserver { /** @@ -160,4 +160,11 @@ interface nsIImageLoadingContent : imgIDecoderObserver * @throws NS_ERROR_NULL_POINTER if aChannel is null */ nsIStreamListener loadImageWithChannel(in nsIChannel aChannel); + + /** + * forceReload forces reloading of the image pointed to by currentURI + * + * @throws NS_ERROR_NOT_AVAILABLE if there is no current URI to reload + */ + void forceReload(); }; diff --git a/mozilla/content/base/src/nsImageLoadingContent.cpp b/mozilla/content/base/src/nsImageLoadingContent.cpp index e709a3a7f1a..f4351f9460d 100644 --- a/mozilla/content/base/src/nsImageLoadingContent.cpp +++ b/mozilla/content/base/src/nsImageLoadingContent.cpp @@ -475,6 +475,17 @@ nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel, return rv; } +NS_IMETHODIMP nsImageLoadingContent::ForceReload() +{ + nsCOMPtr currentURI; + GetCurrentURI(getter_AddRefs(currentURI)); + if (!currentURI) { + return NS_ERROR_NOT_AVAILABLE; + } + + return LoadImage(currentURI, PR_TRUE, PR_TRUE, nsnull, nsIRequest::VALIDATE_ALWAYS); +} + /* * Non-interface methods */ @@ -505,7 +516,8 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, PRBool aForce, PRBool aNotify, - nsIDocument* aDocument) + nsIDocument* aDocument, + nsLoadFlags aLoadFlags) { if (!mLoadingEnabled) { FireEvent(NS_LITERAL_STRING("error")); @@ -583,7 +595,7 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI, rv = nsContentUtils::LoadImage(aNewURI, aDocument, aDocument->GetDocumentURI(), - this, nsIRequest::LOAD_NORMAL, + this, aLoadFlags, getter_AddRefs(req)); if (NS_FAILED(rv)) { FireEvent(NS_LITERAL_STRING("error")); diff --git a/mozilla/content/base/src/nsImageLoadingContent.h b/mozilla/content/base/src/nsImageLoadingContent.h index 232267e0bc8..2c595aa77cb 100644 --- a/mozilla/content/base/src/nsImageLoadingContent.h +++ b/mozilla/content/base/src/nsImageLoadingContent.h @@ -108,9 +108,12 @@ protected: * will be sent as needed. * @param aDocument Optional parameter giving the document this node is in. * This is purely a performance optimization. + * @param aLoadFlags Optional parameter specifying load flags to use for + * the image load */ nsresult LoadImage(nsIURI* aNewURI, PRBool aForce, PRBool aNotify, - nsIDocument* aDocument = nsnull); + nsIDocument* aDocument = nsnull, + nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL); /** * helper to get the document for this content (from the nodeinfo diff --git a/mozilla/suite/common/contentAreaContextOverlay.xul b/mozilla/suite/common/contentAreaContextOverlay.xul index 2087783c6d6..67f9f0253ce 100644 --- a/mozilla/suite/common/contentAreaContextOverlay.xul +++ b/mozilla/suite/common/contentAreaContextOverlay.xul @@ -105,6 +105,10 @@ label="&fitImageCmd.label;" accesskey="&fitImageCmd.accesskey;" oncommand="gContextMenu.toggleImageSize();"/> + + + diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul b/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul index 0408618b7e8..f659837772f 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul +++ b/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul @@ -105,6 +105,10 @@ label="&fitImageCmd.label;" accesskey="&fitImageCmd.accesskey;" oncommand="gContextMenu.toggleImageSize();"/> +