Backed out changeset d5c38470ac06 (bug 976605)

This commit is contained in:
Ed Morley 2014-04-15 17:45:48 +01:00
parent fde27487df
commit c46be2513f
11 changed files with 79 additions and 115 deletions

View File

@ -50,7 +50,6 @@ using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/Comp
using mozilla::CSSPoint from "Units.h";
using mozilla::CSSToScreenScale from "Units.h";
using mozilla::CommandInt from "mozilla/EventForwards.h";
using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h";
namespace mozilla {
namespace dom {
@ -411,10 +410,11 @@ child:
HandleLongTapUp(CSSPoint point, ScrollableLayerGuid aGuid);
/**
* Notifies the child about various APZ state changes.
* See GeckoContentController::NotifyAPZStateChange() for details.
* Notifies the child that the parent has begun or finished transforming
* the visible child content area. Useful for showing/hiding scrollbars.
*/
NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
NotifyTransformBegin(ViewID aViewId);
NotifyTransformEnd(ViewID aViewId);
/**
* Sending an activate message moves focus to the child.

View File

@ -1730,34 +1730,23 @@ TabChild::RecvHandleLongTapUp(const CSSPoint& aPoint, const ScrollableLayerGuid&
}
bool
TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
const APZStateChange& aChange,
const int& aArg)
TabChild::RecvNotifyTransformBegin(const ViewID& aViewId)
{
switch (aChange)
{
case APZStateChange::TransformBegin:
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStarted();
}
break;
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStarted();
}
case APZStateChange::TransformEnd:
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
break;
}
default:
// APZStateChange has a 'sentinel' value, and the compiler complains
// if an enumerator is not handled and there is no 'default' case.
break;
return true;
}
bool
TabChild::RecvNotifyTransformEnd(const ViewID& aViewId)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
return true;
}

View File

@ -296,9 +296,8 @@ public:
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvHandleLongTapUp(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId,
const APZStateChange& aChange,
const int& aArg) MOZ_OVERRIDE;
virtual bool RecvNotifyTransformBegin(const ViewID& aViewId) MOZ_OVERRIDE;
virtual bool RecvNotifyTransformEnd(const ViewID& aViewId) MOZ_OVERRIDE;
virtual bool RecvActivate() MOZ_OVERRIDE;
virtual bool RecvDeactivate() MOZ_OVERRIDE;
virtual bool RecvMouseEvent(const nsString& aType,

View File

@ -554,12 +554,17 @@ void TabParent::HandleLongTapUp(const CSSPoint& aPoint,
}
}
void TabParent::NotifyAPZStateChange(ViewID aViewId,
APZStateChange aChange,
int aArg)
void TabParent::NotifyTransformBegin(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyAPZStateChange(aViewId, aChange, aArg);
unused << SendNotifyTransformBegin(aViewId);
}
}
void TabParent::NotifyTransformEnd(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformEnd(aViewId);
}
}

View File

@ -212,9 +212,8 @@ public:
void HandleLongTapUp(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid);
void NotifyAPZStateChange(ViewID aViewId,
APZStateChange aChange,
int aArg);
void NotifyTransformBegin(ViewID aViewId);
void NotifyTransformEnd(ViewID aViewId);
void Activate();
void Deactivate();

View File

@ -26,7 +26,6 @@
#include "mozilla/layers/CompositorTypes.h"
#include "FrameMetrics.h"
#include "FilterSupport.h"
#include "mozilla/layers/GeckoContentController.h"
#ifdef _MSC_VER
#pragma warning( disable : 4800 )
@ -1070,15 +1069,6 @@ struct ParamTraits<mozilla::gfx::FilterDescription>
}
};
typedef mozilla::layers::GeckoContentController::APZStateChange APZStateChange;
template <>
struct ParamTraits<APZStateChange>
: public TypedEnumSerializer<APZStateChange,
APZStateChange::TransformBegin,
APZStateChange::APZStateChangeSentinel>
{};
} /* namespace IPC */
#endif /* __GFXMESSAGEUTILS_H__ */

View File

@ -132,7 +132,6 @@ namespace mozilla {
namespace layers {
typedef mozilla::layers::AllowedTouchBehavior AllowedTouchBehavior;
typedef GeckoContentController::APZStateChange APZStateChange;
/*
* The following prefs are used to control the behaviour of the APZC.
@ -1993,11 +1992,11 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
if (mGeckoContentController) {
if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) {
mGeckoContentController->NotifyAPZStateChange(
GetGuid(), APZStateChange::TransformBegin);
mGeckoContentController->NotifyTransformBegin(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
} else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) {
mGeckoContentController->NotifyAPZStateChange(
GetGuid(), APZStateChange::TransformEnd);
mGeckoContentController->NotifyTransformEnd(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
}
}
}

View File

@ -113,28 +113,13 @@ public:
return false;
}
MOZ_BEGIN_NESTED_ENUM_CLASS(APZStateChange, int8_t)
/**
* APZ started modifying the view (including panning, zooming, and fling).
*/
TransformBegin,
/**
* APZ finished modifying the view.
*/
TransformEnd,
APZStateChangeSentinel
MOZ_END_NESTED_ENUM_CLASS(APZStateChange)
/**
* General notices of APZ state changes for consumers.
* |aGuid| identifies the APZC originating the state change.
* |aChange| identifies the type of state change
* |aArg| is used by some state changes to pass extra information (see
* the documentation for each state change above)
* General tranformation notices for consumers. These fire any time
* the apzc is modifying the view, including panning, zooming, and
* fling.
*/
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg = 0) {}
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid) {}
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid) {}
GeckoContentController() {}
@ -143,8 +128,6 @@ protected:
virtual ~GeckoContentController() {}
};
MOZ_FINISH_NESTED_ENUM_CLASS(GeckoContentController::APZStateChange)
}
}

