Bug 866232 - Only fire mozbrowserasyncscroll events on the top-level scrollable for backwards compatibility. r=BenWa

This commit is contained in:
Kartikaya Gupta 2013-07-30 14:03:42 -04:00
parent 61c09db07a
commit 6762cc18a8
6 changed files with 21 additions and 12 deletions

View File

@ -1454,15 +1454,18 @@ void AsyncPanZoomController::SendAsyncScrollEvent() {
return;
}
FrameMetrics::ViewID scrollId;
CSSRect contentRect;
CSSSize scrollableSize;
{
// XXX bug 890932 - there should be a lock here. but it causes a deadlock.
scrollId = mFrameMetrics.mScrollId;
scrollableSize = mFrameMetrics.mScrollableRect.Size();
contentRect = mFrameMetrics.CalculateCompositedRectInCssPixels();
contentRect.MoveTo(mCurrentAsyncScrollOffset);
}
controller->SendAsyncScrollDOMEvent(contentRect, scrollableSize);
controller->SendAsyncScrollDOMEvent(scrollId, contentRect, scrollableSize);
}
void AsyncPanZoomController::UpdateScrollOffset(const CSSPoint& aScrollOffset)

View File

@ -51,7 +51,8 @@ public:
* |aContentRect| is in CSS pixels, relative to the current cssPage.
* |aScrollableSize| is the current content width/height in CSS pixels.
*/
virtual void SendAsyncScrollDOMEvent(const CSSRect &aContentRect,
virtual void SendAsyncScrollDOMEvent(FrameMetrics::ViewID aScrollId,
const CSSRect &aContentRect,
const CSSSize &aScrollableSize) = 0;
/**

View File

@ -26,7 +26,7 @@ public:
MOCK_METHOD1(HandleDoubleTap, void(const CSSIntPoint&));
MOCK_METHOD1(HandleSingleTap, void(const CSSIntPoint&));
MOCK_METHOD1(HandleLongTap, void(const CSSIntPoint&));
MOCK_METHOD2(SendAsyncScrollDOMEvent, void(const CSSRect &aContentRect, const CSSSize &aScrollableSize));
MOCK_METHOD3(SendAsyncScrollDOMEvent, void(FrameMetrics::ViewID aScrollId, const CSSRect &aContentRect, const CSSSize &aScrollableSize));
MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs));
};
@ -242,7 +242,7 @@ TEST(AsyncPanZoomController, Pan) {
apzc->SetFrameMetrics(TestFrameMetrics());
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(4);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(4);
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
int time = 0;
@ -274,7 +274,7 @@ TEST(AsyncPanZoomController, Fling) {
apzc->SetFrameMetrics(TestFrameMetrics());
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(2);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(2);
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
int time = 0;
@ -303,7 +303,7 @@ TEST(AsyncPanZoomController, OverScrollPanning) {
apzc->SetFrameMetrics(TestFrameMetrics());
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(3);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(3);
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
// Pan sufficiently to hit overscroll behavior
@ -361,7 +361,7 @@ SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId, MockCon
// when we do the next tree update, a new APZC will be created for this layer,
// and that will invoke these functions once.
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(1);
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(1);
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
}

View File

@ -552,7 +552,8 @@ public:
void ClearRenderFrame() { mRenderFrame = nullptr; }
virtual void SendAsyncScrollDOMEvent(const CSSRect& aContentRect,
virtual void SendAsyncScrollDOMEvent(FrameMetrics::ViewID aScrollId,
const CSSRect& aContentRect,
const CSSSize& aContentSize) MOZ_OVERRIDE
{
if (MessageLoop::current() != mUILoop) {
@ -560,10 +561,10 @@ public:
FROM_HERE,
NewRunnableMethod(this,
&RemoteContentController::SendAsyncScrollDOMEvent,
aContentRect, aContentSize));
aScrollId, aContentRect, aContentSize));
return;
}
if (mRenderFrame) {
if (mRenderFrame && aScrollId == FrameMetrics::ROOT_SCROLL_ID) {
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
BrowserElementParent::DispatchAsyncScrollEvent(browser, aContentRect,
aContentSize);

View File

@ -2850,7 +2850,9 @@ AndroidBridge::HandleLongTap(const CSSIntPoint& aPoint)
}
void
AndroidBridge::SendAsyncScrollDOMEvent(const CSSRect& aContentRect, const CSSSize& aScrollableSize)
AndroidBridge::SendAsyncScrollDOMEvent(mozilla::layers::FrameMetrics::ViewID aScrollId,
const CSSRect& aContentRect,
const CSSSize& aScrollableSize)
{
// FIXME implement this
}

View File

@ -601,7 +601,9 @@ public:
void HandleDoubleTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
void HandleSingleTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
void HandleLongTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
void SendAsyncScrollDOMEvent(const CSSRect& aContentRect, const CSSSize& aScrollableSize) MOZ_OVERRIDE;
void SendAsyncScrollDOMEvent(mozilla::layers::FrameMetrics::ViewID aScrollId,
const CSSRect& aContentRect,
const CSSSize& aScrollableSize) MOZ_OVERRIDE;
void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE;
int64_t RunDelayedTasks();
};