зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1377158 - (Part 5) Decide style backend type according to the loading document. r=heycam
MozReview-Commit-ID: GGx0XUrGT2e --HG-- extra : rebase_source : 3c80cb20ca8927b9a3bee55b37824fb84cf64054
This commit is contained in:
Родитель
e6109257ef
Коммит
d5ea754313
|
@ -2244,9 +2244,14 @@ imgLoader::LoadImage(nsIURI* aURI,
|
|||
|
||||
nsCOMPtr<nsILoadGroup> channelLoadGroup;
|
||||
newChannel->GetLoadGroup(getter_AddRefs(channelLoadGroup));
|
||||
// We look at the loading document's style backend type to decide which
|
||||
// style backend type should be used for the images. So the images in Chrome
|
||||
// documents would be loaded by Gecko.
|
||||
rv = request->Init(aURI, aURI, /* aHadInsecureRedirect = */ false,
|
||||
channelLoadGroup, newChannel, entry, aLoadingDocument,
|
||||
aLoadingPrincipal, corsmode, aReferrerPolicy);
|
||||
aLoadingPrincipal, corsmode, aReferrerPolicy,
|
||||
aLoadingDocument ? aLoadingDocument->GetStyleBackendType()
|
||||
: StyleBackendType::None);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ imgRequest::imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey)
|
|||
, mDecodeRequested(false)
|
||||
, mNewPartPending(false)
|
||||
, mHadInsecureRedirect(false)
|
||||
, mStyleBackendType(StyleBackendType::None)
|
||||
{ }
|
||||
|
||||
imgRequest::~imgRequest()
|
||||
|
@ -95,7 +96,8 @@ imgRequest::Init(nsIURI *aURI,
|
|||
nsISupports* aCX,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
int32_t aCORSMode,
|
||||
ReferrerPolicy aReferrerPolicy)
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
StyleBackendType aStyleBackendType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Cannot use nsIURI off main thread!");
|
||||
|
||||
|
@ -123,6 +125,8 @@ imgRequest::Init(nsIURI *aURI,
|
|||
mCORSMode = aCORSMode;
|
||||
mReferrerPolicy = aReferrerPolicy;
|
||||
|
||||
mStyleBackendType = aStyleBackendType;
|
||||
|
||||
// If the original URI and the current URI are different, check whether the
|
||||
// original URI is secure. We deliberately don't take the current URI into
|
||||
// account, as it needs to be handled using more complicated rules than
|
||||
|
@ -967,7 +971,8 @@ struct NewPartResult final
|
|||
static NewPartResult
|
||||
PrepareForNewPart(nsIRequest* aRequest, nsIInputStream* aInStr, uint32_t aCount,
|
||||
ImageURL* aURI, bool aIsMultipart, image::Image* aExistingImage,
|
||||
ProgressTracker* aProgressTracker, uint32_t aInnerWindowId)
|
||||
ProgressTracker* aProgressTracker, uint32_t aInnerWindowId,
|
||||
StyleBackendType aStyleBackendType)
|
||||
{
|
||||
NewPartResult result(aExistingImage);
|
||||
|
||||
|
@ -1015,7 +1020,7 @@ PrepareForNewPart(nsIRequest* aRequest, nsIInputStream* aInStr, uint32_t aCount,
|
|||
image::ImageFactory::CreateImage(aRequest, progressTracker,
|
||||
result.mContentType,
|
||||
aURI, /* aIsMultipart = */ true,
|
||||
aInnerWindowId);
|
||||
aInnerWindowId, aStyleBackendType);
|
||||
|
||||
if (result.mIsFirstPart) {
|
||||
// First part for a multipart channel. Create the MultipartImage wrapper.
|
||||
|
@ -1040,7 +1045,7 @@ PrepareForNewPart(nsIRequest* aRequest, nsIInputStream* aInStr, uint32_t aCount,
|
|||
image::ImageFactory::CreateImage(aRequest, aProgressTracker,
|
||||
result.mContentType,
|
||||
aURI, /* aIsMultipart = */ false,
|
||||
aInnerWindowId);
|
||||
aInnerWindowId, aStyleBackendType);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result.mImage);
|
||||
|
@ -1133,7 +1138,8 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
|
|||
if (newPartPending) {
|
||||
NewPartResult result = PrepareForNewPart(aRequest, aInStr, aCount, mURI,
|
||||
isMultipart, image,
|
||||
progressTracker, mInnerWindowId);
|
||||
progressTracker, mInnerWindowId,
|
||||
mStyleBackendType);
|
||||
bool succeeded = result.mSucceeded;
|
||||
|
||||
if (result.mImage) {
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
#include "ImageCacheKey.h"
|
||||
|
||||
#include "X11UndefineNone.h"
|
||||
#include "mozilla/StyleBackendType.h"
|
||||
|
||||
class imgCacheValidator;
|
||||
class imgLoader;
|
||||
class imgRequestProxy;
|
||||
|
@ -53,6 +56,7 @@ class imgRequest final : public nsIStreamListener,
|
|||
typedef mozilla::image::ImageURL ImageURL;
|
||||
typedef mozilla::image::ProgressTracker ProgressTracker;
|
||||
typedef mozilla::net::ReferrerPolicy ReferrerPolicy;
|
||||
typedef mozilla::StyleBackendType StyleBackendType;
|
||||
|
||||
public:
|
||||
imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey);
|
||||
|
@ -74,7 +78,8 @@ public:
|
|||
nsISupports* aCX,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
int32_t aCORSMode,
|
||||
ReferrerPolicy aReferrerPolicy);
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
StyleBackendType aBackendType = StyleBackendType::None);
|
||||
|
||||
void ClearLoader();
|
||||
|
||||
|
@ -295,6 +300,9 @@ private:
|
|||
bool mDecodeRequested : 1;
|
||||
bool mNewPartPending : 1;
|
||||
bool mHadInsecureRedirect : 1;
|
||||
|
||||
// The backend used for this image document.
|
||||
mozilla::StyleBackendType mStyleBackendType;
|
||||
};
|
||||
|
||||
#endif // mozilla_image_imgRequest_h
|
||||
|
|
Загрузка…
Ссылка в новой задаче