mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out changeset 9fa5ccaa8c6c (bug 1289650)
This commit is contained in:
parent
0def5edaa6
commit
bf971ed4e5
@ -670,8 +670,9 @@ TabChild::ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId,
|
||||
bool aPreventDefault) const
|
||||
{
|
||||
if (mApzcTreeManager) {
|
||||
mApzcTreeManager->ContentReceivedInputBlock(aInputBlockId, aPreventDefault);
|
||||
if (mAPZChild) {
|
||||
mAPZChild->SendContentReceivedInputBlock(aGuid, aInputBlockId,
|
||||
aPreventDefault);
|
||||
}
|
||||
}
|
||||
|
||||
@ -679,8 +680,8 @@ void
|
||||
TabChild::SetTargetAPZC(uint64_t aInputBlockId,
|
||||
const nsTArray<ScrollableLayerGuid>& aTargets) const
|
||||
{
|
||||
if (mApzcTreeManager) {
|
||||
mApzcTreeManager->SetTargetAPZC(aInputBlockId, aTargets);
|
||||
if (mAPZChild) {
|
||||
mAPZChild->SendSetTargetAPZC(aInputBlockId, aTargets);
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,8 +689,8 @@ void
|
||||
TabChild::SetAllowedTouchBehavior(uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags>& aTargets) const
|
||||
{
|
||||
if (mApzcTreeManager) {
|
||||
mApzcTreeManager->SetAllowedTouchBehavior(aInputBlockId, aTargets);
|
||||
if (mAPZChild) {
|
||||
mAPZChild->SendSetAllowedTouchBehavior(aInputBlockId, aTargets);
|
||||
}
|
||||
}
|
||||
|
||||
@ -705,14 +706,12 @@ TabChild::DoUpdateZoomConstraints(const uint32_t& aPresShellId,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mApzcTreeManager) {
|
||||
if (!mAPZChild) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ScrollableLayerGuid guid = ScrollableLayerGuid(mLayersId, aPresShellId, aViewId);
|
||||
|
||||
mApzcTreeManager->UpdateZoomConstraints(guid, aConstraints);
|
||||
return true;
|
||||
return mAPZChild->SendUpdateZoomConstraints(aPresShellId, aViewId,
|
||||
aConstraints);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1705,10 +1704,10 @@ TabChild::HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers,
|
||||
uint32_t presShellId;
|
||||
ViewID viewId;
|
||||
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
|
||||
document->GetDocumentElement(), &presShellId, &viewId) && mApzcTreeManager) {
|
||||
ScrollableLayerGuid guid(mLayersId, presShellId, viewId);
|
||||
|
||||
mApzcTreeManager->ZoomToRect(guid, zoomToRect, DEFAULT_BEHAVIOR);
|
||||
document->GetDocumentElement(), &presShellId, &viewId) &&
|
||||
mAPZChild) {
|
||||
mAPZChild->SendZoomToRect(presShellId, viewId, zoomToRect,
|
||||
DEFAULT_BEHAVIOR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1777,11 +1776,8 @@ TabChild::NotifyAPZStateChange(const ViewID& aViewId,
|
||||
void
|
||||
TabChild::StartScrollbarDrag(const layers::AsyncDragMetrics& aDragMetrics)
|
||||
{
|
||||
ScrollableLayerGuid guid(mLayersId, aDragMetrics.mPresShellId,
|
||||
aDragMetrics.mViewId);
|
||||
|
||||
if (mApzcTreeManager) {
|
||||
mApzcTreeManager->StartScrollbarDrag(guid, aDragMetrics);
|
||||
if (mAPZChild) {
|
||||
mAPZChild->SendStartScrollbarDrag(aDragMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1791,10 +1787,8 @@ TabChild::ZoomToRect(const uint32_t& aPresShellId,
|
||||
const CSSRect& aRect,
|
||||
const uint32_t& aFlags)
|
||||
{
|
||||
ScrollableLayerGuid guid(mLayersId, aPresShellId, aViewId);
|
||||
|
||||
if (mApzcTreeManager) {
|
||||
mApzcTreeManager->ZoomToRect(guid, aRect, aFlags);
|
||||
if (mAPZChild) {
|
||||
mAPZChild->SendZoomToRect(aPresShellId, aViewId, aRect, aFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2758,8 +2752,6 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
|
||||
mLayersId = aLayersId;
|
||||
}
|
||||
|
||||
mApzcTreeManager = CompositorBridgeChild::Get()->GetAPZCTreeManager(mLayersId);
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
|
||||
|
@ -51,7 +51,6 @@ namespace layers {
|
||||
class APZChild;
|
||||
class APZEventState;
|
||||
class AsyncDragMetrics;
|
||||
class IAPZCTreeManager;
|
||||
class ImageCompositeNotification;
|
||||
} // namespace layers
|
||||
|
||||
@ -775,7 +774,6 @@ private:
|
||||
|
||||
AutoTArray<bool, NUMBER_OF_AUDIO_CHANNELS> mAudioChannelsActive;
|
||||
|
||||
RefPtr<layers::IAPZCTreeManager> mApzcTreeManager;
|
||||
// APZChild clears this pointer from its destructor, so it shouldn't be a
|
||||
// dangling pointer.
|
||||
layers::APZChild* mAPZChild;
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
virtual void SetScrollingRootContent(bool isRootContent) {}
|
||||
|
||||
GeckoContentController() {}
|
||||
|
||||
virtual void ChildAdopted() {}
|
||||
/**
|
||||
* Needs to be called on the main thread.
|
||||
*/
|
||||
|
@ -19,13 +19,6 @@ APZCTreeManagerParent::APZCTreeManagerParent(uint64_t aLayersId, RefPtr<APZCTree
|
||||
MOZ_ASSERT(aAPZCTreeManager != nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManagerParent::ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager)
|
||||
{
|
||||
MOZ_ASSERT(aAPZCTreeManager != nullptr);
|
||||
mTreeManager = aAPZCTreeManager;
|
||||
}
|
||||
|
||||
bool
|
||||
APZCTreeManagerParent::RecvReceiveMultiTouchInputEvent(
|
||||
const MultiTouchInput& aEvent,
|
||||
@ -161,12 +154,7 @@ APZCTreeManagerParent::RecvContentReceivedInputBlock(
|
||||
const uint64_t& aInputBlockId,
|
||||
const bool& aPreventDefault)
|
||||
{
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<uint64_t, bool>(mTreeManager,
|
||||
&IAPZCTreeManager::ContentReceivedInputBlock,
|
||||
aInputBlockId,
|
||||
aPreventDefault));
|
||||
|
||||
mTreeManager->ContentReceivedInputBlock(aInputBlockId, aPreventDefault);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -183,14 +171,7 @@ APZCTreeManagerParent::RecvSetTargetAPZC(
|
||||
}
|
||||
}
|
||||
|
||||
void (IAPZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||
= &IAPZCTreeManager::SetTargetAPZC;
|
||||
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>
|
||||
(mTreeManager, setTargetApzcFunc, aInputBlockId, aTargets));
|
||||
|
||||
mTreeManager->SetTargetAPZC(aInputBlockId, aTargets);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -241,13 +222,7 @@ APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
|
||||
const uint64_t& aInputBlockId,
|
||||
nsTArray<TouchBehaviorFlags>&& aValues)
|
||||
{
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByRRef<nsTArray<TouchBehaviorFlags>>>
|
||||
(mTreeManager,
|
||||
&IAPZCTreeManager::SetAllowedTouchBehavior,
|
||||
aInputBlockId, Move(aValues)));
|
||||
|
||||
mTreeManager->SetAllowedTouchBehavior(aInputBlockId, aValues);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -262,12 +237,7 @@ APZCTreeManagerParent::RecvStartScrollbarDrag(
|
||||
return false;
|
||||
}
|
||||
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, AsyncDragMetrics>(
|
||||
mTreeManager,
|
||||
&IAPZCTreeManager::StartScrollbarDrag,
|
||||
aGuid, aDragMetrics));
|
||||
|
||||
mTreeManager->StartScrollbarDrag(aGuid, aDragMetrics);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -22,14 +22,6 @@ public:
|
||||
explicit APZCTreeManagerParent(uint64_t aLayersId, RefPtr<APZCTreeManager> aAPZCTreeManager);
|
||||
virtual ~APZCTreeManagerParent() { }
|
||||
|
||||
uint64_t LayersId() const { return mLayersId; }
|
||||
|
||||
/**
|
||||
* Called when the layer tree that this protocol is connected to
|
||||
* is adopted by another compositor, and we need to switch APZCTreeManagers.
|
||||
*/
|
||||
void ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager);
|
||||
|
||||
bool
|
||||
RecvReceiveMultiTouchInputEvent(
|
||||
const MultiTouchInput& aEvent,
|
||||
|
@ -94,7 +94,7 @@ APZChild::~APZChild()
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvRequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||
APZChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
|
||||
{
|
||||
return mBrowser->UpdateFrame(aFrameMetrics);
|
||||
}
|
||||
|
@ -26,25 +26,25 @@ public:
|
||||
|
||||
~APZChild();
|
||||
|
||||
virtual bool RecvUpdateFrame(const FrameMetrics& frame) override;
|
||||
|
||||
virtual bool RecvHandleTap(const TapType& aType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const bool& aCallTakeFocusForClickFromTap) override;
|
||||
|
||||
virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||
const APZStateChange& aChange,
|
||||
const int& aArg) override;
|
||||
|
||||
virtual bool RecvNotifyFlushComplete() override;
|
||||
|
||||
virtual bool RecvDestroy() override;
|
||||
|
||||
void SetBrowser(dom::TabChild* aBrowser);
|
||||
|
||||
bool RecvRequestContentRepaint(const FrameMetrics& frame) override;
|
||||
|
||||
bool RecvHandleTap(const TapType& aType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const bool& aCallTakeFocusForClickFromTap) override;
|
||||
|
||||
bool RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||
const APZStateChange& aChange,
|
||||
const int& aArg) override;
|
||||
|
||||
bool RecvNotifyFlushComplete() override;
|
||||
|
||||
bool RecvDestroy() override;
|
||||
|
||||
private:
|
||||
APZChild();
|
||||
|
||||
|
@ -104,8 +104,7 @@ using base::ProcessId;
|
||||
using base::Thread;
|
||||
|
||||
CompositorBridgeParent::LayerTreeState::LayerTreeState()
|
||||
: mApzcTreeManagerParent(nullptr)
|
||||
, mParent(nullptr)
|
||||
: mParent(nullptr)
|
||||
, mLayerManager(nullptr)
|
||||
, mCrossProcessParent(nullptr)
|
||||
, mLayerTree(nullptr)
|
||||
@ -1802,7 +1801,7 @@ CompositorBridgeParent::UpdateRemoteContentController(uint64_t aLayersId,
|
||||
bool
|
||||
CompositorBridgeParent::RecvAdoptChild(const uint64_t& child)
|
||||
{
|
||||
APZCTreeManagerParent* parent;
|
||||
RefPtr<GeckoContentController> controller;
|
||||
{
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
NotifyChildCreated(child);
|
||||
@ -1812,11 +1811,14 @@ CompositorBridgeParent::RecvAdoptChild(const uint64_t& child)
|
||||
if (sIndirectLayerTrees[child].mRoot) {
|
||||
sIndirectLayerTrees[child].mRoot->AsLayerComposite()->SetLayerManager(mLayerManager);
|
||||
}
|
||||
parent = sIndirectLayerTrees[child].mApzcTreeManagerParent;
|
||||
controller = sIndirectLayerTrees[child].mController;
|
||||
}
|
||||
|
||||
if (mApzcTreeManager && parent) {
|
||||
parent->ChildAdopted(mApzcTreeManager);
|
||||
// Calling ChildAdopted on controller will acquire a lock, to avoid a
|
||||
// potential deadlock between that lock and sIndirectLayerTreesLock we
|
||||
// release sIndirectLayerTreesLock first before calling ChildAdopted.
|
||||
if (mApzcTreeManager && controller) {
|
||||
controller->ChildAdopted();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2559,27 +2561,14 @@ CrossProcessCompositorBridgeParent::AllocPAPZCTreeManagerParent(const uint64_t&
|
||||
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
CompositorBridgeParent::LayerTreeState& state = sIndirectLayerTrees[aLayersId];
|
||||
MOZ_ASSERT(state.mParent);
|
||||
MOZ_ASSERT(!state.mApzcTreeManagerParent);
|
||||
state.mApzcTreeManagerParent = new APZCTreeManagerParent(aLayersId, state.mParent->GetAPZCTreeManager());
|
||||
|
||||
return state.mApzcTreeManagerParent;
|
||||
MOZ_ASSERT(state.mParent);
|
||||
return new APZCTreeManagerParent(aLayersId, state.mParent->GetAPZCTreeManager());
|
||||
}
|
||||
bool
|
||||
CrossProcessCompositorBridgeParent::DeallocPAPZCTreeManagerParent(PAPZCTreeManagerParent* aActor)
|
||||
{
|
||||
APZCTreeManagerParent* parent = static_cast<APZCTreeManagerParent*>(aActor);
|
||||
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
auto iter = sIndirectLayerTrees.find(parent->LayersId());
|
||||
if (iter != sIndirectLayerTrees.end()) {
|
||||
CompositorBridgeParent::LayerTreeState& state = iter->second;
|
||||
MOZ_ASSERT(state.mApzcTreeManagerParent == parent);
|
||||
state.mApzcTreeManagerParent = nullptr;
|
||||
}
|
||||
|
||||
delete parent;
|
||||
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ class Shmem;
|
||||
namespace layers {
|
||||
|
||||
class APZCTreeManager;
|
||||
class APZCTreeManagerParent;
|
||||
class AsyncCompositionManager;
|
||||
class Compositor;
|
||||
class CompositorBridgeParent;
|
||||
@ -430,7 +429,6 @@ public:
|
||||
~LayerTreeState();
|
||||
RefPtr<Layer> mRoot;
|
||||
RefPtr<GeckoContentController> mController;
|
||||
APZCTreeManagerParent* mApzcTreeManagerParent;
|
||||
CompositorBridgeParent* mParent;
|
||||
LayerManagerComposite* mLayerManager;
|
||||
// Pointer to the CrossProcessCompositorBridgeParent. Used by APZCs to share
|
||||
|
@ -42,23 +42,63 @@ sync protocol PAPZ
|
||||
manager PContent;
|
||||
|
||||
parent:
|
||||
|
||||
async UpdateHitRegion(nsRegion aRegion);
|
||||
|
||||
/**
|
||||
* Instructs the TabParent to forward a request to zoom to a rect given in
|
||||
* CSS pixels. This rect is relative to the document.
|
||||
*/
|
||||
async ZoomToRect(uint32_t aPresShellId, ViewID aViewId, CSSRect aRect, uint32_t aFlags);
|
||||
|
||||
/**
|
||||
* We know for sure that content has either preventDefaulted or not
|
||||
* preventDefaulted. This applies to an entire batch of touch events. It is
|
||||
* expected that, if there are any DOM touch listeners, touch events will be
|
||||
* batched and only processed for panning and zooming if content does not
|
||||
* preventDefault.
|
||||
*/
|
||||
async ContentReceivedInputBlock(ScrollableLayerGuid aGuid, uint64_t aInputBlockId, bool aPreventDefault);
|
||||
|
||||
/**
|
||||
* Notifies the APZ code of the results of the gecko hit-test for a
|
||||
* particular input block. Each target corresponds to one touch point in the
|
||||
* touch event.
|
||||
*/
|
||||
async SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
|
||||
|
||||
// Start an APZ drag on a scrollbar
|
||||
async StartScrollbarDrag(AsyncDragMetrics aDragMetrics);
|
||||
|
||||
/**
|
||||
* Notifies the APZ code of the allowed touch-behaviours for a particular
|
||||
* input block. Each item in the aFlags array corresponds to one touch point
|
||||
* in the touch event.
|
||||
*/
|
||||
async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aFlags);
|
||||
|
||||
/**
|
||||
* Updates the zoom constraints for a scrollable frame in this tab.
|
||||
* The zoom controller code lives on the parent side and so this allows it to
|
||||
* have up-to-date zoom constraints.
|
||||
*/
|
||||
async UpdateZoomConstraints(uint32_t aPresShellId, ViewID aViewId,
|
||||
MaybeZoomConstraints aConstraints);
|
||||
|
||||
async __delete__();
|
||||
|
||||
child:
|
||||
async RequestContentRepaint(FrameMetrics frame);
|
||||
async UpdateFrame(FrameMetrics frame);
|
||||
|
||||
// The following methods correspond to functions on the GeckoContentController
|
||||
// interface in gfx/layers/apz/public/GeckoContentController.h. Refer to documentation
|
||||
// in that file for these functions.
|
||||
// The aCallTakeFocusForClickFromTap argument is used for eSingleTap types,
|
||||
// to request that the child take focus before dispatching the mouse events
|
||||
// for the tap (otherwise the resulting focus behaviour is incorrect).
|
||||
async HandleTap(TapType aType, LayoutDevicePoint point, Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
bool aCallTakeFocusForClickFromTap);
|
||||
|
||||
async NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
|
||||
|
||||
async NotifyFlushComplete();
|
||||
|
||||
async Destroy();
|
||||
|
@ -40,34 +40,6 @@ manager PCompositorBridge;
|
||||
|
||||
parent:
|
||||
|
||||
// These messages correspond to the methods
|
||||
// on the IAPZCTreeManager interface
|
||||
|
||||
async ZoomToRect(ScrollableLayerGuid aGuid, CSSRect aRect, uint32_t Flags);
|
||||
|
||||
async ContentReceivedInputBlock(uint64_t aInputBlockId, bool PreventDefault);
|
||||
|
||||
async SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] Targets);
|
||||
|
||||
async UpdateZoomConstraints(ScrollableLayerGuid aGuid, MaybeZoomConstraints aConstraints);
|
||||
|
||||
async CancelAnimation(ScrollableLayerGuid aGuid);
|
||||
|
||||
async AdjustScrollForSurfaceShift(ScreenPoint aShift);
|
||||
|
||||
async SetDPI(float aDpiValue);
|
||||
|
||||
async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aValues);
|
||||
|
||||
async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
|
||||
|
||||
async SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
|
||||
async ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY);
|
||||
|
||||
// The following messages are used to
|
||||
// implement the ReceiveInputEvent methods
|
||||
|
||||
sync ReceiveMultiTouchInputEvent(MultiTouchInput aEvent)
|
||||
returns (nsEventStatus aOutStatus,
|
||||
MultiTouchInput aOutEvent,
|
||||
@ -104,6 +76,28 @@ parent:
|
||||
ScrollableLayerGuid aOutTargetGuid,
|
||||
uint64_t aOutInputBlockId);
|
||||
|
||||
async ZoomToRect(ScrollableLayerGuid aGuid, CSSRect aRect, uint32_t Flags);
|
||||
|
||||
async ContentReceivedInputBlock(uint64_t aInputBlockId, bool PreventDefault);
|
||||
|
||||
async SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] Targets);
|
||||
|
||||
async UpdateZoomConstraints(ScrollableLayerGuid aGuid, MaybeZoomConstraints aConstraints);
|
||||
|
||||
async CancelAnimation(ScrollableLayerGuid aGuid);
|
||||
|
||||
async AdjustScrollForSurfaceShift(ScreenPoint aShift);
|
||||
|
||||
async SetDPI(float aDpiValue);
|
||||
|
||||
async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aValues);
|
||||
|
||||
async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
|
||||
|
||||
async SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
|
||||
async ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY);
|
||||
|
||||
async UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint, EventMessage aEventMessage);
|
||||
|
||||
sync TransformEventRefPoint(LayoutDeviceIntPoint aRefPoint)
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layout/RenderFrameParent.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
@ -47,7 +48,7 @@ RemoteContentController::RequestContentRepaint(const FrameMetrics& aFrameMetrics
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (CanSend()) {
|
||||
Unused << SendRequestContentRepaint(aFrameMetrics);
|
||||
Unused << SendUpdateFrame(aFrameMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,9 +162,113 @@ RemoteContentController::RecvUpdateHitRegion(const nsRegion& aRegion)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteContentController::RecvZoomToRect(const uint32_t& aPresShellId,
|
||||
const ViewID& aViewId,
|
||||
const CSSRect& aRect,
|
||||
const uint32_t& aFlags)
|
||||
{
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
apzcTreeManager->ZoomToRect(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId),
|
||||
aRect, aFlags);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteContentController::RecvContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const bool& aPreventDefault)
|
||||
{
|
||||
if (aGuid.mLayersId != mLayersId) {
|
||||
// Guard against bad data from hijacked child processes
|
||||
NS_ERROR("Unexpected layers id in RecvContentReceivedInputBlock; dropping message...");
|
||||
return false;
|
||||
}
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<uint64_t,
|
||||
bool>(apzcTreeManager,
|
||||
&IAPZCTreeManager::ContentReceivedInputBlock,
|
||||
aInputBlockId, aPreventDefault));
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteContentController::RecvStartScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
|
||||
{
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
ScrollableLayerGuid guid(mLayersId, aDragMetrics.mPresShellId,
|
||||
aDragMetrics.mViewId);
|
||||
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<ScrollableLayerGuid,
|
||||
AsyncDragMetrics>(apzcTreeManager,
|
||||
&IAPZCTreeManager::StartScrollbarDrag,
|
||||
guid, aDragMetrics));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteContentController::RecvSetTargetAPZC(const uint64_t& aInputBlockId,
|
||||
nsTArray<ScrollableLayerGuid>&& aTargets)
|
||||
{
|
||||
for (size_t i = 0; i < aTargets.Length(); i++) {
|
||||
if (aTargets[i].mLayersId != mLayersId) {
|
||||
// Guard against bad data from hijacked child processes
|
||||
NS_ERROR("Unexpected layers id in SetTargetAPZC; dropping message...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
// need a local var to disambiguate between the SetTargetAPZC overloads.
|
||||
void (IAPZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||
= &IAPZCTreeManager::SetTargetAPZC;
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>
|
||||
(apzcTreeManager, setTargetApzcFunc, aInputBlockId, aTargets));
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteContentController::RecvSetAllowedTouchBehavior(const uint64_t& aInputBlockId,
|
||||
nsTArray<TouchBehaviorFlags>&& aFlags)
|
||||
{
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByRRef<nsTArray<TouchBehaviorFlags>>>
|
||||
(apzcTreeManager,
|
||||
&IAPZCTreeManager::SetAllowedTouchBehavior,
|
||||
aInputBlockId, Move(aFlags)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteContentController::RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
|
||||
const ViewID& aViewId,
|
||||
const MaybeZoomConstraints& aConstraints)
|
||||
{
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
apzcTreeManager->UpdateZoomConstraints(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId),
|
||||
aConstraints);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mApzcTreeManager = nullptr;
|
||||
}
|
||||
mBrowserParent = nullptr;
|
||||
|
||||
uint64_t key = mLayersId;
|
||||
@ -193,5 +298,28 @@ RemoteContentController::Destroy()
|
||||
}));
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::ChildAdopted()
|
||||
{
|
||||
// Clear the cached APZCTreeManager.
|
||||
MutexAutoLock lock(mMutex);
|
||||
mApzcTreeManager = nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<IAPZCTreeManager>
|
||||
RemoteContentController::GetApzcTreeManager()
|
||||
{
|
||||
// We can't get a ref to the APZCTreeManager until after the child is
|
||||
// created and the static getter knows which CompositorBridgeParent is
|
||||
// instantiated with this layers ID. That's why try to fetch it when
|
||||
// we first need it and cache the result.
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (!mApzcTreeManager) {
|
||||
mApzcTreeManager = GPUProcessManager::Get()->GetAPZCTreeManagerForLayers(mLayersId);
|
||||
}
|
||||
RefPtr<IAPZCTreeManager> apzcTreeManager(mApzcTreeManager);
|
||||
return apzcTreeManager.forget();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
@ -19,6 +19,8 @@ class TabParent;
|
||||
|
||||
namespace layers {
|
||||
|
||||
class IAPZCTreeManager;
|
||||
|
||||
/**
|
||||
* RemoteContentController uses the PAPZ protocol to implement a
|
||||
* GeckoContentController for a browser living in a remote process.
|
||||
@ -63,16 +65,40 @@ public:
|
||||
|
||||
virtual bool RecvUpdateHitRegion(const nsRegion& aRegion) override;
|
||||
|
||||
virtual bool RecvZoomToRect(const uint32_t& aPresShellId,
|
||||
const ViewID& aViewId,
|
||||
const CSSRect& aRect,
|
||||
const uint32_t& aFlags) override;
|
||||
|
||||
virtual bool RecvContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const bool& aPreventDefault) override;
|
||||
|
||||
virtual bool RecvStartScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
|
||||
|
||||
virtual bool RecvSetTargetAPZC(const uint64_t& aInputBlockId,
|
||||
nsTArray<ScrollableLayerGuid>&& aTargets) override;
|
||||
|
||||
virtual bool RecvSetAllowedTouchBehavior(const uint64_t& aInputBlockId,
|
||||
nsTArray<TouchBehaviorFlags>&& aFlags) override;
|
||||
|
||||
virtual bool RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
|
||||
const ViewID& aViewId,
|
||||
const MaybeZoomConstraints& aConstraints) override;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
virtual void Destroy() override;
|
||||
|
||||
virtual void ChildAdopted() override;
|
||||
|
||||
private:
|
||||
bool CanSend()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return !!mBrowserParent;
|
||||
}
|
||||
already_AddRefed<IAPZCTreeManager> GetApzcTreeManager();
|
||||
|
||||
MessageLoop* mUILoop;
|
||||
uint64_t mLayersId;
|
||||
@ -80,6 +106,8 @@ private:
|
||||
|
||||
// Mutex protecting members below accessed from multiple threads.
|
||||
mozilla::Mutex mMutex;
|
||||
|
||||
RefPtr<IAPZCTreeManager> mApzcTreeManager;
|
||||
nsRegion mTouchSensitiveRegion;
|
||||
};
|
||||
|
||||
|
@ -9285,7 +9285,7 @@ nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages() {
|
||||
mozilla::dom::ContentChild::GetSingleton()->GetIPCChannel()) {
|
||||
mozilla::dom::ContentChild::GetSingleton()->GetIPCChannel()->PeekMessages(
|
||||
[](const IPC::Message& aMsg) -> bool {
|
||||
if (aMsg.type() == mozilla::layers::PAPZ::Msg_RequestContentRepaint__ID) {
|
||||
if (aMsg.type() == mozilla::layers::PAPZ::Msg_UpdateFrame__ID) {
|
||||
PickleIterator iter(aMsg);
|
||||
FrameMetrics frame;
|
||||
if (!IPC::ReadParam(&aMsg, &iter, &frame)) {
|
||||
|
@ -24,6 +24,7 @@ namespace mozilla {
|
||||
class InputEvent;
|
||||
|
||||
namespace layers {
|
||||
class APZCTreeManager;
|
||||
class AsyncDragMetrics;
|
||||
class TargetConfig;
|
||||
struct TextureFactoryIdentifier;
|
||||
|
Loading…
Reference in New Issue
Block a user