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
Родитель 592f1133b6
Коммит 3961cc600f
3 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -393,7 +393,7 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
mTouchListenerTimeoutTask(nullptr), mTouchListenerTimeoutTask(nullptr),
mX(MOZ_THIS_IN_INITIALIZER_LIST()), mX(MOZ_THIS_IN_INITIALIZER_LIST()),
mY(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()), mLastSampleTime(GetFrameTime()),
mState(NOTHING), mState(NOTHING),
mLastAsyncScrollTime(GetFrameTime()), mLastAsyncScrollTime(GetFrameTime()),
@ -1643,6 +1643,8 @@ void AsyncPanZoomController::TimeoutTouchListeners() {
} }
void AsyncPanZoomController::UpdateZoomConstraints(const ZoomConstraints& aConstraints) { 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.mAllowZoom = aConstraints.mAllowZoom;
mZoomConstraints.mMinZoom = (MIN_ZOOM > aConstraints.mMinZoom ? MIN_ZOOM : aConstraints.mMinZoom); mZoomConstraints.mMinZoom = (MIN_ZOOM > aConstraints.mMinZoom ? MIN_ZOOM : aConstraints.mMinZoom);
mZoomConstraints.mMaxZoom = (MAX_ZOOM > aConstraints.mMaxZoom ? aConstraints.mMaxZoom : MAX_ZOOM); mZoomConstraints.mMaxZoom = (MAX_ZOOM > aConstraints.mMaxZoom ? aConstraints.mMaxZoom : MAX_ZOOM);

Просмотреть файл

@ -266,6 +266,20 @@ APZController::PostDelayedTask(Task* aTask, int aDelayMs)
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, 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 // apzc notifications
class TransformedStartEvent : public nsRunnable class TransformedStartEvent : public nsRunnable

Просмотреть файл

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