Commit 6cedbd97 authored by Timothy Nikkel's avatar Timothy Nikkel
Browse files

Bug 16420888. Use a ResolutionChangeOrigin for when the resolution is changing...

Bug 16420888. Use a ResolutionChangeOrigin for when the resolution is changing by tests that overides and sets the restore resolution. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D77582
parent 555823e3
......@@ -570,8 +570,7 @@ nsDOMWindowUtils::SetResolutionAndScaleTo(float aResolution) {
return NS_ERROR_FAILURE;
}
presShell->SetResolutionAndScaleTo(aResolution,
ResolutionChangeOrigin::MainThreadRestore);
presShell->SetResolutionAndScaleTo(aResolution, ResolutionChangeOrigin::Test);
return NS_OK;
}
......
......@@ -211,7 +211,8 @@ interface nsIDOMWindowUtils : nsISupports {
out uint32_t aHorizontalScrollbarHeight);
/**
* Get/set the resolution at which rescalable web content is drawn.
* Get/set the resolution at which rescalable web content is drawn for
* testing purposes.
*
* Setting a new resolution does *not* trigger reflow. This API is
* entirely separate from textZoom and fullZoom; a resolution scale
......@@ -225,10 +226,13 @@ interface nsIDOMWindowUtils : nsISupports {
* so that it is displayed at a correspondingly larger or smaller size,
* without the need for the caller to set an additional transform.
*
* This can be used to implement a non-reflowing scale-zoom, e.g.
* for pinch-zoom on mobile platforms.
* The purpose of this API is to allow tests to simulate many of the effects
* a non-reflowing scale-zoom, e.g. for pinch-zoom on mobile platforms, and
* should be only used for testing purposes.
*
* The caller of this method must have chrome privileges.
*
* This is intended to be used by test code only!
*/
void setResolutionAndScaleTo(in float aResolution);
......
......@@ -110,8 +110,9 @@ void MobileViewportManager::ResolutionUpdated(
return;
}
if (!mPainted &&
aOrigin == mozilla::ResolutionChangeOrigin::MainThreadRestore) {
if ((!mPainted &&
aOrigin == mozilla::ResolutionChangeOrigin::MainThreadRestore) ||
aOrigin == mozilla::ResolutionChangeOrigin::Test) {
// Save the value, so our default zoom calculation
// can take it into account later on.
SetRestoreResolution(mContext->GetResolution());
......
......@@ -176,6 +176,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderImageFlags)
enum class ResolutionChangeOrigin : uint8_t {
Apz,
Test,
MainThreadRestore,
MainThreadAdjustment,
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment