Bug 957790 - Initialize the APZC with zooming disabled until we know for sure if it is allowed. r=botond,jimm

On Metro we don't support the meta-viewport tag yet, so we need to re-enable
zooming there.
This commit is contained in:
Kartikaya Gupta 2014-01-13 09:55:19 -05:00
parent 592f1133b6
commit 3961cc600f
3 changed files with 19 additions and 1 deletions

View File

@ -393,7 +393,7 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
mTouchListenerTimeoutTask(nullptr),
mX(MOZ_THIS_IN_INITIALIZER_LIST()),
mY(MOZ_THIS_IN_INITIALIZER_LIST()),
mZoomConstraints(true, MIN_ZOOM, MAX_ZOOM),
mZoomConstraints(false, MIN_ZOOM, MAX_ZOOM),
mLastSampleTime(GetFrameTime()),
mState(NOTHING),
mLastAsyncScrollTime(GetFrameTime()),
@ -1643,6 +1643,8 @@ void AsyncPanZoomController::TimeoutTouchListeners() {
}
void AsyncPanZoomController::UpdateZoomConstraints(const ZoomConstraints& aConstraints) {
APZC_LOG("%p updating zoom constraints to %d %f %f\n", this, aConstraints.mAllowZoom,
aConstraints.mMinZoom.scale, aConstraints.mMaxZoom.scale);
mZoomConstraints.mAllowZoom = aConstraints.mAllowZoom;
mZoomConstraints.mMinZoom = (MIN_ZOOM > aConstraints.mMinZoom ? MIN_ZOOM : aConstraints.mMinZoom);
mZoomConstraints.mMaxZoom = (MAX_ZOOM > aConstraints.mMaxZoom ? aConstraints.mMaxZoom : MAX_ZOOM);

View File

@ -266,6 +266,20 @@ APZController::PostDelayedTask(Task* aTask, int aDelayMs)
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
bool
APZController::GetRootZoomConstraints(ZoomConstraints* aOutConstraints)
{
if (aOutConstraints) {
// Until we support the meta-viewport tag properly allow zooming
// from 1/4 to 4x by default.
aOutConstraints->mAllowZoom = true;
aOutConstraints->mMinZoom = CSSToScreenScale(0.25f);
aOutConstraints->mMaxZoom = CSSToScreenScale(4.0f);
return true;
}
return false;
}
// apzc notifications
class TransformedStartEvent : public nsRunnable

View File

@ -23,6 +23,7 @@ class APZController :
{
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
typedef mozilla::layers::ZoomConstraints ZoomConstraints;
public:
APZController() :
@ -38,6 +39,7 @@ public:
virtual void HandleLongTapUp(const mozilla::CSSIntPoint& aPoint, int32_t aModifiers);
virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize);
virtual void PostDelayedTask(Task* aTask, int aDelayMs);
virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints);
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid);
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid);