Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats

--HG--
extra : commitid : 87IsjW2NpRX
This commit is contained in:
Benoit Girard 2015-09-28 17:00:25 -04:00
Родитель de3c586402
Коммит 60376c4a70
10 изменённых файлов: 65 добавлений и 0 удалений

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

@ -60,6 +60,7 @@ using mozilla::CommandInt from "mozilla/EventForwards.h";
using mozilla::Modifiers from "mozilla/EventForwards.h";
using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h";
using mozilla::WritingMode from "mozilla/WritingModes.h";
using mozilla::layers::AsyncDragMetrics from "mozilla/layers/AsyncDragMetrics.h";
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
using nsIWidget::TouchPointerState from "nsIWidget.h";
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
@ -545,6 +546,9 @@ parent:
prio(high) sync DispatchMouseEvent(WidgetMouseEvent event);
prio(high) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);
// Start an APZ drag on a scrollbar
async StartScrollbarDrag(AsyncDragMetrics aDragMetrics);
InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
nsCString visualData, uint32_t width, uint32_t height,
uint32_t stride, uint8_t format, int32_t dragAreaX, int32_t dragAreaY);

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

@ -26,6 +26,7 @@
#include "mozilla/IMEStateManager.h"
#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layout/RenderFrameParent.h"
@ -3051,6 +3052,15 @@ TabParent::RecvSetTargetAPZC(const uint64_t& aInputBlockId,
return true;
}
bool
TabParent::RecvStartScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->StartScrollbarDrag(aDragMetrics);
}
return true;
}
bool
TabParent::RecvSetAllowedTouchBehavior(const uint64_t& aInputBlockId,
nsTArray<TouchBehaviorFlags>&& aFlags)

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

@ -44,6 +44,7 @@ class CpowHolder;
} // namespace jsipc
namespace layers {
class AsyncDragMetrics;
struct FrameMetrics;
struct TextureFactoryIdentifier;
} // namespace layers
@ -83,6 +84,7 @@ class TabParent final : public PBrowserParent
, public nsIWebBrowserPersistable
{
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics;
virtual ~TabParent();
@ -243,6 +245,7 @@ public:
virtual bool RecvDispatchWheelEvent(const mozilla::WidgetWheelEvent& aEvent) override;
virtual bool RecvDispatchMouseEvent(const mozilla::WidgetMouseEvent& aEvent) override;
virtual bool RecvDispatchKeyboardEvent(const mozilla::WidgetKeyboardEvent& aEvent) override;
virtual bool RecvStartScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
virtual PColorPickerParent*
AllocPColorPickerParent(const nsString& aTitle, const nsString& aInitialColor) override;

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

@ -597,6 +597,21 @@ RenderFrameParent::HitTest(const nsRect& aRect)
return mTouchRegion.Contains(aRect);
}
void
RenderFrameParent::StartScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
{
if (GetApzcTreeManager()) {
uint64_t layersId = GetLayersId();
ScrollableLayerGuid guid(layersId, aDragMetrics.mPresShellId,
aDragMetrics.mViewId);
APZThreadUtils::RunOnControllerThread(
NewRunnableMethod(GetApzcTreeManager(),
&APZCTreeManager::StartScrollbarDrag,
guid, aDragMetrics));
}
}
void
RenderFrameParent::GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier)
{

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

@ -25,6 +25,7 @@ class InputEvent;
namespace layers {
class APZCTreeManager;
class AsyncDragMetrics;
class TargetConfig;
struct TextureFactoryIdentifier;
struct ScrollableLayerGuid;
@ -36,6 +37,7 @@ class RemoteContentController;
class RenderFrameParent : public PRenderFrameParent
{
typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics;
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ContainerLayer ContainerLayer;
typedef mozilla::layers::Layer Layer;
@ -93,6 +95,8 @@ public:
bool HitTest(const nsRect& aRect);
void StartScrollbarDrag(const AsyncDragMetrics& aDragMetrics);
void GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier);
inline uint64_t GetLayersId() { return mLayersId; }

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

@ -1141,6 +1141,12 @@ uint32_t PuppetWidget::GetMaxTouchPoints() const
return sTouchPoints;
}
void
PuppetWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
{
mTabChild->SendStartScrollbarDrag(aDragMetrics);
}
PuppetScreen::PuppetScreen(void *nativeScreen)
{
}

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

@ -251,6 +251,7 @@ public:
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;
virtual uint32_t GetMaxTouchPoints() const override;
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
protected:
bool mEnabled;
bool mVisible;

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

@ -1674,6 +1674,22 @@ nsBaseWidget::GetRootAccessible()
#endif // ACCESSIBILITY
void
nsBaseWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
{
if (!AsyncPanZoomEnabled()) {
return;
}
MOZ_ASSERT(XRE_IsParentProcess() && mCompositorParent);
int layersId = mCompositorParent->RootLayerTreeId();;
ScrollableLayerGuid guid(layersId, aDragMetrics.mPresShellId, aDragMetrics.mViewId);
APZThreadUtils::RunOnControllerThread(
NewRunnableMethod(mAPZC.get(), &APZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
}
nsIntRect
nsBaseWidget::GetScaledScreenBounds()
{

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

@ -312,6 +312,8 @@ public:
return false;
}
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
/**
* Use this when GetLayerManager() returns a BasicLayerManager
* (nsBaseWidget::GetLayerManager() does). This sets up the widget's

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

@ -49,6 +49,7 @@ namespace plugins {
class PluginWidgetChild;
} // namespace plugins
namespace layers {
class AsyncDragMetrics;
class Composer2D;
class Compositor;
class CompositorChild;
@ -316,6 +317,7 @@ class nsIWidget : public nsISupports {
public:
typedef mozilla::layers::Composer2D Composer2D;
typedef mozilla::layers::CompositorChild CompositorChild;
typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics;
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::layers::LayerManagerComposite LayerManagerComposite;
@ -1676,6 +1678,8 @@ class nsIWidget : public nsISupports {
*/
virtual bool CaptureWidgetOnScreen(mozilla::RefPtr<mozilla::gfx::DrawTarget> aDT) = 0;
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0;
private:
class LongTapInfo
{