Backed out changeset 4bc6e2713327 (bug 1289650)
This commit is contained in:
@@ -48,7 +48,6 @@
|
|||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
#include "mozilla/layers/APZChild.h"
|
#include "mozilla/layers/APZChild.h"
|
||||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||||
#include "mozilla/layers/ContentProcessController.h"
|
|
||||||
#include "mozilla/layers/ImageBridgeChild.h"
|
#include "mozilla/layers/ImageBridgeChild.h"
|
||||||
#include "mozilla/layers/SharedBufferManagerChild.h"
|
#include "mozilla/layers/SharedBufferManagerChild.h"
|
||||||
#include "mozilla/layout/RenderFrameChild.h"
|
#include "mozilla/layout/RenderFrameChild.h"
|
||||||
@@ -1382,7 +1381,7 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
|
|||||||
bool
|
bool
|
||||||
ContentChild::RecvNotifyLayerAllocated(const dom::TabId& aTabId, const uint64_t& aLayersId)
|
ContentChild::RecvNotifyLayerAllocated(const dom::TabId& aTabId, const uint64_t& aLayersId)
|
||||||
{
|
{
|
||||||
APZChild* apz = ContentProcessController::Create(aTabId);
|
APZChild* apz = APZChild::Create(aTabId);
|
||||||
return CompositorBridgeChild::Get()->SendPAPZConstructor(apz, aLayersId);
|
return CompositorBridgeChild::Get()->SendPAPZConstructor(apz, aLayersId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -670,6 +670,11 @@ child:
|
|||||||
int32_t aModifiers,
|
int32_t aModifiers,
|
||||||
bool aPreventDefault);
|
bool aPreventDefault);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APZ notification for mouse scroll testing events.
|
||||||
|
*/
|
||||||
|
async MouseScrollTestEvent(uint64_t aLayersId, ViewID aScrollId, nsString aEvent);
|
||||||
|
|
||||||
async CompositionEvent(WidgetCompositionEvent event);
|
async CompositionEvent(WidgetCompositionEvent event);
|
||||||
|
|
||||||
async SelectionEvent(WidgetSelectionEvent event);
|
async SelectionEvent(WidgetSelectionEvent event);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||||
#include "mozilla/layers/APZCTreeManager.h"
|
#include "mozilla/layers/APZCTreeManager.h"
|
||||||
#include "mozilla/layers/APZEventState.h"
|
#include "mozilla/layers/APZEventState.h"
|
||||||
#include "mozilla/layers/ContentProcessController.h"
|
|
||||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||||
#include "mozilla/layers/DoubleTapToZoom.h"
|
#include "mozilla/layers/DoubleTapToZoom.h"
|
||||||
#include "mozilla/layers/ImageBridgeChild.h"
|
#include "mozilla/layers/ImageBridgeChild.h"
|
||||||
@@ -1939,6 +1938,26 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TabChild::RecvMouseScrollTestEvent(const uint64_t& aLayersId,
|
||||||
|
const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
|
||||||
|
{
|
||||||
|
if (aLayersId != mLayersId) {
|
||||||
|
RefPtr<TabParent> browser = TabParent::GetTabParentFromLayersId(aLayersId);
|
||||||
|
if (!browser) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||||
|
[aLayersId, browser, aScrollId, aEvent] () -> void {
|
||||||
|
Unused << browser->SendMouseScrollTestEvent(aLayersId, aScrollId, aEvent);
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
||||||
const ScrollableLayerGuid& aGuid,
|
const ScrollableLayerGuid& aGuid,
|
||||||
|
|||||||
@@ -388,6 +388,10 @@ public:
|
|||||||
const int32_t& aModifiers,
|
const int32_t& aModifiers,
|
||||||
const bool& aPreventDefault) override;
|
const bool& aPreventDefault) override;
|
||||||
|
|
||||||
|
virtual bool RecvMouseScrollTestEvent(const uint64_t& aLayersId,
|
||||||
|
const FrameMetrics::ViewID& aScrollId,
|
||||||
|
const nsString& aEvent) override;
|
||||||
|
|
||||||
virtual bool RecvNativeSynthesisResponse(const uint64_t& aObserverId,
|
virtual bool RecvNativeSynthesisResponse(const uint64_t& aObserverId,
|
||||||
const nsCString& aResponse) override;
|
const nsCString& aResponse) override;
|
||||||
|
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "ContentProcessController.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/TabChild.h"
|
|
||||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
|
||||||
#include "mozilla/layers/APZChild.h"
|
|
||||||
|
|
||||||
#include "InputData.h" // for InputData
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace layers {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* There are cases where we try to create the APZChild before the corresponding
|
|
||||||
* TabChild has been created, we use an observer for the "tab-child-created"
|
|
||||||
* topic to set the TabChild in the APZChild when it has been created.
|
|
||||||
*/
|
|
||||||
class TabChildCreatedObserver : public nsIObserver
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TabChildCreatedObserver(ContentProcessController* aController, const dom::TabId& aTabId)
|
|
||||||
: mController(aController),
|
|
||||||
mTabId(aTabId)
|
|
||||||
{}
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIOBSERVER
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual ~TabChildCreatedObserver()
|
|
||||||
{}
|
|
||||||
|
|
||||||
// TabChildCreatedObserver is owned by mController, and mController outlives its
|
|
||||||
// TabChildCreatedObserver, so the raw pointer is fine.
|
|
||||||
ContentProcessController* mController;
|
|
||||||
dom::TabId mTabId;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(TabChildCreatedObserver, nsIObserver)
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
TabChildCreatedObserver::Observe(nsISupports* aSubject,
|
|
||||||
const char* aTopic,
|
|
||||||
const char16_t* aData)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(strcmp(aTopic, "tab-child-created") == 0);
|
|
||||||
|
|
||||||
nsCOMPtr<nsITabChild> tabChild(do_QueryInterface(aSubject));
|
|
||||||
NS_ENSURE_TRUE(tabChild, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
dom::TabChild* browser = static_cast<dom::TabChild*>(tabChild.get());
|
|
||||||
|
|
||||||
if (browser->GetTabId() == mTabId) {
|
|
||||||
mController->SetBrowser(browser);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
APZChild*
|
|
||||||
ContentProcessController::Create(const dom::TabId& aTabId)
|
|
||||||
{
|
|
||||||
RefPtr<dom::TabChild> browser = dom::TabChild::FindTabChild(aTabId);
|
|
||||||
|
|
||||||
ContentProcessController* controller = new ContentProcessController();
|
|
||||||
|
|
||||||
nsAutoPtr<APZChild> apz(new APZChild(controller));
|
|
||||||
|
|
||||||
if (browser) {
|
|
||||||
|
|
||||||
controller->SetBrowser(browser);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
RefPtr<TabChildCreatedObserver> observer =
|
|
||||||
new TabChildCreatedObserver(controller, aTabId);
|
|
||||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
|
||||||
if (!os ||
|
|
||||||
NS_FAILED(os->AddObserver(observer, "tab-child-created", false))) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
controller->SetObserver(observer);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return apz.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentProcessController::ContentProcessController()
|
|
||||||
: mBrowser(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
ContentProcessController::~ContentProcessController()
|
|
||||||
{
|
|
||||||
if (mObserver) {
|
|
||||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
|
||||||
os->RemoveObserver(mObserver, "tab-child-created");
|
|
||||||
} else if (mBrowser) {
|
|
||||||
mBrowser->SetAPZChild(nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::SetObserver(nsIObserver* aObserver)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mBrowser);
|
|
||||||
mObserver = aObserver;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::SetBrowser(dom::TabChild* aBrowser)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mBrowser);
|
|
||||||
mBrowser = aBrowser;
|
|
||||||
|
|
||||||
if (mObserver) {
|
|
||||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
|
||||||
os->RemoveObserver(mObserver, "tab-child-created");
|
|
||||||
mObserver = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void
|
|
||||||
ContentProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
|
||||||
{
|
|
||||||
if (mBrowser) {
|
|
||||||
mBrowser->UpdateFrame(aFrameMetrics);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::HandleTap(
|
|
||||||
TapType aType,
|
|
||||||
const LayoutDevicePoint& aPoint,
|
|
||||||
Modifiers aModifiers,
|
|
||||||
const ScrollableLayerGuid& aGuid,
|
|
||||||
uint64_t aInputBlockId)
|
|
||||||
{
|
|
||||||
if (mBrowser) {
|
|
||||||
mBrowser->HandleTap(aType, aPoint - mBrowser->GetChromeDisplacement(), aModifiers, aGuid,
|
|
||||||
aInputBlockId, (aType == TapType::eSingleTap));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::NotifyAPZStateChange(
|
|
||||||
const ScrollableLayerGuid& aGuid,
|
|
||||||
APZStateChange aChange,
|
|
||||||
int aArg)
|
|
||||||
{
|
|
||||||
if (mBrowser) {
|
|
||||||
mBrowser->NotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::NotifyMozMouseScrollEvent(
|
|
||||||
const FrameMetrics::ViewID& aScrollId,
|
|
||||||
const nsString& aEvent)
|
|
||||||
{
|
|
||||||
if (mBrowser) {
|
|
||||||
APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::NotifyFlushComplete()
|
|
||||||
{
|
|
||||||
if (mBrowser) {
|
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
|
||||||
if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
|
|
||||||
shell = doc->GetShell();
|
|
||||||
}
|
|
||||||
APZCCallbackHelper::NotifyFlushComplete(shell.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT_UNREACHABLE("ContentProcessController should only be used remotely.");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ContentProcessController::IsRepaintThread()
|
|
||||||
{
|
|
||||||
return NS_IsMainThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentProcessController::DispatchToRepaintThread(already_AddRefed<Runnable> aTask)
|
|
||||||
{
|
|
||||||
NS_DispatchToMainThread(Move(aTask));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace layers
|
|
||||||
} // namespace mozilla
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef mozilla_layers_ContentProcessController_h
|
|
||||||
#define mozilla_layers_ContentProcessController_h
|
|
||||||
|
|
||||||
#include "mozilla/layers/GeckoContentController.h"
|
|
||||||
|
|
||||||
class nsIObserver;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
|
|
||||||
namespace dom {
|
|
||||||
class TabChild;
|
|
||||||
} // namespace dom
|
|
||||||
|
|
||||||
namespace layers {
|
|
||||||
|
|
||||||
class APZChild;
|
|
||||||
|
|
||||||
class ContentProcessController final
|
|
||||||
: public GeckoContentController
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
~ContentProcessController();
|
|
||||||
|
|
||||||
static APZChild* Create(const dom::TabId& aTabId);
|
|
||||||
|
|
||||||
// ContentProcessController
|
|
||||||
|
|
||||||
void SetBrowser(dom::TabChild* aBrowser);
|
|
||||||
|
|
||||||
// GeckoContentController
|
|
||||||
|
|
||||||
void RequestContentRepaint(const FrameMetrics& frame) override;
|
|
||||||
|
|
||||||
void HandleTap(TapType aType,
|
|
||||||
const LayoutDevicePoint& aPoint,
|
|
||||||
Modifiers aModifiers,
|
|
||||||
const ScrollableLayerGuid& aGuid,
|
|
||||||
uint64_t aInputBlockId) override;
|
|
||||||
|
|
||||||
void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
|
||||||
APZStateChange aChange,
|
|
||||||
int aArg) override;
|
|
||||||
|
|
||||||
void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
|
||||||
const nsString& aEvent) override;
|
|
||||||
|
|
||||||
void NotifyFlushComplete() override;
|
|
||||||
|
|
||||||
void PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs) override;
|
|
||||||
|
|
||||||
bool IsRepaintThread() override;
|
|
||||||
|
|
||||||
void DispatchToRepaintThread(already_AddRefed<Runnable> aTask) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ContentProcessController();
|
|
||||||
|
|
||||||
void SetObserver(nsIObserver* aObserver);
|
|
||||||
|
|
||||||
RefPtr<dom::TabChild> mBrowser;
|
|
||||||
RefPtr<nsIObserver> mObserver;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace layers
|
|
||||||
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_layers_ContentProcessController_h
|
|
||||||
@@ -5,37 +5,98 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/layers/APZChild.h"
|
#include "mozilla/layers/APZChild.h"
|
||||||
#include "mozilla/layers/GeckoContentController.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/TabChild.h"
|
#include "mozilla/dom/TabChild.h"
|
||||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||||
|
|
||||||
#include "InputData.h" // for InputData
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
APZChild::APZChild(RefPtr<GeckoContentController> aController)
|
/**
|
||||||
: mController(aController)
|
* There are cases where we try to create the APZChild before the corresponding
|
||||||
|
* TabChild has been created, we use an observer for the "tab-child-created"
|
||||||
|
* topic to set the TabChild in the APZChild when it has been created.
|
||||||
|
*/
|
||||||
|
class TabChildCreatedObserver : public nsIObserver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TabChildCreatedObserver(APZChild* aAPZChild, const dom::TabId& aTabId)
|
||||||
|
: mAPZChild(aAPZChild),
|
||||||
|
mTabId(aTabId)
|
||||||
|
{}
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual ~TabChildCreatedObserver()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// TabChildCreatedObserver is owned by mAPZChild, and mAPZChild outlives its
|
||||||
|
// TabChildCreatedObserver, so the raw pointer is fine.
|
||||||
|
APZChild* mAPZChild;
|
||||||
|
dom::TabId mTabId;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS(TabChildCreatedObserver, nsIObserver)
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
TabChildCreatedObserver::Observe(nsISupports* aSubject,
|
||||||
|
const char* aTopic,
|
||||||
|
const char16_t* aData)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(strcmp(aTopic, "tab-child-created") == 0);
|
||||||
|
|
||||||
|
nsCOMPtr<nsITabChild> tabChild(do_QueryInterface(aSubject));
|
||||||
|
NS_ENSURE_TRUE(tabChild, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
dom::TabChild* browser = static_cast<dom::TabChild*>(tabChild.get());
|
||||||
|
if (browser->GetTabId() == mTabId) {
|
||||||
|
mAPZChild->SetBrowser(browser);
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
APZChild*
|
||||||
|
APZChild::Create(const dom::TabId& aTabId)
|
||||||
|
{
|
||||||
|
RefPtr<dom::TabChild> browser = dom::TabChild::FindTabChild(aTabId);
|
||||||
|
nsAutoPtr<APZChild> apz(new APZChild);
|
||||||
|
if (browser) {
|
||||||
|
apz->SetBrowser(browser);
|
||||||
|
} else {
|
||||||
|
RefPtr<TabChildCreatedObserver> observer =
|
||||||
|
new TabChildCreatedObserver(apz, aTabId);
|
||||||
|
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||||
|
if (!os ||
|
||||||
|
NS_FAILED(os->AddObserver(observer, "tab-child-created", false))) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
apz->SetObserver(observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return apz.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
APZChild::APZChild()
|
||||||
|
: mDestroyed(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mController);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
APZChild::~APZChild()
|
APZChild::~APZChild()
|
||||||
{
|
{
|
||||||
if (mController) {
|
if (mObserver) {
|
||||||
mController->Destroy();
|
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||||
mController = nullptr;
|
os->RemoveObserver(mObserver, "tab-child-created");
|
||||||
|
} else if (mBrowser) {
|
||||||
|
mBrowser->SetAPZChild(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
APZChild::RecvRequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
APZChild::RecvRequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mController->IsRepaintThread());
|
return mBrowser->UpdateFrame(aFrameMetrics);
|
||||||
|
|
||||||
mController->RequestContentRepaint(aFrameMetrics);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -46,66 +107,77 @@ APZChild::RecvHandleTap(const TapType& aType,
|
|||||||
const uint64_t& aInputBlockId,
|
const uint64_t& aInputBlockId,
|
||||||
const bool& aCallTakeFocusForClickFromTap)
|
const bool& aCallTakeFocusForClickFromTap)
|
||||||
{
|
{
|
||||||
mController->HandleTap(aType, aPoint, aModifiers, aGuid,
|
mBrowser->HandleTap(aType, aPoint - mBrowser->GetChromeDisplacement(), aModifiers, aGuid,
|
||||||
aInputBlockId);
|
aInputBlockId, aCallTakeFocusForClickFromTap);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
APZChild::RecvUpdateOverscrollVelocity(const float& aX, const float& aY, const bool& aIsRootContent)
|
APZChild::RecvNotifyMozMouseScrollEvent(const uint64_t& aLayersId,
|
||||||
{
|
const ViewID& aScrollId,
|
||||||
mController->UpdateOverscrollVelocity(aX, aY, aIsRootContent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
APZChild::RecvUpdateOverscrollOffset(const float& aX, const float& aY, const bool& aIsRootContent)
|
|
||||||
{
|
|
||||||
mController->UpdateOverscrollOffset(aX, aY, aIsRootContent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
APZChild::RecvSetScrollingRootContent(const bool& aIsRootContent)
|
|
||||||
{
|
|
||||||
mController->SetScrollingRootContent(aIsRootContent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
APZChild::RecvNotifyMozMouseScrollEvent(const ViewID& aScrollId,
|
|
||||||
const nsString& aEvent)
|
const nsString& aEvent)
|
||||||
{
|
{
|
||||||
mController->NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
if (mBrowser) {
|
||||||
|
mBrowser->RecvMouseScrollTestEvent(aLayersId, aScrollId, aEvent);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
APZChild::RecvNotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
APZChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||||
const APZStateChange& aChange,
|
const APZStateChange& aChange,
|
||||||
const int& aArg)
|
const int& aArg)
|
||||||
{
|
{
|
||||||
mController->NotifyAPZStateChange(aGuid, aChange, aArg);
|
return mBrowser->NotifyAPZStateChange(aViewId, aChange, aArg);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
APZChild::RecvNotifyFlushComplete()
|
APZChild::RecvNotifyFlushComplete()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mController->IsRepaintThread());
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
|
if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
|
||||||
mController->NotifyFlushComplete();
|
shell = doc->GetShell();
|
||||||
|
}
|
||||||
|
APZCCallbackHelper::NotifyFlushComplete(shell.get());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
APZChild::RecvDestroy()
|
APZChild::RecvDestroy()
|
||||||
{
|
{
|
||||||
// mController->Destroy will be called in the destructor
|
mDestroyed = true;
|
||||||
|
if (mBrowser) {
|
||||||
|
mBrowser->SetAPZChild(nullptr);
|
||||||
|
mBrowser = nullptr;
|
||||||
|
}
|
||||||
PAPZChild::Send__delete__(this);
|
PAPZChild::Send__delete__(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
APZChild::SetObserver(nsIObserver* aObserver)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(!mBrowser);
|
||||||
|
mObserver = aObserver;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
APZChild::SetBrowser(dom::TabChild* aBrowser)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(!mBrowser);
|
||||||
|
if (mObserver) {
|
||||||
|
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||||
|
os->RemoveObserver(mObserver, "tab-child-created");
|
||||||
|
mObserver = nullptr;
|
||||||
|
}
|
||||||
|
// We might get the tab-child-created notification after we receive a
|
||||||
|
// Destroy message from the parent. In that case we don't want to install
|
||||||
|
// ourselves with the browser.
|
||||||
|
if (!mDestroyed) {
|
||||||
|
mBrowser = aBrowser;
|
||||||
|
mBrowser->SetAPZChild(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|||||||
@@ -9,18 +9,25 @@
|
|||||||
|
|
||||||
#include "mozilla/layers/PAPZChild.h"
|
#include "mozilla/layers/PAPZChild.h"
|
||||||
|
|
||||||
|
class nsIObserver;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
namespace layers {
|
namespace dom {
|
||||||
|
class TabChild;
|
||||||
|
} // namespace dom
|
||||||
|
|
||||||
class GeckoContentController;
|
namespace layers {
|
||||||
|
|
||||||
class APZChild final : public PAPZChild
|
class APZChild final : public PAPZChild
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit APZChild(RefPtr<GeckoContentController> aController);
|
static APZChild* Create(const dom::TabId& aTabId);
|
||||||
|
|
||||||
~APZChild();
|
~APZChild();
|
||||||
|
|
||||||
|
void SetBrowser(dom::TabChild* aBrowser);
|
||||||
|
|
||||||
bool RecvRequestContentRepaint(const FrameMetrics& frame) override;
|
bool RecvRequestContentRepaint(const FrameMetrics& frame) override;
|
||||||
|
|
||||||
bool RecvHandleTap(const TapType& aType,
|
bool RecvHandleTap(const TapType& aType,
|
||||||
@@ -30,16 +37,11 @@ public:
|
|||||||
const uint64_t& aInputBlockId,
|
const uint64_t& aInputBlockId,
|
||||||
const bool& aCallTakeFocusForClickFromTap) override;
|
const bool& aCallTakeFocusForClickFromTap) override;
|
||||||
|
|
||||||
bool RecvUpdateOverscrollVelocity(const float& aX, const float& aY, const bool& aIsRootContent) override;
|
bool RecvNotifyMozMouseScrollEvent(const uint64_t& aLayersId,
|
||||||
|
const ViewID& aScrollId,
|
||||||
bool RecvUpdateOverscrollOffset(const float& aX, const float& aY, const bool& aIsRootContent) override;
|
|
||||||
|
|
||||||
bool RecvSetScrollingRootContent(const bool& aIsRootContent) override;
|
|
||||||
|
|
||||||
bool RecvNotifyMozMouseScrollEvent(const ViewID& aScrollId,
|
|
||||||
const nsString& aEvent) override;
|
const nsString& aEvent) override;
|
||||||
|
|
||||||
bool RecvNotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
bool RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||||
const APZStateChange& aChange,
|
const APZStateChange& aChange,
|
||||||
const int& aArg) override;
|
const int& aArg) override;
|
||||||
|
|
||||||
@@ -48,7 +50,13 @@ public:
|
|||||||
bool RecvDestroy() override;
|
bool RecvDestroy() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<GeckoContentController> mController;
|
APZChild();
|
||||||
|
|
||||||
|
void SetObserver(nsIObserver* aObserver);
|
||||||
|
|
||||||
|
RefPtr<dom::TabChild> mBrowser;
|
||||||
|
RefPtr<nsIObserver> mObserver;
|
||||||
|
bool mDestroyed;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
|
|||||||
@@ -2584,7 +2584,7 @@ CrossProcessCompositorBridgeParent::AllocPAPZParent(const uint64_t& aLayersId)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteContentController* controller = new RemoteContentController();
|
RemoteContentController* controller = new RemoteContentController(aLayersId);
|
||||||
|
|
||||||
// Increment the controller's refcount before we return it. This will keep the
|
// Increment the controller's refcount before we return it. This will keep the
|
||||||
// controller alive until it is released by IPDL in DeallocPAPZParent.
|
// controller alive until it is released by IPDL in DeallocPAPZParent.
|
||||||
|
|||||||
@@ -57,15 +57,9 @@ child:
|
|||||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||||
bool aCallTakeFocusForClickFromTap);
|
bool aCallTakeFocusForClickFromTap);
|
||||||
|
|
||||||
async UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent);
|
async NotifyMozMouseScrollEvent(uint64_t aLayersId, ViewID aScrollId, nsString aEvent);
|
||||||
|
|
||||||
async UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent);
|
async NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
|
||||||
|
|
||||||
async SetScrollingRootContent(bool aIsRootContent);
|
|
||||||
|
|
||||||
async NotifyMozMouseScrollEvent(ViewID aScrollId, nsString aEvent);
|
|
||||||
|
|
||||||
async NotifyAPZStateChange(ScrollableLayerGuid aGuid, APZStateChange aChange, int aArg);
|
|
||||||
|
|
||||||
async NotifyFlushComplete();
|
async NotifyFlushComplete();
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ namespace layers {
|
|||||||
|
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
RemoteContentController::RemoteContentController()
|
RemoteContentController::RemoteContentController(uint64_t aLayersId)
|
||||||
: mCompositorThread(MessageLoop::current())
|
: mCompositorThread(MessageLoop::current())
|
||||||
|
, mLayersId(aLayersId)
|
||||||
, mCanSend(true)
|
, mCanSend(true)
|
||||||
, mMutex("RemoteContentController")
|
, mMutex("RemoteContentController")
|
||||||
{
|
{
|
||||||
@@ -123,48 +124,10 @@ RemoteContentController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mCanSend) {
|
if (mCanSend) {
|
||||||
Unused << SendNotifyAPZStateChange(aGuid, aChange, aArg);
|
Unused << SendNotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RemoteContentController::UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent)
|
|
||||||
{
|
|
||||||
if (MessageLoop::current() != mCompositorThread) {
|
|
||||||
mCompositorThread->PostTask(NewRunnableMethod<float,
|
|
||||||
float, bool>(this,
|
|
||||||
&RemoteContentController::UpdateOverscrollVelocity,
|
|
||||||
aX, aY, aIsRootContent));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Unused << SendUpdateOverscrollVelocity(aX, aY, aIsRootContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
RemoteContentController::UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent)
|
|
||||||
{
|
|
||||||
if (MessageLoop::current() != mCompositorThread) {
|
|
||||||
mCompositorThread->PostTask(NewRunnableMethod<float,
|
|
||||||
float, bool>(this,
|
|
||||||
&RemoteContentController::UpdateOverscrollOffset,
|
|
||||||
aX, aY, aIsRootContent));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Unused << SendUpdateOverscrollOffset(aX, aY, aIsRootContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
RemoteContentController::SetScrollingRootContent(bool aIsRootContent)
|
|
||||||
{
|
|
||||||
if (MessageLoop::current() != mCompositorThread) {
|
|
||||||
mCompositorThread->PostTask(NewRunnableMethod<bool>(this,
|
|
||||||
&RemoteContentController::SetScrollingRootContent,
|
|
||||||
aIsRootContent));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Unused << SendSetScrollingRootContent(aIsRootContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
||||||
const nsString& aEvent)
|
const nsString& aEvent)
|
||||||
@@ -179,7 +142,7 @@ RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& a
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mCanSend) {
|
if (mCanSend) {
|
||||||
Unused << SendNotifyMozMouseScrollEvent(aScrollId, aEvent);
|
Unused << SendNotifyMozMouseScrollEvent(mLayersId, aScrollId, aEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class RemoteContentController : public GeckoContentController
|
|||||||
using GeckoContentController::APZStateChange;
|
using GeckoContentController::APZStateChange;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RemoteContentController();
|
explicit RemoteContentController(uint64_t aLayersId);
|
||||||
|
|
||||||
virtual ~RemoteContentController();
|
virtual ~RemoteContentController();
|
||||||
|
|
||||||
@@ -57,12 +57,6 @@ public:
|
|||||||
APZStateChange aChange,
|
APZStateChange aChange,
|
||||||
int aArg) override;
|
int aArg) override;
|
||||||
|
|
||||||
virtual void UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent) override;
|
|
||||||
|
|
||||||
virtual void UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent) override;
|
|
||||||
|
|
||||||
virtual void SetScrollingRootContent(bool aIsRootContent) override;
|
|
||||||
|
|
||||||
virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
||||||
const nsString& aEvent) override;
|
const nsString& aEvent) override;
|
||||||
|
|
||||||
@@ -76,6 +70,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MessageLoop* mCompositorThread;
|
MessageLoop* mCompositorThread;
|
||||||
|
uint64_t mLayersId;
|
||||||
bool mCanSend;
|
bool mCanSend;
|
||||||
|
|
||||||
// Mutex protecting members below accessed from multiple threads.
|
// Mutex protecting members below accessed from multiple threads.
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "mozilla/ipc/MessageChannel.h" // for MessageChannel, etc
|
#include "mozilla/ipc/MessageChannel.h" // for MessageChannel, etc
|
||||||
#include "mozilla/ipc/ProtocolUtils.h"
|
#include "mozilla/ipc/ProtocolUtils.h"
|
||||||
#include "mozilla/ipc/Transport.h" // for Transport
|
#include "mozilla/ipc/Transport.h" // for Transport
|
||||||
#include "mozilla/Sprintf.h"
|
|
||||||
#include "mozilla/UniquePtr.h" // for UniquePtr
|
#include "mozilla/UniquePtr.h" // for UniquePtr
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "nsIMemoryReporter.h"
|
#include "nsIMemoryReporter.h"
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ EXPORTS.mozilla.layers += [
|
|||||||
'apz/util/APZEventState.h',
|
'apz/util/APZEventState.h',
|
||||||
'apz/util/APZThreadUtils.h',
|
'apz/util/APZThreadUtils.h',
|
||||||
'apz/util/ChromeProcessController.h',
|
'apz/util/ChromeProcessController.h',
|
||||||
'apz/util/ContentProcessController.h',
|
|
||||||
'apz/util/DoubleTapToZoom.h',
|
'apz/util/DoubleTapToZoom.h',
|
||||||
'apz/util/InputAPZContext.h',
|
'apz/util/InputAPZContext.h',
|
||||||
'apz/util/ScrollInputMethods.h',
|
'apz/util/ScrollInputMethods.h',
|
||||||
@@ -289,7 +288,6 @@ UNIFIED_SOURCES += [
|
|||||||
'apz/util/APZThreadUtils.cpp',
|
'apz/util/APZThreadUtils.cpp',
|
||||||
'apz/util/CheckerboardReportService.cpp',
|
'apz/util/CheckerboardReportService.cpp',
|
||||||
'apz/util/ChromeProcessController.cpp',
|
'apz/util/ChromeProcessController.cpp',
|
||||||
'apz/util/ContentProcessController.cpp',
|
|
||||||
'apz/util/DoubleTapToZoom.cpp',
|
'apz/util/DoubleTapToZoom.cpp',
|
||||||
'apz/util/InputAPZContext.cpp',
|
'apz/util/InputAPZContext.cpp',
|
||||||
'apz/util/ScrollLinkedEffectDetector.cpp',
|
'apz/util/ScrollLinkedEffectDetector.cpp',
|
||||||
|
|||||||
Reference in New Issue
Block a user