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) { ...@@ -570,8 +570,7 @@ nsDOMWindowUtils::SetResolutionAndScaleTo(float aResolution) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
presShell->SetResolutionAndScaleTo(aResolution, presShell->SetResolutionAndScaleTo(aResolution, ResolutionChangeOrigin::Test);
ResolutionChangeOrigin::MainThreadRestore);
return NS_OK; return NS_OK;
} }
......
...@@ -211,7 +211,8 @@ interface nsIDOMWindowUtils : nsISupports { ...@@ -211,7 +211,8 @@ interface nsIDOMWindowUtils : nsISupports {
out uint32_t aHorizontalScrollbarHeight); 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 * Setting a new resolution does *not* trigger reflow. This API is
* entirely separate from textZoom and fullZoom; a resolution scale * entirely separate from textZoom and fullZoom; a resolution scale
...@@ -225,10 +226,13 @@ interface nsIDOMWindowUtils : nsISupports { ...@@ -225,10 +226,13 @@ interface nsIDOMWindowUtils : nsISupports {
* so that it is displayed at a correspondingly larger or smaller size, * so that it is displayed at a correspondingly larger or smaller size,
* without the need for the caller to set an additional transform. * without the need for the caller to set an additional transform.
* *
* This can be used to implement a non-reflowing scale-zoom, e.g. * The purpose of this API is to allow tests to simulate many of the effects
* for pinch-zoom on mobile platforms. * 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. * The caller of this method must have chrome privileges.
*
* This is intended to be used by test code only!
*/ */
void setResolutionAndScaleTo(in float aResolution); void setResolutionAndScaleTo(in float aResolution);
......
...@@ -110,8 +110,9 @@ void MobileViewportManager::ResolutionUpdated( ...@@ -110,8 +110,9 @@ void MobileViewportManager::ResolutionUpdated(
return; return;
} }
if (!mPainted && if ((!mPainted &&
aOrigin == mozilla::ResolutionChangeOrigin::MainThreadRestore) { aOrigin == mozilla::ResolutionChangeOrigin::MainThreadRestore) ||
aOrigin == mozilla::ResolutionChangeOrigin::Test) {
// Save the value, so our default zoom calculation // Save the value, so our default zoom calculation
// can take it into account later on. // can take it into account later on.
SetRestoreResolution(mContext->GetResolution()); SetRestoreResolution(mContext->GetResolution());
......
...@@ -176,6 +176,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderImageFlags) ...@@ -176,6 +176,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderImageFlags)
enum class ResolutionChangeOrigin : uint8_t { enum class ResolutionChangeOrigin : uint8_t {
Apz, Apz,
Test,
MainThreadRestore, MainThreadRestore,
MainThreadAdjustment, 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