Bug 814435 - Prevent scrollbars from fading out while user is scrolling. r=botond

This commit is contained in:
Kartikaya Gupta 2013-12-09 22:14:55 -05:00
parent 316a75b934
commit 6a13913a77
10 changed files with 91 additions and 8 deletions

View File

@ -345,6 +345,13 @@ child:
*/
HandleLongTap(CSSIntPoint point);
/**
* Notifies the child that the parent has begun or finished transforming
* the visible child content area. Useful for showing/hiding scrollbars.
*/
NotifyTransformBegin(ViewID aViewId);
NotifyTransformEnd(ViewID aViewId);
/**
* Sending an activate message moves focus to the child.
*/

View File

@ -1659,6 +1659,32 @@ TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint)
return true;
}
bool
TabChild::RecvNotifyTransformBegin(const ViewID& aViewId)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
if (sf) {
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStarted();
}
}
return true;
}
bool
TabChild::RecvNotifyTransformEnd(const ViewID& aViewId)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
if (sf) {
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
}
return true;
}
bool
TabChild::RecvActivate()
{

View File

@ -217,6 +217,8 @@ public:
virtual bool RecvHandleDoubleTap(const CSSIntPoint& aPoint);
virtual bool RecvHandleSingleTap(const CSSIntPoint& aPoint);
virtual bool RecvHandleLongTap(const CSSIntPoint& aPoint);
virtual bool RecvNotifyTransformBegin(const ViewID& aViewId);
virtual bool RecvNotifyTransformEnd(const ViewID& aViewId);
virtual bool RecvActivate();
virtual bool RecvDeactivate();
virtual bool RecvMouseEvent(const nsString& aType,

View File

@ -522,6 +522,20 @@ void TabParent::HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers)
}
}
void TabParent::NotifyTransformBegin(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformBegin(aViewId);
}
}
void TabParent::NotifyTransformEnd(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformEnd(aViewId);
}
}
void
TabParent::Activate()
{

View File

@ -196,6 +196,8 @@ public:
void HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers);
void HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers);
void HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers);
void NotifyTransformBegin(ViewID aViewId);
void NotifyTransformEnd(ViewID aViewId);
void Activate();
void Deactivate();

View File

@ -1647,9 +1647,11 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
if (mGeckoContentController) {
if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformBegin();
mGeckoContentController->NotifyTransformBegin(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId));
} else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformEnd();
mGeckoContentController->NotifyTransformEnd(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId));
}
}
}

View File

@ -81,8 +81,8 @@ public:
* the apzc is modifying the view, including panning, zooming, and
* fling.
*/
virtual void NotifyTransformBegin() {}
virtual void NotifyTransformEnd() {}
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid) {}
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid) {}
GeckoContentController() {}
virtual ~GeckoContentController() {}

View File

@ -615,6 +615,36 @@ public:
return mHaveZoomConstraints;
}
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid)
{
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(
FROM_HERE,
NewRunnableMethod(this, &RemoteContentController::NotifyTransformBegin,
aGuid));
return;
}
if (mRenderFrame) {
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->NotifyTransformBegin(aGuid.mScrollId);
}
}
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid)
{
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(
FROM_HERE,
NewRunnableMethod(this, &RemoteContentController::NotifyTransformEnd,
aGuid));
return;
}
if (mRenderFrame) {
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->NotifyTransformEnd(aGuid.mScrollId);
}
}
private:
void DoRequestContentRepaint(const FrameMetrics& aFrameMetrics)
{

View File

@ -334,7 +334,7 @@ class TransformedEndEvent : public nsRunnable
};
void
APZController::NotifyTransformBegin()
APZController::NotifyTransformBegin(const ScrollableLayerGuid& aGuid)
{
if (NS_IsMainThread()) {
MetroUtils::FireObserver("apzc-transform-begin", L"");
@ -345,7 +345,7 @@ APZController::NotifyTransformBegin()
}
void
APZController::NotifyTransformEnd()
APZController::NotifyTransformEnd(const ScrollableLayerGuid& aGuid)
{
if (NS_IsMainThread()) {
MetroUtils::FireObserver("apzc-transform-end", L"");

View File

@ -37,8 +37,8 @@ public:
virtual void HandleLongTap(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 void NotifyTransformBegin();
virtual void NotifyTransformEnd();
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid);
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid);
void SetWidgetListener(nsIWidgetListener* aWidgetListener);
void UpdateScrollOffset(const mozilla::layers::ScrollableLayerGuid& aScrollLayerId, CSSIntPoint& aScrollOffset);