зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1502010) for Gtest failure. CLOSED TREE
Backed out changeset e9e34c0b62ac (bug 1502010) Backed out changeset 67c5cdc1e812 (bug 1502010) Backed out changeset f324774fb863 (bug 1502010)
This commit is contained in:
Родитель
e7b6520ec9
Коммит
2628d08611
|
@ -40,18 +40,6 @@ CalculatePendingDisplayPort(const FrameMetrics& aFrameMetrics,
|
|||
aFrameMetrics, aVelocity);
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
IsCloseToHorizontal(float aAngle, float aThreshold)
|
||||
{
|
||||
return (aAngle < aThreshold || aAngle > (M_PI - aThreshold));
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
IsCloseToVertical(float aAngle, float aThreshold)
|
||||
{
|
||||
return (fabs(aAngle - (M_PI / 2)) < aThreshold);
|
||||
}
|
||||
|
||||
} // namespace apz
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -131,16 +131,6 @@ void InitializeGlobalState();
|
|||
const ScreenMargin CalculatePendingDisplayPort(const FrameMetrics& aFrameMetrics,
|
||||
const ParentLayerPoint& aVelocity);
|
||||
|
||||
/**
|
||||
* Is aAngle within the given threshold of the horizontal axis?
|
||||
* @param aAngle an angle in radians in the range [0, pi]
|
||||
* @param aThreshold an angle in radians in the range [0, pi/2]
|
||||
*/
|
||||
bool IsCloseToHorizontal(float aAngle, float aThreshold);
|
||||
|
||||
// As above, but for the vertical axis.
|
||||
bool IsCloseToVertical(float aAngle, float aThreshold);
|
||||
|
||||
} // namespace apz
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -524,6 +524,22 @@ static bool IsHighMemSystem()
|
|||
return gIsHighMemSystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is aAngle within the given threshold of the horizontal axis?
|
||||
* @param aAngle an angle in radians in the range [0, pi]
|
||||
* @param aThreshold an angle in radians in the range [0, pi/2]
|
||||
*/
|
||||
static bool IsCloseToHorizontal(float aAngle, float aThreshold)
|
||||
{
|
||||
return (aAngle < aThreshold || aAngle > (M_PI - aThreshold));
|
||||
}
|
||||
|
||||
// As above, but for the vertical axis.
|
||||
static bool IsCloseToVertical(float aAngle, float aThreshold)
|
||||
{
|
||||
return (fabs(aAngle - (M_PI / 2)) < aThreshold);
|
||||
}
|
||||
|
||||
// Counter used to give each APZC a unique id
|
||||
static uint32_t sAsyncPanZoomControllerCount = 0;
|
||||
|
||||
|
@ -955,49 +971,33 @@ AsyncPanZoomController::GetSecondTapTolerance() const
|
|||
}
|
||||
|
||||
bool
|
||||
AsyncPanZoomController::ArePointerEventsConsumable(TouchBlockState* aBlock, const MultiTouchInput& aInput) {
|
||||
uint32_t touchPoints = aInput.mTouches.Length();
|
||||
if (touchPoints == 0) {
|
||||
AsyncPanZoomController::ArePointerEventsConsumable(TouchBlockState* aBlock, uint32_t aTouchPoints) {
|
||||
if (aTouchPoints == 0) {
|
||||
// Cant' do anything with zero touch points
|
||||
return false;
|
||||
}
|
||||
|
||||
// This logic is simplified, erring on the side of returning true if we're
|
||||
// not sure. It's safer to pretend that we can consume the event and then
|
||||
// not be able to than vice-versa. But at the same time, we should try hard
|
||||
// to return an accurate result, because returning true can trigger a
|
||||
// pointercancel event to web content, which can break certain features
|
||||
// that are using touch-action and handling the pointermove events.
|
||||
//
|
||||
// This logic is simplified, erring on the side of returning true
|
||||
// if we're not sure. It's safer to pretend that we can consume the
|
||||
// event and then not be able to than vice-versa.
|
||||
// We could probably enhance this logic to determine things like "we're
|
||||
// not pannable, so we can only zoom in, and the zoom is already maxed
|
||||
// out, so we're not zoomable either" but no need for that at this point.
|
||||
|
||||
bool pannableX = aBlock->TouchActionAllowsPanningX() &&
|
||||
aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(this, ScrollDirection::eHorizontal);
|
||||
bool pannableY = aBlock->TouchActionAllowsPanningY() &&
|
||||
aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(this, ScrollDirection::eVertical);
|
||||
|
||||
bool pannable;
|
||||
|
||||
Maybe<ScrollDirection> panDirection = aBlock->GetBestGuessPanDirection(aInput);
|
||||
if (panDirection == Some(ScrollDirection::eVertical)) {
|
||||
pannable = pannableY;
|
||||
} else if (panDirection == Some(ScrollDirection::eHorizontal)) {
|
||||
pannable = pannableX;
|
||||
} else {
|
||||
// If we don't have a guessed pan direction, err on the side of returning true.
|
||||
pannable = pannableX || pannableY;
|
||||
}
|
||||
|
||||
if (touchPoints == 1) {
|
||||
return pannable;
|
||||
}
|
||||
|
||||
bool pannable = aBlock->GetOverscrollHandoffChain()->CanBePanned(this);
|
||||
bool zoomable = mZoomConstraints.mAllowZoom;
|
||||
|
||||
pannable &= (aBlock->TouchActionAllowsPanningX() || aBlock->TouchActionAllowsPanningY());
|
||||
zoomable &= (aBlock->TouchActionAllowsPinchZoom());
|
||||
|
||||
return pannable || zoomable;
|
||||
// XXX once we fix bug 1031443, consumable should be assigned
|
||||
// pannable || zoomable if aTouchPoints > 1.
|
||||
bool consumable = (aTouchPoints == 1 ? pannable : zoomable);
|
||||
if (!consumable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent,
|
||||
|
@ -2765,10 +2765,10 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
|||
overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::eVertical);
|
||||
if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
|
||||
if (canScrollHorizontal && canScrollVertical) {
|
||||
if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_X);
|
||||
} else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
} else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
} else {
|
||||
|
@ -2782,7 +2782,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
|||
} else if (GetCurrentTouchBlock()->TouchActionAllowsPanningX()) {
|
||||
// Using bigger angle for panning to keep behavior consistent
|
||||
// with IE.
|
||||
if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_X);
|
||||
mPanDirRestricted = true;
|
||||
|
@ -2792,7 +2792,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
|||
SetState(NOTHING);
|
||||
}
|
||||
} else if (GetCurrentTouchBlock()->TouchActionAllowsPanningY()) {
|
||||
if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
if (IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
mPanDirRestricted = true;
|
||||
|
@ -2823,12 +2823,12 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
|
|||
|
||||
if (!canScrollHorizontal || !canScrollVertical) {
|
||||
SetState(PANNING);
|
||||
} else if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
} else if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
if (canScrollHorizontal) {
|
||||
SetState(PANNING_LOCKED_X);
|
||||
}
|
||||
} else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
} else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
if (canScrollVertical) {
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
|
@ -2849,12 +2849,12 @@ void AsyncPanZoomController::HandlePanningUpdate(const ScreenPoint& aPanDistance
|
|||
|
||||
if (fabs(aPanDistance.x) > breakThreshold || fabs(aPanDistance.y) > breakThreshold) {
|
||||
if (mState == PANNING_LOCKED_X) {
|
||||
if (!apz::IsCloseToHorizontal(angle, gfxPrefs::APZAxisBreakoutAngle())) {
|
||||
if (!IsCloseToHorizontal(angle, gfxPrefs::APZAxisBreakoutAngle())) {
|
||||
mY.SetAxisLocked(false);
|
||||
SetState(PANNING);
|
||||
}
|
||||
} else if (mState == PANNING_LOCKED_Y) {
|
||||
if (!apz::IsCloseToVertical(angle, gfxPrefs::APZAxisBreakoutAngle())) {
|
||||
if (!IsCloseToVertical(angle, gfxPrefs::APZAxisBreakoutAngle())) {
|
||||
mX.SetAxisLocked(false);
|
||||
SetState(PANNING);
|
||||
}
|
||||
|
|
|
@ -1215,12 +1215,12 @@ public:
|
|||
void FlushRepaintForNewInputBlock();
|
||||
|
||||
/**
|
||||
* Given an input event and the touch block it belongs to, check if the
|
||||
* event can lead to a panning/zooming behavior.
|
||||
* Given the number of touch points in an input event and touch block they
|
||||
* belong to, check if the event can result in a panning/zooming behavior.
|
||||
* This is primarily used to figure out when to dispatch the pointercancel
|
||||
* event for the pointer events spec.
|
||||
*/
|
||||
bool ArePointerEventsConsumable(TouchBlockState* aBlock, const MultiTouchInput& aInput);
|
||||
bool ArePointerEventsConsumable(TouchBlockState* aBlock, uint32_t aTouchPoints);
|
||||
|
||||
/**
|
||||
* Clear internal state relating to touch input handling.
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "InputBlockState.h"
|
||||
|
||||
#include "APZUtils.h"
|
||||
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
|
||||
#include "ScrollAnimationPhysics.h" // for kScrollSeriesTimeoutMs
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
|
@ -910,29 +909,6 @@ TouchBlockState::UpdateSlopState(const MultiTouchInput& aInput,
|
|||
return mInSlop;
|
||||
}
|
||||
|
||||
Maybe<ScrollDirection>
|
||||
TouchBlockState::GetBestGuessPanDirection(const MultiTouchInput& aInput)
|
||||
{
|
||||
if (aInput.mType != MultiTouchInput::MULTITOUCH_MOVE ||
|
||||
aInput.mTouches.Length() != 1) {
|
||||
return Nothing();
|
||||
}
|
||||
ScreenPoint vector = aInput.mTouches[0].mScreenPoint - mSlopOrigin;
|
||||
double angle = atan2(vector.y, vector.x); // range [-pi, pi]
|
||||
angle = fabs(angle); // range [0, pi]
|
||||
|
||||
double angleThreshold = TouchActionAllowsPanningXY()
|
||||
? gfxPrefs::APZAxisLockAngle()
|
||||
: gfxPrefs::APZAllowedDirectPanAngle();
|
||||
if (apz::IsCloseToHorizontal(angle, angleThreshold)) {
|
||||
return Some(ScrollDirection::eHorizontal);
|
||||
}
|
||||
if (apz::IsCloseToVertical(angle, angleThreshold)) {
|
||||
return Some(ScrollDirection::eVertical);
|
||||
}
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
TouchBlockState::GetActiveTouchCount() const
|
||||
{
|
||||
|
|
|
@ -484,13 +484,6 @@ public:
|
|||
bool UpdateSlopState(const MultiTouchInput& aInput,
|
||||
bool aApzcCanConsumeEvents);
|
||||
|
||||
/**
|
||||
* Based on the slop origin and the given input event, return a best guess
|
||||
* as to the pan direction of this touch block. Returns Nothing() if no guess
|
||||
* can be made.
|
||||
*/
|
||||
Maybe<ScrollDirection> GetBestGuessPanDirection(const MultiTouchInput& aInput);
|
||||
|
||||
/**
|
||||
* Returns the number of touch points currently active.
|
||||
*/
|
||||
|
|
|
@ -151,7 +151,7 @@ InputQueue::ReceiveTouchInput(const RefPtr<AsyncPanZoomController>& aTarget,
|
|||
if (block->IsDuringFastFling()) {
|
||||
INPQ_LOG("dropping event due to block %p being in fast motion\n", block);
|
||||
result = nsEventStatus_eConsumeNoDefault;
|
||||
} else if (target && target->ArePointerEventsConsumable(block, aEvent)) {
|
||||
} else if (target && target->ArePointerEventsConsumable(block, aEvent.mTouches.Length())) {
|
||||
if (block->UpdateSlopState(aEvent, true)) {
|
||||
INPQ_LOG("dropping event due to block %p being in slop\n", block);
|
||||
result = nsEventStatus_eConsumeNoDefault;
|
||||
|
|
Загрузка…
Ссылка в новой задаче