зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 8 changesets (bug 1445662) for bustage at build/src/gfx/layers/apz/util/ChromeProcessController.cp on a CLOSED TREE
Backed out changeset d514b05d1f6a (bug 1445662) Backed out changeset 13f4f51d7bd1 (bug 1445662) Backed out changeset 20c79dee1905 (bug 1445662) Backed out changeset ca1e29c9b439 (bug 1445662) Backed out changeset 8fadda7d555e (bug 1445662) Backed out changeset b5f2ceda75bd (bug 1445662) Backed out changeset 41d8b7a6b339 (bug 1445662) Backed out changeset 121cd3a0490f (bug 1445662)
This commit is contained in:
Родитель
45c410eacb
Коммит
fbaf1d233a
|
@ -190,6 +190,13 @@ public:
|
|||
*/
|
||||
virtual void SetLongTapEnabled(bool aTapGestureEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Process touch velocity.
|
||||
* Sometimes the touch move event will have a velocity even though no scrolling
|
||||
* is occurring such as when the toolbar is being hidden/shown in Fennec.
|
||||
* This function can be called to have the y axis' velocity queue updated.
|
||||
*/
|
||||
virtual void ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY) = 0;
|
||||
|
||||
// Returns whether or not a wheel event action will be (or was) performed by
|
||||
// APZ. If this returns true, the event must not perform a synchronous
|
||||
|
|
|
@ -65,6 +65,8 @@ typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
|||
|
||||
typedef CompositorBridgeParent::LayerTreeState LayerTreeState;
|
||||
|
||||
float APZCTreeManager::sDPI = 160.0;
|
||||
|
||||
struct APZCTreeManager::TreeBuildingState {
|
||||
TreeBuildingState(uint64_t aRootLayersId,
|
||||
bool aIsFirstPaint, uint64_t aOriginatingLayersId,
|
||||
|
@ -228,8 +230,7 @@ APZCTreeManager::APZCTreeManager(uint64_t aRootLayersId)
|
|||
mRetainedTouchIdentifier(-1),
|
||||
mInScrollbarTouchDrag(false),
|
||||
mApzcTreeLog("apzctree"),
|
||||
mTestDataLock("APZTestDataLock"),
|
||||
mDPI(160.0)
|
||||
mTestDataLock("APZTestDataLock")
|
||||
{
|
||||
RefPtr<APZCTreeManager> self(this);
|
||||
NS_DispatchToMainThread(
|
||||
|
@ -306,8 +307,6 @@ void
|
|||
APZCTreeManager::SetAllowedTouchBehavior(uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags> &aValues)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
mInputQueue->SetAllowedTouchBehavior(aInputBlockId, aValues);
|
||||
}
|
||||
|
||||
|
@ -733,8 +732,6 @@ void
|
|||
APZCTreeManager::StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
|
||||
const AsyncDragMetrics& aDragMetrics)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
|
||||
if (!apzc) {
|
||||
NotifyScrollbarDragRejected(aGuid);
|
||||
|
@ -749,8 +746,6 @@ bool
|
|||
APZCTreeManager::StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
|
||||
if (!apzc) {
|
||||
if (XRE_IsGPUProcess()) {
|
||||
|
@ -770,8 +765,6 @@ APZCTreeManager::StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
|||
void
|
||||
APZCTreeManager::StopAutoscroll(const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
if (RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid)) {
|
||||
apzc->StopAutoscroll();
|
||||
}
|
||||
|
@ -1072,7 +1065,7 @@ template<typename PanGestureOrScrollWheelInput>
|
|||
static bool
|
||||
WillHandleInput(const PanGestureOrScrollWheelInput& aPanInput)
|
||||
{
|
||||
if (!XRE_IsParentProcess() || !NS_IsMainThread()) {
|
||||
if (!NS_IsMainThread()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1803,8 +1796,6 @@ void
|
|||
APZCTreeManager::UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint,
|
||||
EventMessage aEventMessage)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
WheelBlockState* txn = mInputQueue->GetActiveWheelTransaction();
|
||||
if (!txn) {
|
||||
return;
|
||||
|
@ -1850,8 +1841,6 @@ APZCTreeManager::ProcessUnhandledEvent(LayoutDeviceIntPoint* aRefPoint,
|
|||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutFocusSequenceNumber)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
// Transform the aRefPoint.
|
||||
// If the event hits an overscrolled APZC, instruct the caller to ignore it.
|
||||
CompositorHitTestInfo hitResult = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
|
@ -1889,8 +1878,6 @@ APZCTreeManager::ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY)
|
|||
void
|
||||
APZCTreeManager::SetKeyboardMap(const KeyboardMap& aKeyboardMap)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
mKeyboardMap = aKeyboardMap;
|
||||
}
|
||||
|
||||
|
@ -1899,11 +1886,6 @@ APZCTreeManager::ZoomToRect(const ScrollableLayerGuid& aGuid,
|
|||
const CSSRect& aRect,
|
||||
const uint32_t aFlags)
|
||||
{
|
||||
// We could probably move this to run on the sampler thread if needed, but
|
||||
// either way we should restrict it to a single thread. For now let's use the
|
||||
// controller thread.
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
|
||||
if (apzc) {
|
||||
apzc->ZoomToRect(aRect, aFlags);
|
||||
|
@ -1948,24 +1930,6 @@ void
|
|||
APZCTreeManager::UpdateZoomConstraints(const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints)
|
||||
{
|
||||
if (!APZThreadUtils::IsSamplerThread()) {
|
||||
// This can happen if we're in the UI process and got a call directly from
|
||||
// nsBaseWidget (as opposed to over PAPZCTreeManager). We want this function
|
||||
// to run on the sampler thread, so bounce it over.
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
APZThreadUtils::RunOnSamplerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, Maybe<ZoomConstraints>>(
|
||||
"APZCTreeManager::UpdateZoomConstraints",
|
||||
this,
|
||||
&APZCTreeManager::UpdateZoomConstraints,
|
||||
aGuid,
|
||||
aConstraints));
|
||||
return;
|
||||
}
|
||||
|
||||
APZThreadUtils::AssertOnSamplerThread();
|
||||
|
||||
RecursiveMutexAutoLock lock(mTreeLock);
|
||||
RefPtr<HitTestingTreeNode> node = GetTargetNode(aGuid, nullptr);
|
||||
MOZ_ASSERT(!node || node->GetApzc()); // any node returned must have an APZC
|
||||
|
@ -3187,20 +3151,6 @@ APZCTreeManager::ComputeTransformForScrollThumb(
|
|||
return transform;
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::SetDPI(float aDpiValue)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
mDPI = aDpiValue;
|
||||
}
|
||||
|
||||
float
|
||||
APZCTreeManager::GetDPI() const
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
return mDPI;
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
AndroidDynamicToolbarAnimator*
|
||||
APZCTreeManager::GetAndroidDynamicToolbarAnimator()
|
||||
|
|
|
@ -340,16 +340,15 @@ public:
|
|||
bool HitTestAPZC(const ScreenIntPoint& aPoint);
|
||||
|
||||
/**
|
||||
* Sets the dpi value used by all AsyncPanZoomControllers attached to this
|
||||
* tree manager.
|
||||
* DPI defaults to 160 if not set using SetDPI() at any point.
|
||||
* Sets the dpi value used by all AsyncPanZoomControllers.
|
||||
* DPI defaults to 72 if not set using SetDPI() at any point.
|
||||
*/
|
||||
void SetDPI(float aDpiValue) override;
|
||||
void SetDPI(float aDpiValue) override { sDPI = aDpiValue; }
|
||||
|
||||
/**
|
||||
* Returns the current dpi value in use.
|
||||
*/
|
||||
float GetDPI() const;
|
||||
static float GetDPI() { return sDPI; }
|
||||
|
||||
/**
|
||||
* Find the hit testing node for the scrollbar thumb that matches these
|
||||
|
@ -552,7 +551,7 @@ public:
|
|||
* is occurring such as when the toolbar is being hidden/shown in Fennec.
|
||||
* This function can be called to have the y axis' velocity queue updated.
|
||||
*/
|
||||
void ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY);
|
||||
void ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY) override;
|
||||
private:
|
||||
typedef bool (*GuidComparator)(const ScrollableLayerGuid&, const ScrollableLayerGuid&);
|
||||
|
||||
|
@ -691,17 +690,15 @@ private:
|
|||
* isolation (that is, if its tree pointers are not being accessed or mutated). The
|
||||
* lock also needs to be held when accessing the mRootNode instance variable, as that
|
||||
* is considered part of the APZC tree management state.
|
||||
* Finally, the lock needs to be held when accessing mZoomConstraints.
|
||||
* IMPORTANT: See the note about lock ordering at the top of this file. */
|
||||
mutable mozilla::RecursiveMutex mTreeLock;
|
||||
RefPtr<HitTestingTreeNode> mRootNode;
|
||||
|
||||
/* Holds the zoom constraints for scrollable layers, as determined by the
|
||||
* the main-thread gecko code. This can only be accessed on the sampler
|
||||
* thread. */
|
||||
* the main-thread gecko code. */
|
||||
std::unordered_map<ScrollableLayerGuid, ZoomConstraints, ScrollableLayerGuidHash> mZoomConstraints;
|
||||
/* A list of keyboard shortcuts to use for translating keyboard inputs into
|
||||
* keyboard actions. This is gathered on the main thread from XBL bindings.
|
||||
* This must only be accessed on the controller thread.
|
||||
*/
|
||||
KeyboardMap mKeyboardMap;
|
||||
/* This tracks the focus targets of chrome and content and whether we have
|
||||
|
@ -749,8 +746,7 @@ private:
|
|||
std::unordered_map<uint64_t, UniquePtr<APZTestData>> mTestData;
|
||||
mutable mozilla::Mutex mTestDataLock;
|
||||
|
||||
// This must only be touched on the controller thread.
|
||||
float mDPI;
|
||||
static float sDPI;
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
public:
|
||||
|
|
|
@ -868,34 +868,16 @@ AsyncPanZoomController::IsDestroyed() const
|
|||
return mTreeManager == nullptr;
|
||||
}
|
||||
|
||||
float
|
||||
AsyncPanZoomController::GetDPI() const
|
||||
/* static */ScreenCoord
|
||||
AsyncPanZoomController::GetTouchStartTolerance()
|
||||
{
|
||||
if (APZCTreeManager* localPtr = mTreeManager) {
|
||||
return localPtr->GetDPI();
|
||||
}
|
||||
// If this APZC has been destroyed then this value is not going to be
|
||||
// used for anything that the user will end up seeing, so we can just
|
||||
// return 0.
|
||||
return 0.0;
|
||||
return (gfxPrefs::APZTouchStartTolerance() * APZCTreeManager::GetDPI());
|
||||
}
|
||||
|
||||
ScreenCoord
|
||||
AsyncPanZoomController::GetTouchStartTolerance() const
|
||||
/* static */ScreenCoord
|
||||
AsyncPanZoomController::GetSecondTapTolerance()
|
||||
{
|
||||
return (gfxPrefs::APZTouchStartTolerance() * GetDPI());
|
||||
}
|
||||
|
||||
ScreenCoord
|
||||
AsyncPanZoomController::GetTouchMoveTolerance() const
|
||||
{
|
||||
return (gfxPrefs::APZTouchMoveTolerance() * GetDPI());
|
||||
}
|
||||
|
||||
ScreenCoord
|
||||
AsyncPanZoomController::GetSecondTapTolerance() const
|
||||
{
|
||||
return (gfxPrefs::APZSecondTapTolerance() * GetDPI());
|
||||
return (gfxPrefs::APZSecondTapTolerance() * APZCTreeManager::GetDPI());
|
||||
}
|
||||
|
||||
/* static */AsyncPanZoomController::AxisLockMode AsyncPanZoomController::GetAxisLockMode()
|
||||
|
@ -2664,7 +2646,7 @@ void AsyncPanZoomController::HandlePanningUpdate(const ScreenPoint& aPanDistance
|
|||
double angle = atan2(aPanDistance.y, aPanDistance.x); // range [-pi, pi]
|
||||
angle = fabs(angle); // range [0, pi]
|
||||
|
||||
float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * GetDPI();
|
||||
float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * APZCTreeManager::GetDPI();
|
||||
|
||||
if (fabs(aPanDistance.x) > breakThreshold || fabs(aPanDistance.y) > breakThreshold) {
|
||||
if (mState == PANNING_LOCKED_X) {
|
||||
|
@ -2685,13 +2667,13 @@ void AsyncPanZoomController::HandlePanningUpdate(const ScreenPoint& aPanDistance
|
|||
void AsyncPanZoomController::HandlePinchLocking(ScreenCoord spanDistance, ScreenPoint focusChange) {
|
||||
if (mPinchLocked) {
|
||||
if (GetPinchLockMode() == PINCH_STICKY) {
|
||||
ScreenCoord spanBreakoutThreshold = gfxPrefs::APZPinchLockSpanBreakoutThreshold() * GetDPI();
|
||||
ScreenCoord spanBreakoutThreshold = gfxPrefs::APZPinchLockSpanBreakoutThreshold() * APZCTreeManager::GetDPI();
|
||||
mPinchLocked = !(spanDistance > spanBreakoutThreshold);
|
||||
}
|
||||
} else {
|
||||
if (GetPinchLockMode() != PINCH_FREE) {
|
||||
ScreenCoord spanLockThreshold = gfxPrefs::APZPinchLockSpanLockThreshold() * GetDPI();
|
||||
ScreenCoord scrollLockThreshold = gfxPrefs::APZPinchLockScrollLockThreshold() * GetDPI();
|
||||
ScreenCoord spanLockThreshold = gfxPrefs::APZPinchLockSpanLockThreshold() * APZCTreeManager::GetDPI();
|
||||
ScreenCoord scrollLockThreshold = gfxPrefs::APZPinchLockScrollLockThreshold() * APZCTreeManager::GetDPI();
|
||||
|
||||
if (spanDistance < spanLockThreshold && focusChange.Length() > scrollLockThreshold) {
|
||||
mPinchLocked = true;
|
||||
|
|
|
@ -152,11 +152,6 @@ public:
|
|||
USE_GESTURE_DETECTOR
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the DPI from the tree manager.
|
||||
*/
|
||||
float GetDPI() const;
|
||||
|
||||
/**
|
||||
* Constant describing the tolerance in distance we use, multiplied by the
|
||||
* device DPI, before we start panning the screen. This is to prevent us from
|
||||
|
@ -165,19 +160,13 @@ public:
|
|||
* Note: It's an abuse of the 'Coord' class to use it to represent a 2D
|
||||
* distance, but it's the closest thing we currently have.
|
||||
*/
|
||||
ScreenCoord GetTouchStartTolerance() const;
|
||||
/**
|
||||
* Same as GetTouchStartTolerance, but the tolerance for how far the touch
|
||||
* has to move before it starts allowing touchmove events to be dispatched
|
||||
* to content, for non-scrollable content.
|
||||
*/
|
||||
ScreenCoord GetTouchMoveTolerance() const;
|
||||
static ScreenCoord GetTouchStartTolerance();
|
||||
/**
|
||||
* Same as GetTouchStartTolerance, but the tolerance for how close the second
|
||||
* tap has to be to the first tap in order to be counted as part of a multi-tap
|
||||
* gesture (double-tap or one-touch-pinch).
|
||||
*/
|
||||
ScreenCoord GetSecondTapTolerance() const;
|
||||
static ScreenCoord GetSecondTapTolerance();
|
||||
|
||||
AsyncPanZoomController(uint64_t aLayersId,
|
||||
APZCTreeManager* aTreeManager,
|
||||
|
|
|
@ -60,7 +60,7 @@ Axis::Axis(AsyncPanZoomController* aAsyncPanZoomController)
|
|||
}
|
||||
|
||||
float Axis::ToLocalVelocity(float aVelocityInchesPerMs) const {
|
||||
ScreenPoint velocity = MakePoint(aVelocityInchesPerMs * mAsyncPanZoomController->GetDPI());
|
||||
ScreenPoint velocity = MakePoint(aVelocityInchesPerMs * APZCTreeManager::GetDPI());
|
||||
// Use ToScreenCoordinates() to convert a point rather than a vector by
|
||||
// treating the point as a vector, and using (0, 0) as the anchor.
|
||||
ScreenPoint panStart = mAsyncPanZoomController->ToScreenCoordinates(
|
||||
|
|
|
@ -263,7 +263,7 @@ bool GestureEventListener::MoveDistanceExceeds(ScreenCoord aThreshold) const
|
|||
|
||||
bool GestureEventListener::MoveDistanceIsLarge() const
|
||||
{
|
||||
return MoveDistanceExceeds(mAsyncPanZoomController->GetTouchStartTolerance());
|
||||
return MoveDistanceExceeds(AsyncPanZoomController::GetTouchStartTolerance());
|
||||
}
|
||||
|
||||
bool GestureEventListener::SecondTapIsFar() const
|
||||
|
@ -271,7 +271,7 @@ bool GestureEventListener::SecondTapIsFar() const
|
|||
// Allow a little more room here, because the is actually lifting their finger
|
||||
// off the screen before replacing it, and that tends to have more error than
|
||||
// wiggling the finger while on the screen.
|
||||
return MoveDistanceExceeds(mAsyncPanZoomController->GetSecondTapTolerance());
|
||||
return MoveDistanceExceeds(AsyncPanZoomController::GetSecondTapTolerance());
|
||||
}
|
||||
|
||||
nsEventStatus GestureEventListener::HandleInputTouchMove()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "InputBlockState.h"
|
||||
|
||||
#include "APZCTreeManager.h" // for APZCTreeManager::GetDPI
|
||||
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
|
||||
#include "ScrollAnimationPhysics.h" // for kScrollSeriesTimeoutMs
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
|
@ -889,13 +890,9 @@ TouchBlockState::UpdateSlopState(const MultiTouchInput& aInput,
|
|||
return false;
|
||||
}
|
||||
if (mInSlop) {
|
||||
ScreenCoord threshold = 0;
|
||||
// If the target was confirmed to null then the threshold doesn't
|
||||
// matter anyway since the events will never be processed.
|
||||
if (const RefPtr<AsyncPanZoomController>& apzc = GetTargetApzc()) {
|
||||
threshold = aApzcCanConsumeEvents ? apzc->GetTouchStartTolerance()
|
||||
: apzc->GetTouchMoveTolerance();
|
||||
}
|
||||
ScreenCoord threshold = aApzcCanConsumeEvents
|
||||
? AsyncPanZoomController::GetTouchStartTolerance()
|
||||
: ScreenCoord(gfxPrefs::APZTouchMoveTolerance() * APZCTreeManager::GetDPI());
|
||||
bool stayInSlop = (aInput.mType == MultiTouchInput::MULTITOUCH_MOVE) &&
|
||||
(aInput.mTouches.Length() == 1) &&
|
||||
((aInput.mTouches[0].mScreenPoint - mSlopOrigin).Length() < threshold);
|
||||
|
|
|
@ -42,6 +42,14 @@ APZThreadUtils::AssertOnControllerThread() {
|
|||
MOZ_ASSERT(sControllerThread == MessageLoop::current());
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
APZThreadUtils::AssertOnSamplerThread()
|
||||
{
|
||||
if (GetThreadAssertionsEnabled()) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
APZThreadUtils::RunOnControllerThread(already_AddRefed<Runnable> aTask)
|
||||
{
|
||||
|
@ -66,39 +74,6 @@ APZThreadUtils::IsControllerThread()
|
|||
return sControllerThread == MessageLoop::current();
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
APZThreadUtils::AssertOnSamplerThread()
|
||||
{
|
||||
if (GetThreadAssertionsEnabled()) {
|
||||
MOZ_ASSERT(IsSamplerThread());
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
APZThreadUtils::RunOnSamplerThread(already_AddRefed<Runnable> aTask)
|
||||
{
|
||||
RefPtr<Runnable> task = aTask;
|
||||
|
||||
MessageLoop* loop = CompositorThreadHolder::Loop();
|
||||
if (!loop) {
|
||||
// Could happen during startup
|
||||
NS_WARNING("Dropping task posted to sampler thread");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsSamplerThread()) {
|
||||
task->Run();
|
||||
} else {
|
||||
loop->PostTask(task.forget());
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
APZThreadUtils::IsSamplerThread()
|
||||
{
|
||||
return CompositorThreadHolder::IsInCompositorThread();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(GenericNamedTimerCallbackBase, nsITimerCallback, nsINamed)
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -40,6 +40,13 @@ public:
|
|||
*/
|
||||
static void AssertOnControllerThread();
|
||||
|
||||
/**
|
||||
* This can be used to assert that the current thread is the
|
||||
* sampler thread (which samples the async transform).
|
||||
* This does nothing if thread assertions are disabled.
|
||||
*/
|
||||
static void AssertOnSamplerThread();
|
||||
|
||||
/**
|
||||
* Run the given task on the APZ "controller thread" for this platform. If
|
||||
* this function is called from the controller thread itself then the task is
|
||||
|
@ -51,25 +58,6 @@ public:
|
|||
* Returns true if currently on APZ "controller thread".
|
||||
*/
|
||||
static bool IsControllerThread();
|
||||
|
||||
/**
|
||||
* This can be used to assert that the current thread is the
|
||||
* sampler thread (which samples the async transform).
|
||||
* This does nothing if thread assertions are disabled.
|
||||
*/
|
||||
static void AssertOnSamplerThread();
|
||||
|
||||
/**
|
||||
* Runs the given task on the APZ "sampler thread" for this platform. If
|
||||
* this function is called from the sampler thread itself then the task is
|
||||
* run immediately without getting queued.
|
||||
*/
|
||||
static void RunOnSamplerThread(already_AddRefed<Runnable> aTask);
|
||||
|
||||
/**
|
||||
* Returns true if currently on the APZ "sampler thread".
|
||||
*/
|
||||
static bool IsSamplerThread();
|
||||
};
|
||||
|
||||
// A base class for GenericNamedTimerCallback<Function>.
|
||||
|
|
|
@ -158,14 +158,8 @@ ChromeProcessController::HandleDoubleTap(const mozilla::CSSPoint& aPoint,
|
|||
FrameMetrics::ViewID viewId;
|
||||
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
|
||||
document->GetDocumentElement(), &presShellId, &viewId)) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, CSSRect, uint32_t>(
|
||||
"IAPZCTreeManager::ZoomToRect",
|
||||
mAPZCTreeManager,
|
||||
&IAPZCTreeManager::ZoomToRect,
|
||||
ScrollableLayerGuid(aGuid.mLayersId, presShellId, viewId),
|
||||
zoomToRect,
|
||||
ZoomToRectBehavior::DEFAULT_BEHAVIOR));
|
||||
mAPZCTreeManager->ZoomToRect(
|
||||
ScrollableLayerGuid(aGuid.mLayersId, presShellId, viewId), zoomToRect);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -221,6 +221,12 @@ APZCTreeManagerChild::SetLongTapEnabled(bool aTapGestureEnabled)
|
|||
SendSetLongTapEnabled(aTapGestureEnabled);
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManagerChild::ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY)
|
||||
{
|
||||
SendProcessTouchVelocity(aTimestampMs, aSpeedY);
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManagerChild::UpdateWheelTransaction(
|
||||
LayoutDeviceIntPoint aRefPoint,
|
||||
|
|
|
@ -78,6 +78,9 @@ public:
|
|||
void
|
||||
SetLongTapEnabled(bool aTapGestureEnabled) override;
|
||||
|
||||
void
|
||||
ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY) override;
|
||||
|
||||
void
|
||||
ProcessUnhandledEvent(
|
||||
LayoutDeviceIntPoint* aRefPoint,
|
||||
|
|
|
@ -166,11 +166,7 @@ APZCTreeManagerParent::RecvReceiveKeyboardInputEvent(
|
|||
mozilla::ipc::IPCResult
|
||||
APZCTreeManagerParent::RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap)
|
||||
{
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
|
||||
"layers::IAPZCTreeManager::SetKeyboardMap",
|
||||
mTreeManager,
|
||||
&IAPZCTreeManager::SetKeyboardMap,
|
||||
aKeyboardMap));
|
||||
mTreeManager->SetKeyboardMap(aKeyboardMap);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -187,12 +183,7 @@ APZCTreeManagerParent::RecvZoomToRect(
|
|||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, CSSRect, uint32_t>(
|
||||
"layers::IAPZCTreeManager::ZoomToRect",
|
||||
mTreeManager,
|
||||
&IAPZCTreeManager::ZoomToRect,
|
||||
aGuid, aRect, aFlags));
|
||||
mTreeManager->ZoomToRect(aGuid, aRect, aFlags);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -253,11 +244,7 @@ APZCTreeManagerParent::RecvUpdateZoomConstraints(
|
|||
mozilla::ipc::IPCResult
|
||||
APZCTreeManagerParent::RecvSetDPI(const float& aDpiValue)
|
||||
{
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<float>(
|
||||
"layers::IAPZCTreeManager::SetDPI",
|
||||
mTreeManager,
|
||||
&IAPZCTreeManager::SetDPI,
|
||||
aDpiValue));
|
||||
mTreeManager->SetDPI(aDpiValue);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -344,6 +331,15 @@ APZCTreeManagerParent::RecvSetLongTapEnabled(const bool& aTapGestureEnabled)
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
APZCTreeManagerParent::RecvProcessTouchVelocity(
|
||||
const uint32_t& aTimestampMs,
|
||||
const float& aSpeedY)
|
||||
{
|
||||
mTreeManager->ProcessTouchVelocity(aTimestampMs, aSpeedY);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
APZCTreeManagerParent::RecvUpdateWheelTransaction(
|
||||
const LayoutDeviceIntPoint& aRefPoint,
|
||||
|
|
|
@ -134,6 +134,11 @@ public:
|
|||
mozilla::ipc::IPCResult
|
||||
RecvSetLongTapEnabled(const bool& aTapGestureEnabled) override;
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
RecvProcessTouchVelocity(
|
||||
const uint32_t& aTimestampMs,
|
||||
const float& aSpeedY) override;
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
RecvUpdateWheelTransaction(
|
||||
const LayoutDeviceIntPoint& aRefPoint,
|
||||
|
|
|
@ -85,6 +85,8 @@ parent:
|
|||
|
||||
async SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
|
||||
async ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY);
|
||||
|
||||
// The following messages are used to
|
||||
// implement the ReceiveInputEvent methods
|
||||
|
||||
|
|
|
@ -59,25 +59,6 @@ RemoteContentController::HandleTapOnMainThread(TapType aTapType,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::HandleTapOnCompositorThread(TapType aTapType,
|
||||
LayoutDevicePoint aPoint,
|
||||
Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid,
|
||||
uint64_t aInputBlockId)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsGPUProcess());
|
||||
MOZ_ASSERT(MessageLoop::current() == mCompositorThread);
|
||||
|
||||
// The raw pointer to APZCTreeManagerParent is ok here because we are on the
|
||||
// compositor thread.
|
||||
APZCTreeManagerParent* apzctmp =
|
||||
CompositorBridgeParent::GetApzcTreeManagerParentForRoot(aGuid.mLayersId);
|
||||
if (apzctmp) {
|
||||
Unused << apzctmp->SendHandleTap(aTapType, aPoint, aModifiers, aGuid, aInputBlockId);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::HandleTap(TapType aTapType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
|
@ -88,24 +69,16 @@ RemoteContentController::HandleTap(TapType aTapType,
|
|||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_GPU) {
|
||||
if (MessageLoop::current() == mCompositorThread) {
|
||||
HandleTapOnCompositorThread(aTapType, aPoint, aModifiers, aGuid, aInputBlockId);
|
||||
} else {
|
||||
// We have to send messages from the compositor thread
|
||||
mCompositorThread->PostTask(NewRunnableMethod<TapType,
|
||||
LayoutDevicePoint,
|
||||
Modifiers,
|
||||
ScrollableLayerGuid,
|
||||
uint64_t>(
|
||||
"layers::RemoteContentController::HandleTapOnCompositorThread",
|
||||
this,
|
||||
&RemoteContentController::HandleTapOnCompositorThread,
|
||||
aTapType,
|
||||
aPoint,
|
||||
aModifiers,
|
||||
aGuid,
|
||||
aInputBlockId));
|
||||
MOZ_ASSERT(MessageLoop::current() == mCompositorThread);
|
||||
|
||||
// The raw pointer to APZCTreeManagerParent is ok here because we are on the
|
||||
// compositor thread.
|
||||
APZCTreeManagerParent* apzctmp =
|
||||
CompositorBridgeParent::GetApzcTreeManagerParentForRoot(aGuid.mLayersId);
|
||||
if (apzctmp) {
|
||||
Unused << apzctmp->SendHandleTap(aTapType, aPoint, aModifiers, aGuid, aInputBlockId);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,24 +105,6 @@ RemoteContentController::HandleTap(TapType aTapType,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::NotifyPinchGestureOnCompositorThread(
|
||||
PinchGestureInput::PinchGestureType aType,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
LayoutDeviceCoord aSpanChange,
|
||||
Modifiers aModifiers)
|
||||
{
|
||||
MOZ_ASSERT(MessageLoop::current() == mCompositorThread);
|
||||
|
||||
// The raw pointer to APZCTreeManagerParent is ok here because we are on the
|
||||
// compositor thread.
|
||||
APZCTreeManagerParent* apzctmp =
|
||||
CompositorBridgeParent::GetApzcTreeManagerParentForRoot(aGuid.mLayersId);
|
||||
if (apzctmp) {
|
||||
Unused << apzctmp->SendNotifyPinchGesture(aType, aGuid, aSpanChange, aModifiers);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::NotifyPinchGesture(PinchGestureInput::PinchGestureType aType,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
@ -164,22 +119,16 @@ RemoteContentController::NotifyPinchGesture(PinchGestureInput::PinchGestureType
|
|||
// If we're in the GPU process, try to find a handle to the parent process
|
||||
// and send it there.
|
||||
if (XRE_IsGPUProcess()) {
|
||||
if (MessageLoop::current() == mCompositorThread) {
|
||||
NotifyPinchGestureOnCompositorThread(aType, aGuid, aSpanChange, aModifiers);
|
||||
} else {
|
||||
mCompositorThread->PostTask(NewRunnableMethod<PinchGestureInput::PinchGestureType,
|
||||
ScrollableLayerGuid,
|
||||
LayoutDeviceCoord,
|
||||
Modifiers>(
|
||||
"layers::RemoteContentController::NotifyPinchGestureOnCompositorThread",
|
||||
this,
|
||||
&RemoteContentController::NotifyPinchGestureOnCompositorThread,
|
||||
aType,
|
||||
aGuid,
|
||||
aSpanChange,
|
||||
aModifiers));
|
||||
MOZ_ASSERT(MessageLoop::current() == mCompositorThread);
|
||||
|
||||
// The raw pointer to APZCTreeManagerParent is ok here because we are on the
|
||||
// compositor thread.
|
||||
APZCTreeManagerParent* apzctmp =
|
||||
CompositorBridgeParent::GetApzcTreeManagerParentForRoot(aGuid.mLayersId);
|
||||
if (apzctmp) {
|
||||
Unused << apzctmp->SendNotifyPinchGesture(aType, aGuid, aSpanChange, aModifiers);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're in the parent process, handle it directly. We don't have a handle
|
||||
|
|
|
@ -90,15 +90,6 @@ private:
|
|||
Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid,
|
||||
uint64_t aInputBlockId);
|
||||
void HandleTapOnCompositorThread(TapType aType,
|
||||
LayoutDevicePoint aPoint,
|
||||
Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid,
|
||||
uint64_t aInputBlockId);
|
||||
void NotifyPinchGestureOnCompositorThread(PinchGestureInput::PinchGestureType aType,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
LayoutDeviceCoord aSpanChange,
|
||||
Modifiers aModifiers);
|
||||
|
||||
void CancelAutoscrollInProcess(const ScrollableLayerGuid& aScrollId);
|
||||
void CancelAutoscrollCrossProcess(const ScrollableLayerGuid& aScrollId);
|
||||
|
|
|
@ -933,27 +933,14 @@ nsBaseWidget::CreateRootContentController()
|
|||
|
||||
void nsBaseWidget::ConfigureAPZCTreeManager()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mAPZC);
|
||||
|
||||
ConfigureAPZControllerThread();
|
||||
|
||||
float dpi = GetDPI();
|
||||
// On Android the main thread is not the controller thread
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<float>(
|
||||
"layers::IAPZCTreeManager::SetDPI",
|
||||
mAPZC,
|
||||
&IAPZCTreeManager::SetDPI,
|
||||
dpi));
|
||||
mAPZC->SetDPI(GetDPI());
|
||||
|
||||
if (gfxPrefs::APZKeyboardEnabled()) {
|
||||
KeyboardMap map = nsXBLWindowKeyHandler::CollectKeyboardShortcuts();
|
||||
// On Android the main thread is not the controller thread
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
|
||||
"layers::IAPZCTreeManager::SetKeyboardMap",
|
||||
mAPZC,
|
||||
&IAPZCTreeManager::SetKeyboardMap,
|
||||
map));
|
||||
mAPZC->SetKeyboardMap(nsXBLWindowKeyHandler::CollectKeyboardShortcuts());
|
||||
}
|
||||
|
||||
RefPtr<IAPZCTreeManager> treeManager = mAPZC; // for capture by the lambdas
|
||||
|
@ -1933,14 +1920,7 @@ nsBaseWidget::ZoomToRect(const uint32_t& aPresShellId,
|
|||
return;
|
||||
}
|
||||
uint64_t layerId = mCompositorSession->RootLayerTreeId();
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, CSSRect, uint32_t>(
|
||||
"layers::IAPZCTreeManager::ZoomToRect",
|
||||
mAPZC,
|
||||
&IAPZCTreeManager::ZoomToRect,
|
||||
ScrollableLayerGuid(layerId, aPresShellId, aViewId),
|
||||
aRect,
|
||||
aFlags));
|
||||
mAPZC->ZoomToRect(ScrollableLayerGuid(layerId, aPresShellId, aViewId), aRect, aFlags);
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
|
|
Загрузка…
Ссылка в новой задаче