mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1299154
- added Set/GetOverrideDPPX to restorefromHistory; r=mstange
MozReview-Commit-ID: AsyAcG3Igbn
This commit is contained in:
parent
f413b9b7dd
commit
46b536cd2f
@ -8538,11 +8538,14 @@ nsDocShell::RestoreFromHistory()
|
||||
int32_t minFontSize = 0;
|
||||
float textZoom = 1.0f;
|
||||
float pageZoom = 1.0f;
|
||||
float overrideDPPX = 0.0f;
|
||||
|
||||
bool styleDisabled = false;
|
||||
if (oldCv && newCv) {
|
||||
oldCv->GetMinFontSize(&minFontSize);
|
||||
oldCv->GetTextZoom(&textZoom);
|
||||
oldCv->GetFullZoom(&pageZoom);
|
||||
oldCv->GetOverrideDPPX(&overrideDPPX);
|
||||
oldCv->GetAuthorStyleDisabled(&styleDisabled);
|
||||
}
|
||||
|
||||
@ -8775,6 +8778,7 @@ nsDocShell::RestoreFromHistory()
|
||||
newCv->SetMinFontSize(minFontSize);
|
||||
newCv->SetTextZoom(textZoom);
|
||||
newCv->SetFullZoom(pageZoom);
|
||||
newCv->SetOverrideDPPX(overrideDPPX);
|
||||
newCv->SetAuthorStyleDisabled(styleDisabled);
|
||||
}
|
||||
|
||||
@ -9268,6 +9272,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
|
||||
int32_t minFontSize;
|
||||
float textZoom;
|
||||
float pageZoom;
|
||||
float overrideDPPX;
|
||||
bool styleDisabled;
|
||||
// |newMUDV| also serves as a flag to set the data from the above vars
|
||||
nsCOMPtr<nsIContentViewer> newCv;
|
||||
@ -9309,6 +9314,8 @@ nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(oldCv->GetFullZoom(&pageZoom),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(oldCv->GetOverrideDPPX(&overrideDPPX),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(oldCv->GetAuthorStyleDisabled(&styleDisabled),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
@ -9377,6 +9384,8 @@ nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(newCv->SetFullZoom(pageZoom),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(newCv->SetOverrideDPPX(overrideDPPX),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(newCv->SetAuthorStyleDisabled(styleDisabled),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
|
@ -284,6 +284,50 @@ const gTests = {
|
||||
|
||||
setOverrideDPPX(dppx);
|
||||
setFullZoom(zoom);
|
||||
},
|
||||
"test OverrideDPPX is kept on document navigation": (done) => {
|
||||
assertValuesAreInitial();
|
||||
|
||||
let frameOriginalFontSize = getBodyFontSize(frameWindow);
|
||||
let frameStyle = createFontStyleForDPPX(frameWindow.document, dppx, "32");
|
||||
let frameCurrentFontSize = getBodyFontSize(frameWindow);
|
||||
|
||||
is(frameCurrentFontSize, frameOriginalFontSize,
|
||||
"frame's media queries are not applied yet");
|
||||
|
||||
setOverrideDPPX(dppx);
|
||||
|
||||
frameCurrentFontSize = getBodyFontSize(frameWindow);
|
||||
|
||||
is(frameWindow.devicePixelRatio, dppx,
|
||||
"frame's devicePixelRatio overridden.");
|
||||
isnot(frameCurrentFontSize, frameOriginalFontSize,
|
||||
"frame's media queries are applied.");
|
||||
is(frameCurrentFontSize, "32px",
|
||||
"frame's font size has the expected value.");
|
||||
|
||||
frameWindow.frameElement.addEventListener("load", function listener() {
|
||||
this.removeEventListener("load", listener);
|
||||
|
||||
frameStyle = createFontStyleForDPPX(frameWindow.document, dppx, "32");
|
||||
|
||||
frameCurrentFontSize = getBodyFontSize(frameWindow);
|
||||
|
||||
is(frameWindow.devicePixelRatio, dppx,
|
||||
"frame's devicePixelRatio is still overridden.");
|
||||
isnot(frameCurrentFontSize, frameOriginalFontSize,
|
||||
"frame's media queries are still applied.");
|
||||
is(frameCurrentFontSize, "32px",
|
||||
"frame's font size has still the expected value.");
|
||||
|
||||
frameStyle.remove();
|
||||
|
||||
setOverrideDPPX(0);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
frameWindow.location.reload(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user