forked from mirrors/gecko-dev
Backed out changeset f9699ae30f4d (bug 1213601) on jrmuizel's request.
This commit is contained in:
parent
88ee2d5b6d
commit
6fbdaf61c3
10 changed files with 51 additions and 218 deletions
|
|
@ -1821,8 +1821,8 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus AsyncPanZoomController::HandleEndOfPan() {
|
nsEventStatus AsyncPanZoomController::HandleEndOfPan() {
|
||||||
MOZ_ASSERT(GetCurrentTouchBlock() || GetCurrentPanGestureBlock());
|
MOZ_ASSERT(GetCurrentTouchBlock());
|
||||||
GetCurrentInputBlock()->GetOverscrollHandoffChain()->FlushRepaints();
|
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->FlushRepaints();
|
||||||
ParentLayerPoint flingVelocity = GetVelocityVector();
|
ParentLayerPoint flingVelocity = GetVelocityVector();
|
||||||
|
|
||||||
// Clear our velocities; if DispatchFling() gives the fling to us,
|
// Clear our velocities; if DispatchFling() gives the fling to us,
|
||||||
|
|
@ -1844,7 +1844,7 @@ nsEventStatus AsyncPanZoomController::HandleEndOfPan() {
|
||||||
if (flingVelocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) {
|
if (flingVelocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) {
|
||||||
// Relieve overscroll now if needed, since we will not transition to a fling
|
// Relieve overscroll now if needed, since we will not transition to a fling
|
||||||
// animation and then an overscroll animation, and relieve it then.
|
// animation and then an overscroll animation, and relieve it then.
|
||||||
GetCurrentInputBlock()
|
GetCurrentTouchBlock()
|
||||||
->GetOverscrollHandoffChain()
|
->GetOverscrollHandoffChain()
|
||||||
->SnapBackOverscrolledApzc(this);
|
->SnapBackOverscrolledApzc(this);
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
|
|
@ -1855,8 +1855,8 @@ nsEventStatus AsyncPanZoomController::HandleEndOfPan() {
|
||||||
// which nulls out mTreeManager, could be called concurrently.
|
// which nulls out mTreeManager, could be called concurrently.
|
||||||
if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) {
|
if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) {
|
||||||
const FlingHandoffState handoffState{
|
const FlingHandoffState handoffState{
|
||||||
flingVelocity, GetCurrentInputBlock()->GetOverscrollHandoffChain(),
|
flingVelocity, GetCurrentTouchBlock()->GetOverscrollHandoffChain(),
|
||||||
false /* not handoff */, GetCurrentInputBlock()->GetScrolledApzc()};
|
false /* not handoff */, GetCurrentTouchBlock()->GetScrolledApzc()};
|
||||||
treeManagerLocal->DispatchFling(this, handoffState);
|
treeManagerLocal->DispatchFling(this, handoffState);
|
||||||
}
|
}
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
|
|
@ -2555,35 +2555,6 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent,
|
||||||
ScreenPoint physicalPanDisplacement = aEvent.mPanDisplacement;
|
ScreenPoint physicalPanDisplacement = aEvent.mPanDisplacement;
|
||||||
ParentLayerPoint logicalPanDisplacement =
|
ParentLayerPoint logicalPanDisplacement =
|
||||||
aEvent.UserMultipliedLocalPanDisplacement();
|
aEvent.UserMultipliedLocalPanDisplacement();
|
||||||
if (aEvent.mDeltaType == PanGestureInput::PANDELTA_PAGE) {
|
|
||||||
// Pan events with page units are used by Gtk, so this replicates Gtk:
|
|
||||||
// https://gitlab.gnome.org/GNOME/gtk/blob/c734c7e9188b56f56c3a504abee05fa40c5475ac/gtk/gtkrange.c#L3065-3073
|
|
||||||
CSSSize pageScrollSize;
|
|
||||||
CSSToParentLayerScale2D zoom;
|
|
||||||
{
|
|
||||||
// Grab the lock to access the frame metrics.
|
|
||||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
|
||||||
pageScrollSize = mScrollMetadata.GetPageScrollAmount() /
|
|
||||||
Metrics().GetDevPixelsPerCSSPixel();
|
|
||||||
zoom = Metrics().GetZoom();
|
|
||||||
}
|
|
||||||
// scrollUnit* is in units of "ParentLayer pixels per page proportion"...
|
|
||||||
auto scrollUnitWidth = std::min(std::pow(pageScrollSize.width, 2.0 / 3.0),
|
|
||||||
pageScrollSize.width / 2.0) *
|
|
||||||
zoom.xScale;
|
|
||||||
auto scrollUnitHeight = std::min(std::pow(pageScrollSize.height, 2.0 / 3.0),
|
|
||||||
pageScrollSize.height / 2.0) *
|
|
||||||
zoom.yScale;
|
|
||||||
// ... and pan displacements are in units of "page proportion count"
|
|
||||||
// here, so the products of them and scrollUnit* are in ParentLayer pixels
|
|
||||||
ParentLayerPoint physicalPanDisplacementPL(
|
|
||||||
physicalPanDisplacement.x * scrollUnitWidth,
|
|
||||||
physicalPanDisplacement.y * scrollUnitHeight);
|
|
||||||
physicalPanDisplacement = ToScreenCoordinates(physicalPanDisplacementPL,
|
|
||||||
aEvent.mLocalPanStartPoint);
|
|
||||||
logicalPanDisplacement.x *= scrollUnitWidth;
|
|
||||||
logicalPanDisplacement.y *= scrollUnitHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_ASSERT(GetCurrentPanGestureBlock());
|
MOZ_ASSERT(GetCurrentPanGestureBlock());
|
||||||
AdjustDeltaForAllowedScrollDirections(
|
AdjustDeltaForAllowedScrollDirections(
|
||||||
|
|
@ -2600,9 +2571,9 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent,
|
||||||
// aEvent.mLocalStartPoint) would mess up velocity calculation. (This is
|
// aEvent.mLocalStartPoint) would mess up velocity calculation. (This is
|
||||||
// the only caller of UpdateWithTouchAtDevicePoint() for pan events, so
|
// the only caller of UpdateWithTouchAtDevicePoint() for pan events, so
|
||||||
// there is no risk of other calls resetting the position.)
|
// there is no risk of other calls resetting the position.)
|
||||||
mX.UpdateWithTouchAtDevicePoint(mX.GetPos() - logicalPanDisplacement.x,
|
mX.UpdateWithTouchAtDevicePoint(mX.GetPos() + logicalPanDisplacement.x,
|
||||||
aEvent.mTime);
|
aEvent.mTime);
|
||||||
mY.UpdateWithTouchAtDevicePoint(mY.GetPos() - logicalPanDisplacement.y,
|
mY.UpdateWithTouchAtDevicePoint(mY.GetPos() + logicalPanDisplacement.y,
|
||||||
aEvent.mTime);
|
aEvent.mTime);
|
||||||
|
|
||||||
HandlePanningUpdate(physicalPanDisplacement);
|
HandlePanningUpdate(physicalPanDisplacement);
|
||||||
|
|
@ -2637,12 +2608,6 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
|
||||||
mX.EndTouch(aEvent.mTime);
|
mX.EndTouch(aEvent.mTime);
|
||||||
mY.EndTouch(aEvent.mTime);
|
mY.EndTouch(aEvent.mTime);
|
||||||
|
|
||||||
// Use HandleEndOfPan for fling on platforms that don't
|
|
||||||
// emit momentum events (Gtk).
|
|
||||||
if (aEvent.mSimulateMomentum) {
|
|
||||||
return HandleEndOfPan();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop any velocity on axes where we don't have room to scroll anyways
|
// Drop any velocity on axes where we don't have room to scroll anyways
|
||||||
// (in this APZC, or an APZC further in the handoff chain).
|
// (in this APZC, or an APZC further in the handoff chain).
|
||||||
// This ensures that we don't enlarge the display port unnecessarily.
|
// This ensures that we don't enlarge the display port unnecessarily.
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,25 @@ struct ParamTraits<mozilla::layers::CompositableHandle> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper class for reading bitfields.
|
||||||
|
// If T has bitfields members, derive ParamTraits<T> from BitfieldHelper<T>.
|
||||||
|
template <typename ParamType>
|
||||||
|
struct BitfieldHelper {
|
||||||
|
// We need this helper because we can't get the address of a bitfield to
|
||||||
|
// pass directly to ReadParam. So instead we read it into a temporary bool
|
||||||
|
// and set the bitfield using a setter function
|
||||||
|
static bool ReadBoolForBitfield(const Message* aMsg, PickleIterator* aIter,
|
||||||
|
ParamType* aResult,
|
||||||
|
void (ParamType::*aSetter)(bool)) {
|
||||||
|
bool value;
|
||||||
|
if (ReadParam(aMsg, aIter, &value)) {
|
||||||
|
(aResult->*aSetter)(value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<mozilla::layers::FrameMetrics>
|
struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||||
: BitfieldHelper<mozilla::layers::FrameMetrics> {
|
: BitfieldHelper<mozilla::layers::FrameMetrics> {
|
||||||
|
|
|
||||||
|
|
@ -1088,25 +1088,6 @@ struct ParamTraits<nsILoadInfo::CrossOriginPolicy>
|
||||||
: EnumSerializer<nsILoadInfo::CrossOriginPolicy,
|
: EnumSerializer<nsILoadInfo::CrossOriginPolicy,
|
||||||
CrossOriginPolicyValidator> {};
|
CrossOriginPolicyValidator> {};
|
||||||
|
|
||||||
// Helper class for reading bitfields.
|
|
||||||
// If T has bitfields members, derive ParamTraits<T> from BitfieldHelper<T>.
|
|
||||||
template <typename ParamType>
|
|
||||||
struct BitfieldHelper {
|
|
||||||
// We need this helper because we can't get the address of a bitfield to
|
|
||||||
// pass directly to ReadParam. So instead we read it into a temporary bool
|
|
||||||
// and set the bitfield using a setter function
|
|
||||||
static bool ReadBoolForBitfield(const Message* aMsg, PickleIterator* aIter,
|
|
||||||
ParamType* aResult,
|
|
||||||
void (ParamType::*aSetter)(bool)) {
|
|
||||||
bool value;
|
|
||||||
if (ReadParam(aMsg, aIter, &value)) {
|
|
||||||
(aResult->*aSetter)(value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} /* namespace IPC */
|
} /* namespace IPC */
|
||||||
|
|
||||||
#endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */
|
#endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,7 @@ WidgetWheelEvent PanGestureInput::ToWidgetWheelEvent(nsIWidget* aWidget) const {
|
||||||
mPanStartPoint,
|
mPanStartPoint,
|
||||||
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
||||||
wheelEvent.mButtons = 0;
|
wheelEvent.mButtons = 0;
|
||||||
|
wheelEvent.mDeltaMode = WheelEvent_Binding::DOM_DELTA_PIXEL;
|
||||||
wheelEvent.mMayHaveMomentum = true; // pan inputs may have momentum
|
wheelEvent.mMayHaveMomentum = true; // pan inputs may have momentum
|
||||||
wheelEvent.mIsMomentum = IsMomentum();
|
wheelEvent.mIsMomentum = IsMomentum();
|
||||||
wheelEvent.mLineOrPageDeltaX = mLineOrPageDeltaX;
|
wheelEvent.mLineOrPageDeltaX = mLineOrPageDeltaX;
|
||||||
|
|
@ -485,16 +486,6 @@ WidgetWheelEvent PanGestureInput::ToWidgetWheelEvent(nsIWidget* aWidget) const {
|
||||||
wheelEvent.mDeltaY = mPanDisplacement.y;
|
wheelEvent.mDeltaY = mPanDisplacement.y;
|
||||||
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
||||||
wheelEvent.mFocusSequenceNumber = mFocusSequenceNumber;
|
wheelEvent.mFocusSequenceNumber = mFocusSequenceNumber;
|
||||||
if (mDeltaType == PanGestureInput::PANDELTA_PAGE) {
|
|
||||||
// Emulate legacy widget/gtk behavior
|
|
||||||
wheelEvent.mDeltaMode = WheelEvent_Binding::DOM_DELTA_LINE;
|
|
||||||
wheelEvent.mIsNoLineOrPageDelta = true;
|
|
||||||
wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY;
|
|
||||||
wheelEvent.mDeltaX *= 3;
|
|
||||||
wheelEvent.mDeltaY *= 3;
|
|
||||||
} else {
|
|
||||||
wheelEvent.mDeltaMode = WheelEvent_Binding::DOM_DELTA_PIXEL;
|
|
||||||
}
|
|
||||||
return wheelEvent;
|
return wheelEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -507,14 +498,6 @@ bool PanGestureInput::TransformToLocal(
|
||||||
}
|
}
|
||||||
mLocalPanStartPoint = *panStartPoint;
|
mLocalPanStartPoint = *panStartPoint;
|
||||||
|
|
||||||
if (mDeltaType == PanGestureInput::PANDELTA_PAGE) {
|
|
||||||
// Skip transforming the pan displacement because we want
|
|
||||||
// raw page proportion counts.
|
|
||||||
mLocalPanDisplacement.x = mPanDisplacement.x;
|
|
||||||
mLocalPanDisplacement.y = mPanDisplacement.y;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Maybe<ParentLayerPoint> panDisplacement =
|
Maybe<ParentLayerPoint> panDisplacement =
|
||||||
UntransformVector(aTransform, mPanDisplacement, mPanStartPoint);
|
UntransformVector(aTransform, mPanDisplacement, mPanStartPoint);
|
||||||
if (!panDisplacement) {
|
if (!panDisplacement) {
|
||||||
|
|
|
||||||
|
|
@ -332,17 +332,6 @@ class PanGestureInput : public InputData {
|
||||||
// user has stopped the animation by putting their fingers on a touchpad.
|
// user has stopped the animation by putting their fingers on a touchpad.
|
||||||
PANGESTURE_MOMENTUMEND
|
PANGESTURE_MOMENTUMEND
|
||||||
));
|
));
|
||||||
|
|
||||||
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
||||||
PanDeltaType, (
|
|
||||||
// There are three kinds of scroll delta modes in Gecko: "page", "line"
|
|
||||||
// and "pixel". Touchpad pan gestures only support "page" and "pixel".
|
|
||||||
//
|
|
||||||
// NOTE: PANDELTA_PAGE currently replicates Gtk behavior
|
|
||||||
// (see AsyncPanZoomController::OnPan).
|
|
||||||
PANDELTA_PAGE,
|
|
||||||
PANDELTA_PIXEL
|
|
||||||
));
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
PanGestureInput(PanGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
|
PanGestureInput(PanGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
|
||||||
|
|
@ -379,13 +368,11 @@ class PanGestureInput : public InputData {
|
||||||
double mUserDeltaMultiplierX;
|
double mUserDeltaMultiplierX;
|
||||||
double mUserDeltaMultiplierY;
|
double mUserDeltaMultiplierY;
|
||||||
|
|
||||||
PanDeltaType mDeltaType = PANDELTA_PIXEL;
|
bool mHandledByAPZ;
|
||||||
|
|
||||||
bool mHandledByAPZ : 1;
|
|
||||||
|
|
||||||
// true if this is a PANGESTURE_END event that will be followed by a
|
// true if this is a PANGESTURE_END event that will be followed by a
|
||||||
// PANGESTURE_MOMENTUMSTART event.
|
// PANGESTURE_MOMENTUMSTART event.
|
||||||
bool mFollowedByMomentum : 1;
|
bool mFollowedByMomentum;
|
||||||
|
|
||||||
// If this is true, and this event started a new input block that couldn't
|
// If this is true, and this event started a new input block that couldn't
|
||||||
// find a scrollable target which is scrollable in the horizontal component
|
// find a scrollable target which is scrollable in the horizontal component
|
||||||
|
|
@ -393,32 +380,15 @@ class PanGestureInput : public InputData {
|
||||||
// hold until a content response has arrived, even if the block has a
|
// hold until a content response has arrived, even if the block has a
|
||||||
// confirmed target.
|
// confirmed target.
|
||||||
// This is used by events that can result in a swipe instead of a scroll.
|
// This is used by events that can result in a swipe instead of a scroll.
|
||||||
bool mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection : 1;
|
bool mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection;
|
||||||
|
|
||||||
// This is used by APZ to communicate to the macOS widget code whether
|
// This is used by APZ to communicate to the macOS widget code whether
|
||||||
// the overscroll-behavior of the scroll frame handling this swipe allows
|
// the overscroll-behavior of the scroll frame handling this swipe allows
|
||||||
// non-local overscroll behaviors in the horizontal direction (such as
|
// non-local overscroll behaviors in the horizontal direction (such as
|
||||||
// swipe navigation).
|
// swipe navigation).
|
||||||
bool mOverscrollBehaviorAllowsSwipe : 1;
|
bool mOverscrollBehaviorAllowsSwipe;
|
||||||
|
|
||||||
// true if APZ should do a fling animation after this pan ends, like
|
// XXX: If adding any more bools, switch to using bitfields instead.
|
||||||
// it would with touchscreens. (For platforms that don't emit momentum
|
|
||||||
// events.)
|
|
||||||
bool mSimulateMomentum : 1;
|
|
||||||
|
|
||||||
void SetHandledByAPZ(bool aHandled) { mHandledByAPZ = aHandled; }
|
|
||||||
void SetFollowedByMomentum(bool aFollowed) {
|
|
||||||
mFollowedByMomentum = aFollowed;
|
|
||||||
}
|
|
||||||
void SetRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(
|
|
||||||
bool aRequires) {
|
|
||||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection =
|
|
||||||
aRequires;
|
|
||||||
}
|
|
||||||
void SetOverscrollBehaviorAllowsSwipe(bool aAllows) {
|
|
||||||
mOverscrollBehaviorAllowsSwipe = aAllows;
|
|
||||||
}
|
|
||||||
void SetSimulateMomentum(bool aSimulate) { mSimulateMomentum = aSimulate; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,6 @@ using namespace mozilla::widget;
|
||||||
#include "mozilla/layers/CompositorThread.h"
|
#include "mozilla/layers/CompositorThread.h"
|
||||||
#include "mozilla/layers/KnowsCompositor.h"
|
#include "mozilla/layers/KnowsCompositor.h"
|
||||||
|
|
||||||
#include "mozilla/layers/APZInputBridge.h"
|
|
||||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
|
||||||
|
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
# include "GLContextGLX.h" // for GLContextGLX::FindVisual()
|
# include "GLContextGLX.h" // for GLContextGLX::FindVisual()
|
||||||
# include "GtkCompositorWidget.h"
|
# include "GtkCompositorWidget.h"
|
||||||
|
|
@ -3003,7 +3000,6 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
|
||||||
if (aEvent->direction != GDK_SCROLL_SMOOTH &&
|
if (aEvent->direction != GDK_SCROLL_SMOOTH &&
|
||||||
mLastScrollEventTime == aEvent->time)
|
mLastScrollEventTime == aEvent->time)
|
||||||
return;
|
return;
|
||||||
mLastScrollEventTime = aEvent->time;
|
|
||||||
#endif
|
#endif
|
||||||
WidgetWheelEvent wheelEvent(true, eWheel, this);
|
WidgetWheelEvent wheelEvent(true, eWheel, this);
|
||||||
wheelEvent.mDeltaMode = dom::WheelEvent_Binding::DOM_DELTA_LINE;
|
wheelEvent.mDeltaMode = dom::WheelEvent_Binding::DOM_DELTA_LINE;
|
||||||
|
|
@ -3011,52 +3007,21 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
|
||||||
#if GTK_CHECK_VERSION(3, 4, 0)
|
#if GTK_CHECK_VERSION(3, 4, 0)
|
||||||
case GDK_SCROLL_SMOOTH: {
|
case GDK_SCROLL_SMOOTH: {
|
||||||
// As of GTK 3.4, all directional scroll events are provided by
|
// As of GTK 3.4, all directional scroll events are provided by
|
||||||
// the GDK_SCROLL_SMOOTH direction on XInput2 and Wayland devices.
|
// the GDK_SCROLL_SMOOTH direction on XInput2 devices.
|
||||||
|
mLastScrollEventTime = aEvent->time;
|
||||||
// Special handling for touchpads to support flings
|
|
||||||
// (also known as kinetic/inertial/momentum scrolling)
|
|
||||||
GdkDevice* device = gdk_event_get_source_device((GdkEvent*)aEvent);
|
|
||||||
GdkInputSource source = gdk_device_get_source(device);
|
|
||||||
if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD) {
|
|
||||||
if (gtk_check_version(3, 20, 0) == nullptr) {
|
|
||||||
static auto sGdkEventIsScrollStopEvent =
|
|
||||||
(gboolean(*)(const GdkEvent*))dlsym(
|
|
||||||
RTLD_DEFAULT, "gdk_event_is_scroll_stop_event");
|
|
||||||
|
|
||||||
PanGestureInput::PanGestureType eventType =
|
|
||||||
PanGestureInput::PANGESTURE_PAN;
|
|
||||||
if (sGdkEventIsScrollStopEvent((GdkEvent*)aEvent)) {
|
|
||||||
eventType = PanGestureInput::PANGESTURE_END;
|
|
||||||
mPanInProgress = false;
|
|
||||||
} else if (!mPanInProgress) {
|
|
||||||
eventType = PanGestureInput::PANGESTURE_START;
|
|
||||||
mPanInProgress = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutDeviceIntPoint touchPoint = GetRefPoint(this, aEvent);
|
|
||||||
PanGestureInput panEvent(
|
|
||||||
eventType, aEvent->time, GetEventTimeStamp(aEvent->time),
|
|
||||||
ScreenPoint(touchPoint.x, touchPoint.y),
|
|
||||||
ScreenPoint(aEvent->delta_x, aEvent->delta_y),
|
|
||||||
KeymapWrapper::ComputeKeyModifiers(aEvent->state));
|
|
||||||
panEvent.mDeltaType = PanGestureInput::PANDELTA_PAGE;
|
|
||||||
panEvent.mSimulateMomentum = true;
|
|
||||||
|
|
||||||
DispatchPanGestureInput(panEvent);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Older GTK doesn't support stop events, so we can't support fling
|
|
||||||
// there
|
|
||||||
wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO - use a more appropriate scrolling unit than lines.
|
// TODO - use a more appropriate scrolling unit than lines.
|
||||||
// Multiply event deltas by 3 to emulate legacy behaviour.
|
// Multiply event deltas by 3 to emulate legacy behaviour.
|
||||||
wheelEvent.mDeltaX = aEvent->delta_x * 3;
|
wheelEvent.mDeltaX = aEvent->delta_x * 3;
|
||||||
wheelEvent.mDeltaY = aEvent->delta_y * 3;
|
wheelEvent.mDeltaY = aEvent->delta_y * 3;
|
||||||
wheelEvent.mIsNoLineOrPageDelta = true;
|
wheelEvent.mIsNoLineOrPageDelta = true;
|
||||||
|
// This next step manually unsets smooth scrolling for touch devices
|
||||||
|
// that trigger GDK_SCROLL_SMOOTH. We use the slave device, which
|
||||||
|
// represents the actual input.
|
||||||
|
GdkDevice* device = gdk_event_get_source_device((GdkEvent*)aEvent);
|
||||||
|
GdkInputSource source = gdk_device_get_source(device);
|
||||||
|
if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD) {
|
||||||
|
wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -4277,8 +4242,7 @@ LayoutDeviceIntSize nsWindow::GetSafeWindowSize(LayoutDeviceIntSize aSize) {
|
||||||
LayoutDeviceIntSize result = aSize;
|
LayoutDeviceIntSize result = aSize;
|
||||||
int32_t maxSize = 32767;
|
int32_t maxSize = 32767;
|
||||||
if (mLayerManager && mLayerManager->AsKnowsCompositor()) {
|
if (mLayerManager && mLayerManager->AsKnowsCompositor()) {
|
||||||
maxSize = std::min(maxSize,
|
maxSize = std::min(maxSize, mLayerManager->AsKnowsCompositor()->GetMaxTextureSize());
|
||||||
mLayerManager->AsKnowsCompositor()->GetMaxTextureSize());
|
|
||||||
}
|
}
|
||||||
if (result.width > maxSize) {
|
if (result.width > maxSize) {
|
||||||
result.width = maxSize;
|
result.width = maxSize;
|
||||||
|
|
|
||||||
|
|
@ -491,8 +491,6 @@ class nsWindow final : public nsBaseWidget {
|
||||||
// This field omits duplicate scroll events caused by GNOME bug 726878.
|
// This field omits duplicate scroll events caused by GNOME bug 726878.
|
||||||
guint32 mLastScrollEventTime;
|
guint32 mLastScrollEventTime;
|
||||||
|
|
||||||
bool mPanInProgress = false;
|
|
||||||
|
|
||||||
// for touch event handling
|
// for touch event handling
|
||||||
nsRefPtrHashtable<nsPtrHashKey<GdkEventSequence>, mozilla::dom::Touch>
|
nsRefPtrHashtable<nsPtrHashKey<GdkEventSequence>, mozilla::dom::Touch>
|
||||||
mTouches;
|
mTouches;
|
||||||
|
|
|
||||||
|
|
@ -1096,29 +1096,6 @@ void nsBaseWidget::DispatchTouchInput(MultiTouchInput& aInput) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsBaseWidget::DispatchPanGestureInput(PanGestureInput& aInput) {
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
if (mAPZC) {
|
|
||||||
MOZ_ASSERT(APZThreadUtils::IsControllerThread());
|
|
||||||
uint64_t inputBlockId = 0;
|
|
||||||
ScrollableLayerGuid guid;
|
|
||||||
|
|
||||||
nsEventStatus result =
|
|
||||||
mAPZC->InputBridge()->ReceiveInputEvent(aInput, &guid, &inputBlockId);
|
|
||||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetWheelEvent event = aInput.ToWidgetWheelEvent(this);
|
|
||||||
ProcessUntransformedAPZEvent(&event, guid, inputBlockId, result);
|
|
||||||
} else {
|
|
||||||
WidgetWheelEvent event = aInput.ToWidgetWheelEvent(this);
|
|
||||||
|
|
||||||
nsEventStatus status;
|
|
||||||
DispatchEvent(&event, status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsEventStatus nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent) {
|
nsEventStatus nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent) {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
if (mAPZC) {
|
if (mAPZC) {
|
||||||
|
|
|
||||||
|
|
@ -618,14 +618,6 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
*/
|
*/
|
||||||
void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
|
void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch the given PanGestureInput through APZ to Gecko (if APZ is enabled)
|
|
||||||
* or directly to gecko (if APZ is not enabled). This function must only
|
|
||||||
* be called from the main thread, and if APZ is enabled, that must also be
|
|
||||||
* the APZ controller thread.
|
|
||||||
*/
|
|
||||||
void DispatchPanGestureInput(mozilla::PanGestureInput& aInput);
|
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
void UpdateScrollCapture() override;
|
void UpdateScrollCapture() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1211,15 +1211,7 @@ struct ParamTraits<mozilla::PanGestureInput::PanGestureType>
|
||||||
mozilla::PanGestureInput::sHighestPanGestureType> {};
|
mozilla::PanGestureInput::sHighestPanGestureType> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<mozilla::PanGestureInput::PanDeltaType>
|
struct ParamTraits<mozilla::PanGestureInput> {
|
||||||
: public ContiguousEnumSerializerInclusive<
|
|
||||||
mozilla::PanGestureInput::PanDeltaType,
|
|
||||||
mozilla::PanGestureInput::PanDeltaType::PANDELTA_PAGE,
|
|
||||||
mozilla::PanGestureInput::sHighestPanDeltaType> {};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ParamTraits<mozilla::PanGestureInput>
|
|
||||||
: BitfieldHelper<mozilla::PanGestureInput> {
|
|
||||||
typedef mozilla::PanGestureInput paramType;
|
typedef mozilla::PanGestureInput paramType;
|
||||||
|
|
||||||
static void Write(Message* aMsg, const paramType& aParam) {
|
static void Write(Message* aMsg, const paramType& aParam) {
|
||||||
|
|
@ -1233,7 +1225,6 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||||
WriteParam(aMsg, aParam.mLineOrPageDeltaY);
|
WriteParam(aMsg, aParam.mLineOrPageDeltaY);
|
||||||
WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
|
WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
|
||||||
WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
|
WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
|
||||||
WriteParam(aMsg, aParam.mDeltaType);
|
|
||||||
WriteParam(aMsg, aParam.mHandledByAPZ);
|
WriteParam(aMsg, aParam.mHandledByAPZ);
|
||||||
WriteParam(aMsg, aParam.mFollowedByMomentum);
|
WriteParam(aMsg, aParam.mFollowedByMomentum);
|
||||||
WriteParam(
|
WriteParam(
|
||||||
|
|
@ -1241,7 +1232,6 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||||
aParam
|
aParam
|
||||||
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
||||||
WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
|
WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
|
||||||
WriteParam(aMsg, aParam.mSimulateMomentum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||||
|
|
@ -1256,19 +1246,13 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||||
ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
|
ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
|
||||||
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
|
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
|
||||||
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
|
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
|
||||||
ReadParam(aMsg, aIter, &aResult->mDeltaType) &&
|
ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
|
||||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
ReadParam(aMsg, aIter, &aResult->mFollowedByMomentum) &&
|
||||||
¶mType::SetHandledByAPZ) &&
|
ReadParam(
|
||||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
aMsg, aIter,
|
||||||
¶mType::SetFollowedByMomentum) &&
|
&aResult
|
||||||
ReadBoolForBitfield(
|
->mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection) &&
|
||||||
aMsg, aIter, aResult,
|
ReadParam(aMsg, aIter, &aResult->mOverscrollBehaviorAllowsSwipe);
|
||||||
¶mType::
|
|
||||||
SetRequiresContentResponseIfCannotScrollHorizontallyInStartDirection) &&
|
|
||||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
|
||||||
¶mType::SetOverscrollBehaviorAllowsSwipe) &&
|
|
||||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
|
||||||
¶mType::SetSimulateMomentum);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue