mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 503729 - with browser.zoom.siteSpecific=false: viewing a standalone image resets full zoom level, r=jst
This commit is contained in:
parent
9c6f30a65c
commit
cb8815c98a
@ -110,6 +110,8 @@ public:
|
|||||||
|
|
||||||
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
|
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
|
||||||
virtual void Destroy();
|
virtual void Destroy();
|
||||||
|
virtual void OnPageShow(PRBool aPersisted,
|
||||||
|
nsIDOMEventTarget* aDispatchStartTarget);
|
||||||
|
|
||||||
NS_DECL_NSIIMAGEDOCUMENT
|
NS_DECL_NSIIMAGEDOCUMENT
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ protected:
|
|||||||
(float)mVisibleHeight / mImageHeight);
|
(float)mVisibleHeight / mImageHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetZoomLevel(float aZoomLevel);
|
void ResetZoomLevel();
|
||||||
float GetZoomLevel();
|
float GetZoomLevel();
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> mImageContent;
|
nsCOMPtr<nsIContent> mImageContent;
|
||||||
@ -158,6 +160,8 @@ protected:
|
|||||||
PRPackedBool mFirstResize;
|
PRPackedBool mFirstResize;
|
||||||
// mObservingImageLoader is true while the observer is set.
|
// mObservingImageLoader is true while the observer is set.
|
||||||
PRPackedBool mObservingImageLoader;
|
PRPackedBool mObservingImageLoader;
|
||||||
|
|
||||||
|
float mOriginalZoomLevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageListener::ImageListener(nsImageDocument* aDocument)
|
ImageListener::ImageListener(nsImageDocument* aDocument)
|
||||||
@ -264,7 +268,7 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
// bother initializing members to 0.
|
// bother initializing members to 0.
|
||||||
|
|
||||||
nsImageDocument::nsImageDocument()
|
nsImageDocument::nsImageDocument() : mOriginalZoomLevel(1.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
@ -334,6 +338,8 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mOriginalZoomLevel = GetZoomLevel();
|
||||||
|
|
||||||
NS_ASSERTION(aDocListener, "null aDocListener");
|
NS_ASSERTION(aDocListener, "null aDocListener");
|
||||||
*aDocListener = new ImageListener(this);
|
*aDocListener = new ImageListener(this);
|
||||||
if (!*aDocListener)
|
if (!*aDocListener)
|
||||||
@ -402,6 +408,15 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsImageDocument::OnPageShow(PRBool aPersisted,
|
||||||
|
nsIDOMEventTarget* aDispatchStartTarget)
|
||||||
|
{
|
||||||
|
if (aPersisted) {
|
||||||
|
mOriginalZoomLevel = GetZoomLevel();
|
||||||
|
}
|
||||||
|
nsMediaDocument::OnPageShow(aPersisted, aDispatchStartTarget);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImageDocument::GetImageResizingEnabled(PRBool* aImageResizingEnabled)
|
nsImageDocument::GetImageResizingEnabled(PRBool* aImageResizingEnabled)
|
||||||
@ -440,7 +455,7 @@ nsImageDocument::GetImageRequest(imgIRequest** aImageRequest)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImageDocument::ShrinkToFit()
|
nsImageDocument::ShrinkToFit()
|
||||||
{
|
{
|
||||||
if (GetZoomLevel() != 1.0 && mImageIsResized) {
|
if (GetZoomLevel() != mOriginalZoomLevel && mImageIsResized) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,11 +548,11 @@ nsImageDocument::ToggleImageSize()
|
|||||||
mShouldResize = PR_TRUE;
|
mShouldResize = PR_TRUE;
|
||||||
if (mImageIsResized) {
|
if (mImageIsResized) {
|
||||||
mShouldResize = PR_FALSE;
|
mShouldResize = PR_FALSE;
|
||||||
SetZoomLevel(1.0);
|
ResetZoomLevel();
|
||||||
RestoreImage();
|
RestoreImage();
|
||||||
}
|
}
|
||||||
else if (mImageIsOverflowing) {
|
else if (mImageIsOverflowing) {
|
||||||
SetZoomLevel(1.0);
|
ResetZoomLevel();
|
||||||
ShrinkToFit();
|
ShrinkToFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +564,7 @@ nsImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
|||||||
{
|
{
|
||||||
aImage->GetWidth(&mImageWidth);
|
aImage->GetWidth(&mImageWidth);
|
||||||
aImage->GetHeight(&mImageHeight);
|
aImage->GetHeight(&mImageHeight);
|
||||||
SetZoomLevel(1.0);
|
ResetZoomLevel();
|
||||||
CheckOverflowing(mResizeImageByDefault);
|
CheckOverflowing(mResizeImageByDefault);
|
||||||
UpdateTitleAndCharset();
|
UpdateTitleAndCharset();
|
||||||
|
|
||||||
@ -565,7 +580,7 @@ nsImageDocument::HandleEvent(nsIDOMEvent* aEvent)
|
|||||||
CheckOverflowing(PR_FALSE);
|
CheckOverflowing(PR_FALSE);
|
||||||
}
|
}
|
||||||
else if (eventType.EqualsLiteral("click") && mClickResizingEnabled) {
|
else if (eventType.EqualsLiteral("click") && mClickResizingEnabled) {
|
||||||
SetZoomLevel(1.0);
|
ResetZoomLevel();
|
||||||
mShouldResize = PR_TRUE;
|
mShouldResize = PR_TRUE;
|
||||||
if (mImageIsResized) {
|
if (mImageIsResized) {
|
||||||
PRInt32 x = 0, y = 0;
|
PRInt32 x = 0, y = 0;
|
||||||
@ -599,7 +614,7 @@ nsImageDocument::HandleEvent(nsIDOMEvent* aEvent)
|
|||||||
if (charCode == 0x2B && !ctrlKey && !metaKey && !altKey) {
|
if (charCode == 0x2B && !ctrlKey && !metaKey && !altKey) {
|
||||||
mShouldResize = PR_FALSE;
|
mShouldResize = PR_FALSE;
|
||||||
if (mImageIsResized) {
|
if (mImageIsResized) {
|
||||||
SetZoomLevel(1.0);
|
ResetZoomLevel();
|
||||||
RestoreImage();
|
RestoreImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -607,7 +622,7 @@ nsImageDocument::HandleEvent(nsIDOMEvent* aEvent)
|
|||||||
else if (charCode == 0x2D && !ctrlKey && !metaKey && !altKey) {
|
else if (charCode == 0x2D && !ctrlKey && !metaKey && !altKey) {
|
||||||
mShouldResize = PR_TRUE;
|
mShouldResize = PR_TRUE;
|
||||||
if (mImageIsOverflowing) {
|
if (mImageIsOverflowing) {
|
||||||
SetZoomLevel(1.0);
|
ResetZoomLevel();
|
||||||
ShrinkToFit();
|
ShrinkToFit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -779,7 +794,7 @@ nsImageDocument::UpdateTitleAndCharset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImageDocument::SetZoomLevel(float aZoomLevel)
|
nsImageDocument::ResetZoomLevel()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
|
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
|
||||||
if (docShell) {
|
if (docShell) {
|
||||||
@ -787,7 +802,7 @@ nsImageDocument::SetZoomLevel(float aZoomLevel)
|
|||||||
docShell->GetContentViewer(getter_AddRefs(cv));
|
docShell->GetContentViewer(getter_AddRefs(cv));
|
||||||
nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(cv);
|
nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(cv);
|
||||||
if (mdv) {
|
if (mdv) {
|
||||||
mdv->SetFullZoom(aZoomLevel);
|
mdv->SetFullZoom(mOriginalZoomLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -795,7 +810,7 @@ nsImageDocument::SetZoomLevel(float aZoomLevel)
|
|||||||
float
|
float
|
||||||
nsImageDocument::GetZoomLevel()
|
nsImageDocument::GetZoomLevel()
|
||||||
{
|
{
|
||||||
float zoomLevel = 1.0;
|
float zoomLevel = mOriginalZoomLevel;
|
||||||
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
|
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
|
||||||
if (docShell) {
|
if (docShell) {
|
||||||
nsCOMPtr<nsIContentViewer> cv;
|
nsCOMPtr<nsIContentViewer> cv;
|
||||||
|
Loading…
Reference in New Issue
Block a user