зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
MozReview-Commit-ID: 7tO2kkTNFk2
This commit is contained in:
Родитель
5d71eddddf
Коммит
5c1e3a17b8
|
@ -23,7 +23,7 @@ class GPUProcessManager;
|
|||
namespace layers {
|
||||
|
||||
class GeckoContentController;
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
class CompositorBridgeParent;
|
||||
class CompositorBridgeChild;
|
||||
class ClientLayerManager;
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
virtual void SetContentController(GeckoContentController* aController) = 0;
|
||||
|
||||
// Return the Async Pan/Zoom Tree Manager for this compositor.
|
||||
virtual already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const = 0;
|
||||
virtual already_AddRefed<IAPZCTreeManager> GetAPZCTreeManager() const = 0;
|
||||
|
||||
// Return the child end of the compositor IPC bridge.
|
||||
CompositorBridgeChild* GetCompositorBridgeChild();
|
||||
|
|
|
@ -483,7 +483,7 @@ GPUProcessManager::CreateContentVRManager(base::ProcessId aOtherProcess,
|
|||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
already_AddRefed<IAPZCTreeManager>
|
||||
GPUProcessManager::GetAPZCTreeManagerForLayers(uint64_t aLayersId)
|
||||
{
|
||||
return CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
|
||||
|
|
|
@ -23,7 +23,7 @@ class nsBaseWidget;
|
|||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
class CompositorSession;
|
||||
class ClientLayerManager;
|
||||
class CompositorUpdateObserver;
|
||||
|
@ -52,9 +52,9 @@ class PVRManagerChild;
|
|||
// to the compositor via CompositorBridgeParent.
|
||||
class GPUProcessManager final : public GPUProcessHost::Listener
|
||||
{
|
||||
typedef layers::APZCTreeManager APZCTreeManager;
|
||||
typedef layers::ClientLayerManager ClientLayerManager;
|
||||
typedef layers::CompositorSession CompositorSession;
|
||||
typedef layers::IAPZCTreeManager IAPZCTreeManager;
|
||||
typedef layers::CompositorUpdateObserver CompositorUpdateObserver;
|
||||
typedef layers::PCompositorBridgeChild PCompositorBridgeChild;
|
||||
typedef layers::PImageBridgeChild PImageBridgeChild;
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
// This returns a reference to the APZCTreeManager to which
|
||||
// pan/zoom-related events can be sent.
|
||||
already_AddRefed<APZCTreeManager> GetAPZCTreeManagerForLayers(uint64_t aLayersId);
|
||||
already_AddRefed<IAPZCTreeManager> GetAPZCTreeManagerForLayers(uint64_t aLayersId);
|
||||
|
||||
// Allocate an ID that can be used to refer to a layer tree and
|
||||
// associated resources that live only on the compositor thread.
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "InProcessCompositorSession.h"
|
||||
|
||||
// so we can cast an APZCTreeManager to an IAPZCTreeManager
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
@ -50,7 +54,7 @@ InProcessCompositorSession::SetContentController(GeckoContentController* aContro
|
|||
mCompositorBridgeParent->SetControllerForLayerTree(mRootLayerTreeId, aController);
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
already_AddRefed<IAPZCTreeManager>
|
||||
InProcessCompositorSession::GetAPZCTreeManager() const
|
||||
{
|
||||
return mCompositorBridgeParent->GetAPZCTreeManager(mRootLayerTreeId);
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
CompositorBridgeParent* GetInProcessBridge() const override;
|
||||
void SetContentController(GeckoContentController* aController) override;
|
||||
already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
|
||||
already_AddRefed<IAPZCTreeManager> GetAPZCTreeManager() const override;
|
||||
void Shutdown() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -30,7 +30,7 @@ RemoteCompositorSession::SetContentController(GeckoContentController* aControlle
|
|||
MOZ_CRASH("NYI");
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
already_AddRefed<IAPZCTreeManager>
|
||||
RemoteCompositorSession::GetAPZCTreeManager() const
|
||||
{
|
||||
return nullptr;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
CompositorBridgeParent* GetInProcessBridge() const override;
|
||||
void SetContentController(GeckoContentController* aController) override;
|
||||
already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
|
||||
already_AddRefed<IAPZCTreeManager> GetAPZCTreeManager() const override;
|
||||
void Shutdown() override;
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
|
||||
/* 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 "mozilla/layers/IAPZCTreeManager.h"
|
||||
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
#include "InputData.h" // for InputData, etc
|
||||
#include "mozilla/EventStateManager.h" // for WheelPrefs
|
||||
#include "mozilla/layers/APZThreadUtils.h" // for AssertOnCompositorThread, etc
|
||||
#include "mozilla/MouseEvents.h" // for WidgetMouseEvent
|
||||
#include "mozilla/TouchEvents.h" // for WidgetTouchEvent
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
static bool
|
||||
WillHandleMouseEvent(const WidgetMouseEventBase& aEvent)
|
||||
{
|
||||
return aEvent.mMessage == eMouseMove ||
|
||||
aEvent.mMessage == eMouseDown ||
|
||||
aEvent.mMessage == eMouseUp ||
|
||||
aEvent.mMessage == eDragEnd;
|
||||
}
|
||||
|
||||
// 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
|
||||
// scroll.
|
||||
//
|
||||
// Even if this returns false, all wheel events in APZ-aware widgets must
|
||||
// be sent through APZ so they are transformed correctly for TabParent.
|
||||
static bool
|
||||
WillHandleWheelEvent(WidgetWheelEvent* aEvent)
|
||||
{
|
||||
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
|
||||
(aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE ||
|
||||
aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL ||
|
||||
aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PAGE);
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
IAPZCTreeManager::ReceiveInputEvent(
|
||||
WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
// Initialize aOutInputBlockId to a sane value, and then later we overwrite
|
||||
// it if the input event goes into a block.
|
||||
if (aOutInputBlockId) {
|
||||
*aOutInputBlockId = 0;
|
||||
}
|
||||
|
||||
switch (aEvent.mClass) {
|
||||
case eMouseEventClass:
|
||||
case eDragEventClass: {
|
||||
|
||||
WidgetMouseEvent& mouseEvent = *aEvent.AsMouseEvent();
|
||||
|
||||
// Note, we call this before having transformed the reference point.
|
||||
if (mouseEvent.IsReal()) {
|
||||
UpdateWheelTransaction(mouseEvent.mRefPoint, mouseEvent.mMessage);
|
||||
}
|
||||
|
||||
if (WillHandleMouseEvent(mouseEvent)) {
|
||||
|
||||
MouseInput input(mouseEvent);
|
||||
input.mOrigin = ScreenPoint(mouseEvent.mRefPoint.x, mouseEvent.mRefPoint.y);
|
||||
|
||||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
|
||||
mouseEvent.mRefPoint.x = input.mOrigin.x;
|
||||
mouseEvent.mRefPoint.y = input.mOrigin.y;
|
||||
mouseEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
TransformEventRefPoint(&mouseEvent.mRefPoint, aOutTargetGuid);
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
case eTouchEventClass: {
|
||||
|
||||
WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
|
||||
MultiTouchInput touchInput(touchEvent);
|
||||
nsEventStatus result = ReceiveInputEvent(touchInput, aOutTargetGuid, aOutInputBlockId);
|
||||
// touchInput was modified in-place to possibly remove some
|
||||
// touch points (if we are overscrolled), and the coordinates were
|
||||
// modified using the APZ untransform. We need to copy these changes
|
||||
// back into the WidgetInputEvent.
|
||||
touchEvent.mTouches.Clear();
|
||||
touchEvent.mTouches.SetCapacity(touchInput.mTouches.Length());
|
||||
for (size_t i = 0; i < touchInput.mTouches.Length(); i++) {
|
||||
*touchEvent.mTouches.AppendElement() =
|
||||
touchInput.mTouches[i].ToNewDOMTouch();
|
||||
}
|
||||
touchEvent.mFlags.mHandledByAPZ = touchInput.mHandledByAPZ;
|
||||
return result;
|
||||
|
||||
}
|
||||
case eWheelEventClass: {
|
||||
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
|
||||
|
||||
if (WillHandleWheelEvent(&wheelEvent)) {
|
||||
|
||||
ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT;
|
||||
if (gfxPrefs::SmoothScrollEnabled() &&
|
||||
((wheelEvent.mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE &&
|
||||
gfxPrefs::WheelSmoothScrollEnabled()) ||
|
||||
(wheelEvent.mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PAGE &&
|
||||
gfxPrefs::PageSmoothScrollEnabled())))
|
||||
{
|
||||
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
|
||||
}
|
||||
|
||||
ScreenPoint origin(wheelEvent.mRefPoint.x, wheelEvent.mRefPoint.y);
|
||||
ScrollWheelInput input(wheelEvent.mTime, wheelEvent.mTimeStamp, 0,
|
||||
scrollMode,
|
||||
ScrollWheelInput::DeltaTypeForDeltaMode(
|
||||
wheelEvent.mDeltaMode),
|
||||
origin,
|
||||
wheelEvent.mDeltaX, wheelEvent.mDeltaY,
|
||||
wheelEvent.mAllowToOverrideSystemScrollSpeed);
|
||||
|
||||
// We add the user multiplier as a separate field, rather than premultiplying
|
||||
// it, because if the input is converted back to a WidgetWheelEvent, then
|
||||
// EventStateManager would apply the delta a second time. We could in theory
|
||||
// work around this by asking ESM to customize the event much sooner, and
|
||||
// then save the "mCustomizedByUserPrefs" bit on ScrollWheelInput - but for
|
||||
// now, this seems easier.
|
||||
EventStateManager::GetUserPrefsForWheelEvent(&wheelEvent,
|
||||
&input.mUserDeltaMultiplierX,
|
||||
&input.mUserDeltaMultiplierY);
|
||||
|
||||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
wheelEvent.mRefPoint.x = input.mOrigin.x;
|
||||
wheelEvent.mRefPoint.y = input.mOrigin.y;
|
||||
wheelEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
|
||||
return status;
|
||||
}
|
||||
|
||||
UpdateWheelTransaction(aEvent.mRefPoint, aEvent.mMessage);
|
||||
TransformEventRefPoint(&aEvent.mRefPoint, aOutTargetGuid);
|
||||
return nsEventStatus_eIgnore;
|
||||
|
||||
}
|
||||
default: {
|
||||
|
||||
UpdateWheelTransaction(aEvent.mRefPoint, aEvent.mMessage);
|
||||
TransformEventRefPoint(&aEvent.mRefPoint, aOutTargetGuid);
|
||||
return nsEventStatus_eIgnore;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid WidgetInputEvent type.");
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,223 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
|
||||
/* 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_IAPZCTreeManager_h
|
||||
#define mozilla_layers_IAPZCTreeManager_h
|
||||
|
||||
#include <stdint.h> // for uint64_t, uint32_t
|
||||
|
||||
#include "FrameMetrics.h" // for FrameMetrics, etc
|
||||
#include "mozilla/EventForwards.h" // for WidgetInputEvent, nsEventStatus
|
||||
#include "mozilla/layers/APZUtils.h" // for HitTestResult
|
||||
#include "nsTArrayForwardDeclare.h" // for nsTArray, nsTArray_Impl, etc
|
||||
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
||||
#include "Units.h" // for CSSPoint, CSSRect, etc
|
||||
|
||||
namespace mozilla {
|
||||
class InputData;
|
||||
|
||||
namespace layers {
|
||||
|
||||
enum AllowedTouchBehavior {
|
||||
NONE = 0,
|
||||
VERTICAL_PAN = 1 << 0,
|
||||
HORIZONTAL_PAN = 1 << 1,
|
||||
PINCH_ZOOM = 1 << 2,
|
||||
DOUBLE_TAP_ZOOM = 1 << 3,
|
||||
UNKNOWN = 1 << 4
|
||||
};
|
||||
|
||||
enum ZoomToRectBehavior : uint32_t {
|
||||
DEFAULT_BEHAVIOR = 0,
|
||||
DISABLE_ZOOM_OUT = 1 << 0,
|
||||
PAN_INTO_VIEW_ONLY = 1 << 1,
|
||||
ONLY_ZOOM_TO_DEFAULT_SCALE = 1 << 2
|
||||
};
|
||||
|
||||
class AsyncDragMetrics;
|
||||
|
||||
class IAPZCTreeManager {
|
||||
NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING(IAPZCTreeManager)
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* General handler for incoming input events. Manipulates the frame metrics
|
||||
* based on what type of input it is. For example, a PinchGestureEvent will
|
||||
* cause scaling. This should only be called externally to this class, and
|
||||
* must be called on the controller thread.
|
||||
*
|
||||
* This function transforms |aEvent| to have its coordinates in DOM space.
|
||||
* This is so that the event can be passed through the DOM and content can
|
||||
* handle them. The event may need to be converted to a WidgetInputEvent
|
||||
* by the caller if it wants to do this.
|
||||
*
|
||||
* The following values may be returned by this function:
|
||||
* nsEventStatus_eConsumeNoDefault is returned to indicate the
|
||||
* APZ is consuming this event and the caller should discard the event with
|
||||
* extreme prejudice. The exact scenarios under which this is returned is
|
||||
* implementation-dependent and may vary.
|
||||
* nsEventStatus_eIgnore is returned to indicate that the APZ code didn't
|
||||
* use this event. This might be because it was directed at a point on
|
||||
* the screen where there was no APZ, or because the thing the user was
|
||||
* trying to do was not allowed. (For example, attempting to pan a
|
||||
* non-pannable document).
|
||||
* nsEventStatus_eConsumeDoDefault is returned to indicate that the APZ
|
||||
* code may have used this event to do some user-visible thing. Note that
|
||||
* in some cases CONSUMED is returned even if the event was NOT used. This
|
||||
* is because we cannot always know at the time of event delivery whether
|
||||
* the event will be used or not. So we err on the side of sending
|
||||
* CONSUMED when we are uncertain.
|
||||
*
|
||||
* @param aEvent input event object; is modified in-place
|
||||
* @param aOutTargetGuid returns the guid of the apzc this event was
|
||||
* delivered to. May be null.
|
||||
* @param aOutInputBlockId returns the id of the input block that this event
|
||||
* was added to, if that was the case. May be null.
|
||||
*/
|
||||
virtual nsEventStatus ReceiveInputEvent(
|
||||
InputData& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId) = 0;
|
||||
|
||||
/**
|
||||
* WidgetInputEvent handler. Transforms |aEvent| (which is assumed to be an
|
||||
* already-existing instance of an WidgetInputEvent which may be an
|
||||
* WidgetTouchEvent) to have its coordinates in DOM space. This is so that the
|
||||
* event can be passed through the DOM and content can handle them.
|
||||
*
|
||||
* NOTE: Be careful of invoking the WidgetInputEvent variant. This can only be
|
||||
* called on the main thread. See widget/InputData.h for more information on
|
||||
* why we have InputData and WidgetInputEvent separated. If this function is
|
||||
* used, the controller thread must be the main thread, or undefined behaviour
|
||||
* may occur.
|
||||
* NOTE: On unix, mouse events are treated as touch and are forwarded
|
||||
* to the appropriate apz as such.
|
||||
*
|
||||
* See documentation for other ReceiveInputEvent above.
|
||||
*/
|
||||
nsEventStatus ReceiveInputEvent(
|
||||
WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
|
||||
/**
|
||||
* Kicks an animation to zoom to a rect. This may be either a zoom out or zoom
|
||||
* in. The actual animation is done on the compositor thread after being set
|
||||
* up. |aRect| must be given in CSS pixels, relative to the document.
|
||||
* |aFlags| is a combination of the ZoomToRectBehavior enum values.
|
||||
*/
|
||||
virtual void ZoomToRect(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const CSSRect& aRect,
|
||||
const uint32_t aFlags = DEFAULT_BEHAVIOR) = 0;
|
||||
|
||||
/**
|
||||
* If we have touch listeners, this should always be called when we know
|
||||
* definitively whether or not content has preventDefaulted any touch events
|
||||
* that have come in. If |aPreventDefault| is true, any touch events in the
|
||||
* queue will be discarded. This function must be called on the controller
|
||||
* thread.
|
||||
*/
|
||||
virtual void ContentReceivedInputBlock(
|
||||
uint64_t aInputBlockId,
|
||||
bool aPreventDefault) = 0;
|
||||
|
||||
/**
|
||||
* When the event regions code is enabled, this function should be invoked to
|
||||
* to confirm the target of the input block. This is only needed in cases
|
||||
* where the initial input event of the block hit a dispatch-to-content region
|
||||
* but is safe to call for all input blocks. This function should always be
|
||||
* invoked on the controller thread.
|
||||
* The different elements in the array of targets correspond to the targets
|
||||
* for the different touch points. In the case where the touch point has no
|
||||
* target, or the target is not a scrollable frame, the target's |mScrollId|
|
||||
* should be set to FrameMetrics::NULL_SCROLL_ID.
|
||||
*/
|
||||
virtual void SetTargetAPZC(
|
||||
uint64_t aInputBlockId,
|
||||
const nsTArray<ScrollableLayerGuid>& aTargets) = 0;
|
||||
|
||||
/**
|
||||
* Updates any zoom constraints contained in the <meta name="viewport"> tag.
|
||||
* If the |aConstraints| is Nothing() then previously-provided constraints for
|
||||
* the given |aGuid| are cleared.
|
||||
*/
|
||||
virtual void UpdateZoomConstraints(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints) = 0;
|
||||
|
||||
/**
|
||||
* Cancels any currently running animation. Note that all this does is set the
|
||||
* state of the AsyncPanZoomController back to NOTHING, but it is the
|
||||
* animation's responsibility to check this before advancing.
|
||||
*/
|
||||
virtual void CancelAnimation(const ScrollableLayerGuid &aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Adjusts the root APZC to compensate for a shift in the surface. See the
|
||||
* documentation on AsyncPanZoomController::AdjustScrollForSurfaceShift for
|
||||
* some more details. This is only currently needed due to surface shifts
|
||||
* caused by the dynamic toolbar on Android.
|
||||
*/
|
||||
virtual void AdjustScrollForSurfaceShift(const ScreenPoint& aShift) = 0;
|
||||
|
||||
virtual void SetDPI(float aDpiValue) = 0;
|
||||
|
||||
/**
|
||||
* Sets allowed touch behavior values for current touch-session for specific
|
||||
* input block (determined by aInputBlock).
|
||||
* Should be invoked by the widget. Each value of the aValues arrays
|
||||
* corresponds to the different touch point that is currently active.
|
||||
* Must be called after receiving the TOUCH_START event that starts the
|
||||
* touch-session.
|
||||
* This must be called on the controller thread.
|
||||
*/
|
||||
virtual void SetAllowedTouchBehavior(
|
||||
uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags>& aValues) = 0;
|
||||
|
||||
virtual void StartScrollbarDrag(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const AsyncDragMetrics& aDragMetrics) = 0;
|
||||
|
||||
/**
|
||||
* Function used to disable LongTap gestures.
|
||||
*
|
||||
* On slow running tests, drags and touch events can be misinterpreted
|
||||
* as a long tap. This allows tests to disable long tap gesture detection.
|
||||
*/
|
||||
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;
|
||||
|
||||
protected:
|
||||
|
||||
// Methods to help process WidgetInputEvents (or manage conversion to/from InputData)
|
||||
|
||||
virtual void TransformEventRefPoint(
|
||||
LayoutDeviceIntPoint* aRefPoint,
|
||||
ScrollableLayerGuid* aOutTargetGuid) = 0;
|
||||
|
||||
virtual void UpdateWheelTransaction(
|
||||
LayoutDeviceIntPoint aRefPoint,
|
||||
EventMessage aEventMessage) = 0;
|
||||
|
||||
// Discourage destruction outside of decref
|
||||
|
||||
virtual ~IAPZCTreeManager() { }
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_layers_IAPZCTreeManager_h
|
|
@ -605,30 +605,6 @@ APZCTreeManager::UpdateHitTestingTree(TreeBuildingState& aState,
|
|||
return node;
|
||||
}
|
||||
|
||||
// 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
|
||||
// scroll.
|
||||
//
|
||||
// Even if this returns false, all wheel events in APZ-aware widgets must
|
||||
// be sent through APZ so they are transformed correctly for TabParent.
|
||||
static bool
|
||||
WillHandleWheelEvent(WidgetWheelEvent* aEvent)
|
||||
{
|
||||
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
|
||||
(aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE ||
|
||||
aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL ||
|
||||
aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PAGE);
|
||||
}
|
||||
|
||||
static bool
|
||||
WillHandleMouseEvent(const WidgetMouseEventBase& aEvent)
|
||||
{
|
||||
return aEvent.mMessage == eMouseMove ||
|
||||
aEvent.mMessage == eMouseDown ||
|
||||
aEvent.mMessage == eMouseUp ||
|
||||
aEvent.mMessage == eDragEnd;
|
||||
}
|
||||
|
||||
template<typename PanGestureOrScrollWheelInput>
|
||||
static bool
|
||||
WillHandleInput(const PanGestureOrScrollWheelInput& aPanInput)
|
||||
|
@ -1039,7 +1015,7 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
|||
ScreenToParentLayerMatrix4x4 transformToApzc = GetScreenToApzcTransform(mApzcForInputBlock);
|
||||
ParentLayerToScreenMatrix4x4 transformToGecko = GetApzcToGeckoTransform(mApzcForInputBlock);
|
||||
ScreenToScreenMatrix4x4 outTransform = transformToApzc * transformToGecko;
|
||||
|
||||
|
||||
for (size_t i = 0; i < aInput.mTouches.Length(); i++) {
|
||||
SingleTouchData& touchData = aInput.mTouches[i];
|
||||
Maybe<ScreenIntPoint> untransformedScreenPoint = UntransformBy(
|
||||
|
@ -1065,7 +1041,8 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
|||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
|
||||
APZCTreeManager::UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint,
|
||||
EventMessage aEventMessage)
|
||||
{
|
||||
WheelBlockState* txn = mInputQueue->GetCurrentWheelTransaction();
|
||||
if (!txn) {
|
||||
|
@ -1078,19 +1055,17 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (aEvent.mMessage) {
|
||||
switch (aEventMessage) {
|
||||
case eMouseMove:
|
||||
case eDragOver: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent.AsMouseEvent();
|
||||
if (!mouseEvent->IsReal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenIntPoint point =
|
||||
ViewAs<ScreenPixel>(aEvent.mRefPoint,
|
||||
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
|
||||
txn->OnMouseMove(point);
|
||||
return;
|
||||
ScreenIntPoint point =
|
||||
ViewAs<ScreenPixel>(aRefPoint,
|
||||
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
|
||||
|
||||
txn->OnMouseMove(point);
|
||||
|
||||
return;
|
||||
}
|
||||
case eKeyPress:
|
||||
case eKeyUp:
|
||||
|
@ -1108,23 +1083,16 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
|
|||
}
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
void
|
||||
APZCTreeManager::TransformEventRefPoint(LayoutDeviceIntPoint* aRefPoint,
|
||||
ScrollableLayerGuid* aOutTargetGuid)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsEventStatus result = nsEventStatus_eIgnore;
|
||||
|
||||
// Note, we call this before having transformed the reference point.
|
||||
UpdateWheelTransaction(aEvent);
|
||||
|
||||
// Transform the mRefPoint.
|
||||
// Transform the aRefPoint.
|
||||
// If the event hits an overscrolled APZC, instruct the caller to ignore it.
|
||||
HitTestResult hitResult = HitNothing;
|
||||
PixelCastJustification LDIsScreen = PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent;
|
||||
ScreenIntPoint refPointAsScreen =
|
||||
ViewAs<ScreenPixel>(aEvent.mRefPoint, LDIsScreen);
|
||||
ViewAs<ScreenPixel>(*aRefPoint, LDIsScreen);
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(refPointAsScreen, &hitResult);
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult != HitNothing);
|
||||
|
@ -1135,32 +1103,10 @@ APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent,
|
|||
Maybe<ScreenIntPoint> untransformedRefPoint =
|
||||
UntransformBy(outTransform, refPointAsScreen);
|
||||
if (untransformedRefPoint) {
|
||||
aEvent.mRefPoint =
|
||||
*aRefPoint =
|
||||
ViewAs<LayoutDevicePixel>(*untransformedRefPoint, LDIsScreen);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ProcessMouseEvent(WidgetMouseEventBase& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Note, we call this before having transformed the reference point.
|
||||
UpdateWheelTransaction(aEvent);
|
||||
|
||||
MouseInput input(aEvent);
|
||||
input.mOrigin = ScreenPoint(aEvent.mRefPoint.x, aEvent.mRefPoint.y);
|
||||
|
||||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
|
||||
aEvent.mRefPoint.x = input.mOrigin.x;
|
||||
aEvent.mRefPoint.y = input.mOrigin.y;
|
||||
aEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1171,104 +1117,6 @@ APZCTreeManager::ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY)
|
|||
}
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ProcessWheelEvent(WidgetWheelEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT;
|
||||
if (gfxPrefs::SmoothScrollEnabled() &&
|
||||
((aEvent.mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE &&
|
||||
gfxPrefs::WheelSmoothScrollEnabled()) ||
|
||||
(aEvent.mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PAGE &&
|
||||
gfxPrefs::PageSmoothScrollEnabled())))
|
||||
{
|
||||
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
|
||||
}
|
||||
|
||||
ScreenPoint origin(aEvent.mRefPoint.x, aEvent.mRefPoint.y);
|
||||
ScrollWheelInput input(aEvent.mTime, aEvent.mTimeStamp, 0,
|
||||
scrollMode,
|
||||
ScrollWheelInput::DeltaTypeForDeltaMode(
|
||||
aEvent.mDeltaMode),
|
||||
origin,
|
||||
aEvent.mDeltaX, aEvent.mDeltaY,
|
||||
aEvent.mAllowToOverrideSystemScrollSpeed);
|
||||
|
||||
// We add the user multiplier as a separate field, rather than premultiplying
|
||||
// it, because if the input is converted back to a WidgetWheelEvent, then
|
||||
// EventStateManager would apply the delta a second time. We could in theory
|
||||
// work around this by asking ESM to customize the event much sooner, and
|
||||
// then save the "mCustomizedByUserPrefs" bit on ScrollWheelInput - but for
|
||||
// now, this seems easier.
|
||||
EventStateManager::GetUserPrefsForWheelEvent(&aEvent,
|
||||
&input.mUserDeltaMultiplierX,
|
||||
&input.mUserDeltaMultiplierY);
|
||||
|
||||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
aEvent.mRefPoint.x = input.mOrigin.x;
|
||||
aEvent.mRefPoint.y = input.mOrigin.y;
|
||||
aEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
|
||||
return status;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
// In general it is preferable to use the version of ReceiveInputEvent
|
||||
// that takes an InputData, as that is usable from off-main-thread. On some
|
||||
// platforms OMT input isn't possible, and there we can use this version.
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
// Initialize aOutInputBlockId to a sane value, and then later we overwrite
|
||||
// it if the input event goes into a block.
|
||||
if (aOutInputBlockId) {
|
||||
*aOutInputBlockId = InputBlockState::NO_BLOCK_ID;
|
||||
}
|
||||
|
||||
switch (aEvent.mClass) {
|
||||
case eMouseEventClass:
|
||||
case eDragEventClass: {
|
||||
WidgetMouseEventBase& mouseEvent = *aEvent.AsMouseEventBase();
|
||||
if (WillHandleMouseEvent(mouseEvent)) {
|
||||
return ProcessMouseEvent(mouseEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
case eTouchEventClass: {
|
||||
WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
|
||||
MultiTouchInput touchInput(touchEvent);
|
||||
nsEventStatus result = ProcessTouchInput(touchInput, aOutTargetGuid, aOutInputBlockId);
|
||||
// touchInput was modified in-place to possibly remove some
|
||||
// touch points (if we are overscrolled), and the coordinates were
|
||||
// modified using the APZ untransform. We need to copy these changes
|
||||
// back into the WidgetInputEvent.
|
||||
touchEvent.mTouches.Clear();
|
||||
touchEvent.mTouches.SetCapacity(touchInput.mTouches.Length());
|
||||
for (size_t i = 0; i < touchInput.mTouches.Length(); i++) {
|
||||
*touchEvent.mTouches.AppendElement() =
|
||||
touchInput.mTouches[i].ToNewDOMTouch();
|
||||
}
|
||||
touchEvent.mFlags.mHandledByAPZ = touchInput.mHandledByAPZ;
|
||||
return result;
|
||||
}
|
||||
case eWheelEventClass: {
|
||||
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
|
||||
if (WillHandleWheelEvent(&wheelEvent)) {
|
||||
return ProcessWheelEvent(wheelEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
default: {
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::ZoomToRect(const ScrollableLayerGuid& aGuid,
|
||||
const CSSRect& aRect,
|
||||
|
@ -1762,7 +1610,7 @@ APZCTreeManager::BuildOverscrollHandoffChain(const RefPtr<AsyncPanZoomController
|
|||
return result;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
void
|
||||
APZCTreeManager::SetLongTapEnabled(bool aLongTapEnabled)
|
||||
{
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
|
|
|
@ -6,49 +6,26 @@
|
|||
#ifndef mozilla_layers_APZCTreeManager_h
|
||||
#define mozilla_layers_APZCTreeManager_h
|
||||
|
||||
#include <stdint.h> // for uint64_t, uint32_t
|
||||
#include <map> // for std::map
|
||||
|
||||
#include "FrameMetrics.h" // for FrameMetrics, etc
|
||||
#include "gfxPoint.h" // for gfxPoint
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
||||
#include "mozilla/EventForwards.h" // for WidgetInputEvent, nsEventStatus
|
||||
#include "mozilla/gfx/Logging.h" // for gfx::TreeLog
|
||||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
#include "mozilla/layers/APZUtils.h" // for HitTestResult
|
||||
#include "mozilla/layers/TouchCounter.h"// for TouchCounter
|
||||
#include "mozilla/layers/IAPZCTreeManager.h" // for IAPZCTreeManager
|
||||
#include "mozilla/Mutex.h" // for Mutex
|
||||
#include "mozilla/RefPtr.h" // for RefPtr
|
||||
#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp
|
||||
#include "nsCOMPtr.h" // for already_AddRefed
|
||||
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
||||
#include "nsTArrayForwardDeclare.h" // for nsTArray, nsTArray_Impl, etc
|
||||
#include "Units.h" // for CSSPoint, CSSRect, etc
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
class InputData;
|
||||
class MultiTouchInput;
|
||||
|
||||
namespace layers {
|
||||
|
||||
enum AllowedTouchBehavior {
|
||||
NONE = 0,
|
||||
VERTICAL_PAN = 1 << 0,
|
||||
HORIZONTAL_PAN = 1 << 1,
|
||||
PINCH_ZOOM = 1 << 2,
|
||||
DOUBLE_TAP_ZOOM = 1 << 3,
|
||||
UNKNOWN = 1 << 4
|
||||
};
|
||||
|
||||
enum ZoomToRectBehavior : uint32_t {
|
||||
DEFAULT_BEHAVIOR = 0,
|
||||
DISABLE_ZOOM_OUT = 1 << 0,
|
||||
PAN_INTO_VIEW_ONLY = 1 << 1,
|
||||
ONLY_ZOOM_TO_DEFAULT_SCALE = 1 << 2
|
||||
};
|
||||
|
||||
class Layer;
|
||||
class AsyncDragMetrics;
|
||||
class AsyncPanZoomController;
|
||||
class CompositorBridgeParent;
|
||||
class OverscrollHandoffChain;
|
||||
|
@ -100,8 +77,7 @@ class HitTestingTreeNode;
|
|||
*
|
||||
* Behaviour of APZ is controlled by a number of preferences shown \ref APZCPrefs "here".
|
||||
*/
|
||||
class APZCTreeManager {
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(APZCTreeManager)
|
||||
class APZCTreeManager : public IAPZCTreeManager {
|
||||
|
||||
typedef mozilla::layers::AllowedTouchBehavior AllowedTouchBehavior;
|
||||
typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics;
|
||||
|
@ -183,29 +159,10 @@ public:
|
|||
* @param aOutInputBlockId returns the id of the input block that this event
|
||||
* was added to, if that was the case. May be null.
|
||||
*/
|
||||
nsEventStatus ReceiveInputEvent(InputData& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
|
||||
/**
|
||||
* WidgetInputEvent handler. Transforms |aEvent| (which is assumed to be an
|
||||
* already-existing instance of an WidgetInputEvent which may be an
|
||||
* WidgetTouchEvent) to have its coordinates in DOM space. This is so that the
|
||||
* event can be passed through the DOM and content can handle them.
|
||||
*
|
||||
* NOTE: Be careful of invoking the WidgetInputEvent variant. This can only be
|
||||
* called on the main thread. See widget/InputData.h for more information on
|
||||
* why we have InputData and WidgetInputEvent separated. If this function is
|
||||
* used, the controller thread must be the main thread, or undefined behaviour
|
||||
* may occur.
|
||||
* NOTE: On unix, mouse events are treated as touch and are forwarded
|
||||
* to the appropriate apz as such.
|
||||
*
|
||||
* See documentation for other ReceiveInputEvent above.
|
||||
*/
|
||||
nsEventStatus ReceiveInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
nsEventStatus ReceiveInputEvent(
|
||||
InputData& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId) override;
|
||||
|
||||
/**
|
||||
* Kicks an animation to zoom to a rect. This may be either a zoom out or zoom
|
||||
|
@ -213,9 +170,10 @@ public:
|
|||
* up. |aRect| must be given in CSS pixels, relative to the document.
|
||||
* |aFlags| is a combination of the ZoomToRectBehavior enum values.
|
||||
*/
|
||||
void ZoomToRect(const ScrollableLayerGuid& aGuid,
|
||||
const CSSRect& aRect,
|
||||
const uint32_t aFlags = DEFAULT_BEHAVIOR);
|
||||
void ZoomToRect(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const CSSRect& aRect,
|
||||
const uint32_t aFlags = DEFAULT_BEHAVIOR) override;
|
||||
|
||||
/**
|
||||
* If we have touch listeners, this should always be called when we know
|
||||
|
@ -224,7 +182,9 @@ public:
|
|||
* queue will be discarded. This function must be called on the controller
|
||||
* thread.
|
||||
*/
|
||||
void ContentReceivedInputBlock(uint64_t aInputBlockId, bool aPreventDefault);
|
||||
void ContentReceivedInputBlock(
|
||||
uint64_t aInputBlockId,
|
||||
bool aPreventDefault) override;
|
||||
|
||||
/**
|
||||
* When the event regions code is enabled, this function should be invoked to
|
||||
|
@ -237,8 +197,9 @@ public:
|
|||
* target, or the target is not a scrollable frame, the target's |mScrollId|
|
||||
* should be set to FrameMetrics::NULL_SCROLL_ID.
|
||||
*/
|
||||
void SetTargetAPZC(uint64_t aInputBlockId,
|
||||
const nsTArray<ScrollableLayerGuid>& aTargets);
|
||||
void SetTargetAPZC(
|
||||
uint64_t aInputBlockId,
|
||||
const nsTArray<ScrollableLayerGuid>& aTargets) override;
|
||||
|
||||
/**
|
||||
* Helper function for SetTargetAPZC when used with single-target events,
|
||||
|
@ -251,15 +212,16 @@ public:
|
|||
* If the |aConstraints| is Nothing() then previously-provided constraints for
|
||||
* the given |aGuid| are cleared.
|
||||
*/
|
||||
void UpdateZoomConstraints(const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints);
|
||||
void UpdateZoomConstraints(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints) override;
|
||||
|
||||
/**
|
||||
* Cancels any currently running animation. Note that all this does is set the
|
||||
* state of the AsyncPanZoomController back to NOTHING, but it is the
|
||||
* animation's responsibility to check this before advancing.
|
||||
*/
|
||||
void CancelAnimation(const ScrollableLayerGuid &aGuid);
|
||||
void CancelAnimation(const ScrollableLayerGuid &aGuid) override;
|
||||
|
||||
/**
|
||||
* Adjusts the root APZC to compensate for a shift in the surface. See the
|
||||
|
@ -267,7 +229,7 @@ public:
|
|||
* some more details. This is only currently needed due to surface shifts
|
||||
* caused by the dynamic toolbar on Android.
|
||||
*/
|
||||
void AdjustScrollForSurfaceShift(const ScreenPoint& aShift);
|
||||
void AdjustScrollForSurfaceShift(const ScreenPoint& aShift) override;
|
||||
|
||||
/**
|
||||
* Calls Destroy() on all APZC instances attached to the tree, and resets the
|
||||
|
@ -293,10 +255,10 @@ public:
|
|||
const ParentLayerPoint& aVelocity);
|
||||
|
||||
/**
|
||||
* Set the dpi value used by all AsyncPanZoomControllers.
|
||||
* Sets the dpi value used by all AsyncPanZoomControllers.
|
||||
* DPI defaults to 72 if not set using SetDPI() at any point.
|
||||
*/
|
||||
static void SetDPI(float aDpiValue) { sDPI = aDpiValue; }
|
||||
void SetDPI(float aDpiValue) override { sDPI = aDpiValue; }
|
||||
|
||||
/**
|
||||
* Returns the current dpi value in use.
|
||||
|
@ -318,8 +280,9 @@ public:
|
|||
* touch-session.
|
||||
* This must be called on the controller thread.
|
||||
*/
|
||||
void SetAllowedTouchBehavior(uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags>& aValues);
|
||||
void SetAllowedTouchBehavior(
|
||||
uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags>& aValues) override;
|
||||
|
||||
/**
|
||||
* This is a callback for AsyncPanZoomController to call when it wants to
|
||||
|
@ -401,8 +364,9 @@ public:
|
|||
void DispatchFling(AsyncPanZoomController* aApzc,
|
||||
FlingHandoffState& aHandoffState);
|
||||
|
||||
void StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
|
||||
const AsyncDragMetrics& aDragMetrics);
|
||||
void StartScrollbarDrag(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const AsyncDragMetrics& aDragMetrics) override;
|
||||
|
||||
/*
|
||||
* Build the chain of APZCs that will handle overscroll for a pan starting at |aInitialTarget|.
|
||||
|
@ -415,12 +379,20 @@ public:
|
|||
* On slow running tests, drags and touch events can be misinterpreted
|
||||
* as a long tap. This allows tests to disable long tap gesture detection.
|
||||
*/
|
||||
static void SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
void SetLongTapEnabled(bool aTapGestureEnabled) override;
|
||||
|
||||
protected:
|
||||
// Protected destructor, to discourage deletion outside of Release():
|
||||
virtual ~APZCTreeManager();
|
||||
|
||||
// Methods to help process WidgetInputEvents (or manage conversion to/from InputData)
|
||||
void TransformEventRefPoint(
|
||||
LayoutDeviceIntPoint* aRefPoint,
|
||||
ScrollableLayerGuid* aOutTargetGuid) override;
|
||||
void UpdateWheelTransaction(
|
||||
LayoutDeviceIntPoint aRefPoint,
|
||||
EventMessage aEventMessage) override;
|
||||
|
||||
// Protected hooks for gtests subclass
|
||||
virtual AsyncPanZoomController* NewAPZCInstance(uint64_t aLayersId,
|
||||
GeckoContentController* aController);
|
||||
|
@ -448,7 +420,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&);
|
||||
|
||||
|
@ -478,16 +450,6 @@ private:
|
|||
nsEventStatus ProcessTouchInput(MultiTouchInput& aInput,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
nsEventStatus ProcessWheelEvent(WidgetWheelEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
nsEventStatus ProcessEvent(WidgetInputEvent& inputEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
nsEventStatus ProcessMouseEvent(WidgetMouseEventBase& aInput,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
void UpdateWheelTransaction(WidgetInputEvent& aEvent);
|
||||
void FlushRepaintsToClearScreenToGeckoTransform();
|
||||
|
||||
already_AddRefed<HitTestingTreeNode> RecycleOrCreateNode(TreeBuildingState& aState,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/APZEventState.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "mozilla/layers/DoubleTapToZoom.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
@ -25,7 +25,7 @@ using namespace mozilla::widget;
|
|||
|
||||
ChromeProcessController::ChromeProcessController(nsIWidget* aWidget,
|
||||
APZEventState* aAPZEventState,
|
||||
APZCTreeManager* aAPZCTreeManager)
|
||||
IAPZCTreeManager* aAPZCTreeManager)
|
||||
: mWidget(aWidget)
|
||||
, mAPZEventState(aAPZEventState)
|
||||
, mAPZCTreeManager(aAPZCTreeManager)
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace mozilla {
|
|||
|
||||
namespace layers {
|
||||
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
class APZEventState;
|
||||
|
||||
// A ChromeProcessController is attached to the root of a compositor's layer
|
||||
|
@ -33,7 +33,7 @@ protected:
|
|||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
|
||||
public:
|
||||
explicit ChromeProcessController(nsIWidget* aWidget, APZEventState* aAPZEventState, APZCTreeManager* aAPZCTreeManager);
|
||||
explicit ChromeProcessController(nsIWidget* aWidget, APZEventState* aAPZEventState, IAPZCTreeManager* aAPZCTreeManager);
|
||||
~ChromeProcessController();
|
||||
virtual void Destroy() override;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
private:
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
RefPtr<APZEventState> mAPZEventState;
|
||||
RefPtr<APZCTreeManager> mAPZCTreeManager;
|
||||
RefPtr<IAPZCTreeManager> mAPZCTreeManager;
|
||||
MessageLoop* mUILoop;
|
||||
|
||||
void InitializeRoot();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layout/RenderFrameParent.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
|
@ -168,7 +168,7 @@ RemoteContentController::RecvZoomToRect(const uint32_t& aPresShellId,
|
|||
const CSSRect& aRect,
|
||||
const uint32_t& aFlags)
|
||||
{
|
||||
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
apzcTreeManager->ZoomToRect(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId),
|
||||
aRect, aFlags);
|
||||
}
|
||||
|
@ -185,10 +185,10 @@ RemoteContentController::RecvContentReceivedInputBlock(const ScrollableLayerGuid
|
|||
NS_ERROR("Unexpected layers id in RecvContentReceivedInputBlock; dropping message...");
|
||||
return false;
|
||||
}
|
||||
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<uint64_t,
|
||||
bool>(apzcTreeManager,
|
||||
&APZCTreeManager::ContentReceivedInputBlock,
|
||||
&IAPZCTreeManager::ContentReceivedInputBlock,
|
||||
aInputBlockId, aPreventDefault));
|
||||
|
||||
}
|
||||
|
@ -198,14 +198,14 @@ RemoteContentController::RecvContentReceivedInputBlock(const ScrollableLayerGuid
|
|||
bool
|
||||
RemoteContentController::RecvStartScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
|
||||
{
|
||||
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
ScrollableLayerGuid guid(mLayersId, aDragMetrics.mPresShellId,
|
||||
aDragMetrics.mViewId);
|
||||
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<ScrollableLayerGuid,
|
||||
AsyncDragMetrics>(apzcTreeManager,
|
||||
&APZCTreeManager::StartScrollbarDrag,
|
||||
&IAPZCTreeManager::StartScrollbarDrag,
|
||||
guid, aDragMetrics));
|
||||
}
|
||||
return true;
|
||||
|
@ -222,10 +222,10 @@ RemoteContentController::RecvSetTargetAPZC(const uint64_t& aInputBlockId,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
// need a local var to disambiguate between the SetTargetAPZC overloads.
|
||||
void (APZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||
= &APZCTreeManager::SetTargetAPZC;
|
||||
void (IAPZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||
= &IAPZCTreeManager::SetTargetAPZC;
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>
|
||||
|
@ -239,12 +239,12 @@ bool
|
|||
RemoteContentController::RecvSetAllowedTouchBehavior(const uint64_t& aInputBlockId,
|
||||
nsTArray<TouchBehaviorFlags>&& aFlags)
|
||||
{
|
||||
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByRRef<nsTArray<TouchBehaviorFlags>>>
|
||||
(apzcTreeManager,
|
||||
&APZCTreeManager::SetAllowedTouchBehavior,
|
||||
&IAPZCTreeManager::SetAllowedTouchBehavior,
|
||||
aInputBlockId, Move(aFlags)));
|
||||
}
|
||||
return true;
|
||||
|
@ -255,7 +255,7 @@ RemoteContentController::RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
|
|||
const ViewID& aViewId,
|
||||
const MaybeZoomConstraints& aConstraints)
|
||||
{
|
||||
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
if (RefPtr<IAPZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
|
||||
apzcTreeManager->UpdateZoomConstraints(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId),
|
||||
aConstraints);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ RemoteContentController::ChildAdopted()
|
|||
mApzcTreeManager = nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
already_AddRefed<IAPZCTreeManager>
|
||||
RemoteContentController::GetApzcTreeManager()
|
||||
{
|
||||
// We can't get a ref to the APZCTreeManager until after the child is
|
||||
|
@ -317,7 +317,7 @@ RemoteContentController::GetApzcTreeManager()
|
|||
if (!mApzcTreeManager) {
|
||||
mApzcTreeManager = GPUProcessManager::Get()->GetAPZCTreeManagerForLayers(mLayersId);
|
||||
}
|
||||
RefPtr<APZCTreeManager> apzcTreeManager(mApzcTreeManager);
|
||||
RefPtr<IAPZCTreeManager> apzcTreeManager(mApzcTreeManager);
|
||||
return apzcTreeManager.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class TabParent;
|
|||
|
||||
namespace layers {
|
||||
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
|
||||
/**
|
||||
* RemoteContentController uses the PAPZ protocol to implement a
|
||||
|
@ -98,7 +98,7 @@ private:
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return !!mBrowserParent;
|
||||
}
|
||||
already_AddRefed<APZCTreeManager> GetApzcTreeManager();
|
||||
already_AddRefed<IAPZCTreeManager> GetApzcTreeManager();
|
||||
|
||||
MessageLoop* mUILoop;
|
||||
uint64_t mLayersId;
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
// Mutex protecting members below accessed from multiple threads.
|
||||
mozilla::Mutex mMutex;
|
||||
|
||||
RefPtr<APZCTreeManager> mApzcTreeManager;
|
||||
RefPtr<IAPZCTreeManager> mApzcTreeManager;
|
||||
nsRegion mTouchSensitiveRegion;
|
||||
};
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ EXPORTS.mozilla.dom += [
|
|||
|
||||
EXPORTS.mozilla.layers += [
|
||||
'apz/public/GeckoContentController.h',
|
||||
'apz/public/IAPZCTreeManager.h',
|
||||
# exporting things from apz/src is temporary until we extract a
|
||||
# proper interface for the code there
|
||||
'apz/src/APZCTreeManager.h',
|
||||
|
@ -262,6 +263,7 @@ if CONFIG['MOZ_ANDROID_APZ']:
|
|||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'apz/public/IAPZCTreeManager.cpp',
|
||||
'apz/src/APZCTreeManager.cpp',
|
||||
'apz/src/AsyncPanZoomController.cpp',
|
||||
'apz/src/Axis.cpp',
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
#include "AndroidBridge.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
using mozilla::layers::APZCTreeManager;
|
||||
using mozilla::layers::IAPZCTreeManager;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
@ -26,7 +26,7 @@ AndroidContentController::Destroy()
|
|||
}
|
||||
|
||||
void
|
||||
AndroidContentController::NotifyDefaultPrevented(APZCTreeManager* aManager,
|
||||
AndroidContentController::NotifyDefaultPrevented(IAPZCTreeManager* aManager,
|
||||
uint64_t aInputBlockId,
|
||||
bool aDefaultPrevented)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ AndroidContentController::NotifyDefaultPrevented(APZCTreeManager* aManager,
|
|||
// APZ "controller" thread) but we get it from the Gecko thread, so we
|
||||
// have to throw it onto the other thread.
|
||||
AndroidBridge::Bridge()->PostTaskToUiThread(NewRunnableMethod<uint64_t, bool>(
|
||||
aManager, &APZCTreeManager::ContentReceivedInputBlock,
|
||||
aManager, &IAPZCTreeManager::ContentReceivedInputBlock,
|
||||
aInputBlockId, aDefaultPrevented), 0);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
class APZEventState;
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
}
|
||||
namespace widget {
|
||||
|
||||
|
@ -27,7 +27,7 @@ class AndroidContentController final
|
|||
public:
|
||||
AndroidContentController(nsWindow* aWindow,
|
||||
mozilla::layers::APZEventState* aAPZEventState,
|
||||
mozilla::layers::APZCTreeManager* aAPZCTreeManager)
|
||||
mozilla::layers::IAPZCTreeManager* aAPZCTreeManager)
|
||||
: mozilla::layers::ChromeProcessController(aWindow, aAPZEventState, aAPZCTreeManager)
|
||||
, mAndroidWindow(aWindow)
|
||||
{}
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
APZStateChange aChange,
|
||||
int aArg) override;
|
||||
|
||||
static void NotifyDefaultPrevented(mozilla::layers::APZCTreeManager* aManager,
|
||||
static void NotifyDefaultPrevented(mozilla::layers::IAPZCTreeManager* aManager,
|
||||
uint64_t aInputBlockId, bool aDefaultPrevented);
|
||||
private:
|
||||
nsWindow* mAndroidWindow;
|
||||
|
|
|
@ -58,9 +58,9 @@ using mozilla::Unused;
|
|||
#include "Layers.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/APZEventState.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLContextProvider.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
|
@ -472,7 +472,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<APZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<CompositorBridgeParent> compositor = mWindow->GetCompositorBridgeParent();
|
||||
if (controller && compositor) {
|
||||
// TODO: Pass in correct values for presShellId and viewId.
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<APZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
if (controller) {
|
||||
controller->AdjustScrollForSurfaceShift(
|
||||
ScreenPoint(aX, aY));
|
||||
|
@ -502,7 +502,10 @@ public:
|
|||
{
|
||||
MOZ_ASSERT(AndroidBridge::IsJavaUiThread());
|
||||
|
||||
APZCTreeManager::SetLongTapEnabled(aIsLongpressEnabled);
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
if (controller) {
|
||||
controller->SetLongTapEnabled(aIsLongpressEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
bool HandleScrollEvent(int64_t aTime, int32_t aMetaState,
|
||||
|
@ -517,7 +520,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<APZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
if (!controller) {
|
||||
return false;
|
||||
}
|
||||
|
@ -617,7 +620,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<APZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
if (!controller) {
|
||||
return false;
|
||||
}
|
||||
|
@ -710,7 +713,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<APZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
if (!controller) {
|
||||
return false;
|
||||
}
|
||||
|
@ -832,7 +835,7 @@ public:
|
|||
|
||||
void HandleMotionEventVelocity(int64_t aTime, float aSpeedY)
|
||||
{
|
||||
RefPtr<APZCTreeManager> controller = mWindow->mAPZC;
|
||||
RefPtr<IAPZCTreeManager> controller = mWindow->mAPZC;
|
||||
if (controller) {
|
||||
controller->ProcessTouchVelocity((uint32_t)aTime, aSpeedY);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ struct SwipeEventQueue;
|
|||
class VibrancyManager;
|
||||
namespace layers {
|
||||
class GLManager;
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
} // namespace layers
|
||||
namespace widget {
|
||||
class RectTextureImage;
|
||||
|
@ -292,7 +292,7 @@ class nsChildView : public nsBaseWidget
|
|||
{
|
||||
private:
|
||||
typedef nsBaseWidget Inherited;
|
||||
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
||||
typedef mozilla::layers::IAPZCTreeManager IAPZCTreeManager;
|
||||
|
||||
public:
|
||||
nsChildView();
|
||||
|
@ -422,7 +422,7 @@ public:
|
|||
nsIObserver* aObserver) override;
|
||||
|
||||
// Mac specific methods
|
||||
|
||||
|
||||
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event);
|
||||
|
||||
void WillPaintWindow();
|
||||
|
@ -500,7 +500,7 @@ public:
|
|||
void CleanupRemoteDrawing() override;
|
||||
bool InitCompositor(mozilla::layers::Compositor* aCompositor) override;
|
||||
|
||||
APZCTreeManager* APZCTM() { return mAPZC ; }
|
||||
IAPZCTreeManager* APZCTM() { return mAPZC ; }
|
||||
|
||||
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
||||
int32_t aPanelX, int32_t aPanelY,
|
||||
|
@ -575,7 +575,7 @@ protected:
|
|||
nsIWidget* mParentWidget;
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
// weak ref to this childview's associated mozAccessible for speed reasons
|
||||
// weak ref to this childview's associated mozAccessible for speed reasons
|
||||
// (we get queried for it *a lot* but don't want to own it)
|
||||
nsWeakPtr mAccessible;
|
||||
#endif
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include "GLContextCGL.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
#include "HeapCopyOfStackArray.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/GLManager.h"
|
||||
#include "mozilla/layers/CompositorOGL.h"
|
||||
|
@ -198,7 +198,7 @@ static uint32_t gNumberOfWidgetsNeedingEventThread = 0;
|
|||
#endif
|
||||
|
||||
- (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
|
||||
- (APZCTreeManager*)apzctm;
|
||||
- (IAPZCTreeManager*)apzctm;
|
||||
|
||||
- (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent;
|
||||
- (void)updateWindowDraggableState;
|
||||
|
@ -4870,7 +4870,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||
|
||||
- (void)handleAsyncScrollEvent:(CGEventRef)cgEvent ofType:(CGEventType)type
|
||||
{
|
||||
APZCTreeManager* apzctm = [self apzctm];
|
||||
IAPZCTreeManager* apzctm = [self apzctm];
|
||||
if (!apzctm) {
|
||||
return;
|
||||
}
|
||||
|
@ -5518,7 +5518,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||
return mGeckoChild->CocoaPointsToDevPixels(localPoint);
|
||||
}
|
||||
|
||||
- (APZCTreeManager*)apzctm
|
||||
- (IAPZCTreeManager*)apzctm
|
||||
{
|
||||
return mGeckoChild ? mGeckoChild->APZCTM() : nullptr;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "mozilla/unused.h"
|
||||
#include "mozilla/IMEStateManager.h"
|
||||
#include "mozilla/VsyncDispatcher.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
#include "mozilla/layers/APZEventState.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/ChromeProcessController.h"
|
||||
|
@ -994,7 +994,7 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
|
|||
|
||||
mAPZC->SetDPI(GetDPI());
|
||||
|
||||
RefPtr<APZCTreeManager> treeManager = mAPZC; // for capture by the lambdas
|
||||
RefPtr<IAPZCTreeManager> treeManager = mAPZC; // for capture by the lambdas
|
||||
|
||||
ContentReceivedInputBlockCallback callback(
|
||||
[treeManager](const ScrollableLayerGuid& aGuid,
|
||||
|
@ -1004,7 +1004,7 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t, bool>(treeManager,
|
||||
&APZCTreeManager::ContentReceivedInputBlock,
|
||||
&IAPZCTreeManager::ContentReceivedInputBlock,
|
||||
aInputBlockId,
|
||||
aPreventDefault));
|
||||
});
|
||||
|
@ -1017,7 +1017,7 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
|
|||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t,
|
||||
StoreCopyPassByLRef<nsTArray<TouchBehaviorFlags>>>(treeManager,
|
||||
&APZCTreeManager::SetAllowedTouchBehavior,
|
||||
&IAPZCTreeManager::SetAllowedTouchBehavior,
|
||||
aInputBlockId, aFlags));
|
||||
};
|
||||
|
||||
|
@ -1046,8 +1046,8 @@ nsBaseWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
|||
const nsTArray<ScrollableLayerGuid>& aTargets) const
|
||||
{
|
||||
// Need to specifically bind this since it's overloaded.
|
||||
void (APZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||
= &APZCTreeManager::SetTargetAPZC;
|
||||
void (IAPZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||
= &IAPZCTreeManager::SetTargetAPZC;
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<uint64_t, StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(mAPZC,
|
||||
setTargetApzcFunc,
|
||||
|
@ -1183,7 +1183,7 @@ class DispatchWheelInputOnControllerThread : public Runnable
|
|||
{
|
||||
public:
|
||||
DispatchWheelInputOnControllerThread(const WidgetWheelEvent& aWheelEvent,
|
||||
APZCTreeManager* aAPZC,
|
||||
IAPZCTreeManager* aAPZC,
|
||||
nsBaseWidget* aWidget)
|
||||
: mMainMessageLoop(MessageLoop::current())
|
||||
, mWheelInput(aWheelEvent)
|
||||
|
@ -1207,7 +1207,7 @@ public:
|
|||
private:
|
||||
MessageLoop* mMainMessageLoop;
|
||||
ScrollWheelInput mWheelInput;
|
||||
RefPtr<APZCTreeManager> mAPZC;
|
||||
RefPtr<IAPZCTreeManager> mAPZC;
|
||||
nsBaseWidget* mWidget;
|
||||
nsEventStatus mAPZResult;
|
||||
uint64_t mInputBlockId;
|
||||
|
@ -1311,20 +1311,24 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
|
|||
|
||||
RefPtr<ClientLayerManager> lm = new ClientLayerManager(this);
|
||||
|
||||
bool useAPZ = UseAPZ();
|
||||
|
||||
gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
|
||||
mCompositorSession = gpu->CreateTopLevelCompositor(
|
||||
this,
|
||||
lm,
|
||||
GetDefaultScale(),
|
||||
UseAPZ(),
|
||||
useAPZ,
|
||||
UseExternalCompositingSurface(),
|
||||
gfx::IntSize(aWidth, aHeight));
|
||||
mCompositorBridgeChild = mCompositorSession->GetCompositorBridgeChild();
|
||||
mCompositorWidgetDelegate = mCompositorSession->GetCompositorWidgetDelegate();
|
||||
|
||||
mAPZC = mCompositorSession->GetAPZCTreeManager();
|
||||
if (mAPZC) {
|
||||
if (useAPZ) {
|
||||
mAPZC = mCompositorSession->GetAPZCTreeManager();
|
||||
ConfigureAPZCTreeManager();
|
||||
} else {
|
||||
mAPZC = nullptr;
|
||||
}
|
||||
|
||||
if (mInitialZoomConstraints) {
|
||||
|
@ -1939,7 +1943,7 @@ nsBaseWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
|
|||
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod
|
||||
<ScrollableLayerGuid, AsyncDragMetrics>(mAPZC,
|
||||
&APZCTreeManager::StartScrollbarDrag,
|
||||
&IAPZCTreeManager::StartScrollbarDrag,
|
||||
guid, aDragMetrics));
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace layers {
|
|||
class BasicLayerManager;
|
||||
class CompositorBridgeChild;
|
||||
class CompositorBridgeParent;
|
||||
class APZCTreeManager;
|
||||
class IAPZCTreeManager;
|
||||
class GeckoContentController;
|
||||
class APZEventState;
|
||||
class CompositorSession;
|
||||
|
@ -119,7 +119,7 @@ protected:
|
|||
typedef mozilla::layers::BufferMode BufferMode;
|
||||
typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild;
|
||||
typedef mozilla::layers::CompositorBridgeParent CompositorBridgeParent;
|
||||
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
||||
typedef mozilla::layers::IAPZCTreeManager IAPZCTreeManager;
|
||||
typedef mozilla::layers::GeckoContentController GeckoContentController;
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
typedef mozilla::layers::APZEventState APZEventState;
|
||||
|
@ -609,7 +609,7 @@ protected:
|
|||
RefPtr<CompositorSession> mCompositorSession;
|
||||
RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
|
||||
RefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
|
||||
RefPtr<APZCTreeManager> mAPZC;
|
||||
RefPtr<IAPZCTreeManager> mAPZC;
|
||||
RefPtr<GeckoContentController> mRootContentController;
|
||||
RefPtr<APZEventState> mAPZEventState;
|
||||
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
|
||||
|
|
Загрузка…
Ссылка в новой задаче