View File

@ -658,20 +658,33 @@ public:
return true;
}
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg)
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid)
{
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(
FROM_HERE,
NewRunnableMethod(this, &RemoteContentController::NotifyAPZStateChange,
aGuid, aChange, aArg));
NewRunnableMethod(this, &RemoteContentController::NotifyTransformBegin,
aGuid));
return;
}
if (mRenderFrame) {
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->NotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
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);
}
}

View File

@ -303,37 +303,25 @@ class TransformedEndEvent : public nsRunnable
};
void
APZController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg)
APZController::NotifyTransformBegin(const ScrollableLayerGuid& aGuid)
{
switch (aChange) {
case APZStateChange::TransformBegin:
{
if (NS_IsMainThread()) {
MetroUtils::FireObserver("apzc-transform-begin", L"");
return;
}
nsCOMPtr<nsIRunnable> runnable = new TransformedStartEvent();
NS_DispatchToMainThread(runnable);
break;
}
case APZStateChange::TransformEnd:
{
if (NS_IsMainThread()) {
MetroUtils::FireObserver("apzc-transform-end", L"");
return;
}
nsCOMPtr<nsIRunnable> runnable = new TransformedEndEvent();
NS_DispatchToMainThread(runnable);
break;
}
default:
{
// We don't currently care about other state changes.
break;
}
if (NS_IsMainThread()) {
MetroUtils::FireObserver("apzc-transform-begin", L"");
return;
}
nsCOMPtr<nsIRunnable> runnable = new TransformedStartEvent();
NS_DispatchToMainThread(runnable);
}
void
APZController::NotifyTransformEnd(const ScrollableLayerGuid& aGuid)
{
if (NS_IsMainThread()) {
MetroUtils::FireObserver("apzc-transform-end", L"");
return;
}
nsCOMPtr<nsIRunnable> runnable = new TransformedEndEvent();
NS_DispatchToMainThread(runnable);
}
} } }

View File

@ -49,9 +49,8 @@ public:
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 NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg);
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid);
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid);
void SetWidgetListener(nsIWidgetListener* aWidgetListener);