mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1063227 - Make APZ axis locking constants preffable. r=kats
--HG-- extra : source : 83f2d844c5a9833a40b2d0d9021597652e707a1a
This commit is contained in:
parent
f3923b6fad
commit
861c3c7394
@ -971,7 +971,7 @@ pref("apz.x_stationary_size_multiplier", "1.5");
|
||||
pref("apz.y_stationary_size_multiplier", "1.8");
|
||||
pref("apz.enlarge_displayport_when_clipped", true);
|
||||
// Use "sticky" axis locking
|
||||
pref("apz.axis_lock_mode", 2);
|
||||
pref("apz.axis_lock.mode", 2);
|
||||
pref("apz.subframe.enabled", true);
|
||||
|
||||
// Overscroll-related settings
|
||||
|
@ -57,7 +57,7 @@ pref("apz.x_skate_size_multiplier", "2.5");
|
||||
pref("apz.y_skate_size_multiplier", "2.5");
|
||||
pref("apz.min_skate_speed", "10.0");
|
||||
// 0 = free, 1 = standard, 2 = sticky
|
||||
pref("apz.axis_lock_mode", 2);
|
||||
pref("apz.axis_lock.mode", 2);
|
||||
pref("apz.cross_slide.enabled", true);
|
||||
pref("apz.subframe.enabled", true);
|
||||
|
||||
|
@ -151,9 +151,29 @@ typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
||||
* The timeout for mAsyncScrollTimeoutTask delay task.
|
||||
* Units: milliseconds
|
||||
*
|
||||
* "apz.axis_lock_mode"
|
||||
* "apz.axis_lock.mode"
|
||||
* The preferred axis locking style. See AxisLockMode for possible values.
|
||||
*
|
||||
* "apz.axis_lock.lock_angle"
|
||||
* Angle from axis within which we stay axis-locked.
|
||||
* Units: radians
|
||||
*
|
||||
* "apz.axis_lock.breakout_threshold"
|
||||
* Distance in inches the user must pan before axis lock can be broken.
|
||||
* Units: (real-world, i.e. screen) inches
|
||||
*
|
||||
* "apz.axis_lock.breakout_angle"
|
||||
* Angle at which axis lock can be broken.
|
||||
* Units: radians
|
||||
*
|
||||
* "apz.axis_lock.direct_pan_angle"
|
||||
* If the angle from an axis to the line drawn by a pan move is less than
|
||||
* this value, we can assume that panning can be done in the allowed direction
|
||||
* (horizontal or vertical).
|
||||
* Currently used only for touch-action css property stuff and was addded to
|
||||
* keep behaviour consistent with IE.
|
||||
* Units: radians
|
||||
*
|
||||
* "apz.content_response_timeout"
|
||||
* Amount of time before we timeout response from content. For example, if
|
||||
* content is being unruly/slow and we don't get a response back within this
|
||||
@ -323,30 +343,6 @@ typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
||||
* Units: ms
|
||||
*/
|
||||
|
||||
/**
|
||||
* Angle from axis within which we stay axis-locked
|
||||
*/
|
||||
static const double AXIS_LOCK_ANGLE = M_PI / 6.0; // 30 degrees
|
||||
|
||||
/**
|
||||
* The distance in inches the user must pan before axis lock can be broken
|
||||
*/
|
||||
static const float AXIS_BREAKOUT_THRESHOLD = 1.0f/32.0f;
|
||||
|
||||
/**
|
||||
* The angle at which axis lock can be broken
|
||||
*/
|
||||
static const double AXIS_BREAKOUT_ANGLE = M_PI / 8.0; // 22.5 degrees
|
||||
|
||||
/**
|
||||
* Angle from axis to the line drawn by pan move.
|
||||
* If angle is less than this value we can assume that panning
|
||||
* can be done in allowed direction (horizontal or vertical).
|
||||
* Currently used only for touch-action css property stuff and was
|
||||
* added to keep behavior consistent with IE.
|
||||
*/
|
||||
static const double ALLOWED_DIRECT_PAN_ANGLE = M_PI / 3.0; // 60 degrees
|
||||
|
||||
/**
|
||||
* Computed time function used for sampling frames of a zoom to animation.
|
||||
*/
|
||||
@ -1712,10 +1708,10 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
||||
// enabled by default.
|
||||
if (CurrentTouchBlock()->TouchActionAllowsPanningXY()) {
|
||||
if (mX.CanScrollNow() && mY.CanScrollNow()) {
|
||||
if (IsCloseToHorizontal(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_X);
|
||||
} else if (IsCloseToVertical(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
} else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
} else {
|
||||
@ -1729,7 +1725,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
||||
} else if (CurrentTouchBlock()->TouchActionAllowsPanningX()) {
|
||||
// Using bigger angle for panning to keep behavior consistent
|
||||
// with IE.
|
||||
if (IsCloseToHorizontal(aAngle, ALLOWED_DIRECT_PAN_ANGLE)) {
|
||||
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_X);
|
||||
mPanDirRestricted = true;
|
||||
@ -1739,7 +1735,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
||||
SetState(NOTHING);
|
||||
}
|
||||
} else if (CurrentTouchBlock()->TouchActionAllowsPanningY()) {
|
||||
if (IsCloseToVertical(aAngle, ALLOWED_DIRECT_PAN_ANGLE)) {
|
||||
if (IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
mPanDirRestricted = true;
|
||||
@ -1755,7 +1751,7 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!gfxPrefs::APZCrossSlideEnabled() && (!mX.CanScrollNow() || !mY.CanScrollNow())) {
|
||||
SetState(PANNING);
|
||||
} else if (IsCloseToHorizontal(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
} else if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
if (mX.CanScrollNow()) {
|
||||
SetState(PANNING_LOCKED_X);
|
||||
@ -1763,7 +1759,7 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
|
||||
SetState(CROSS_SLIDING_X);
|
||||
mX.SetAxisLocked(true);
|
||||
}
|
||||
} else if (IsCloseToVertical(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
} else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
if (mY.CanScrollNow()) {
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
@ -1783,16 +1779,16 @@ void AsyncPanZoomController::HandlePanningUpdate(float aDX, float aDY) {
|
||||
double angle = atan2(aDY, aDX); // range [-pi, pi]
|
||||
angle = fabs(angle); // range [0, pi]
|
||||
|
||||
float breakThreshold = AXIS_BREAKOUT_THRESHOLD * APZCTreeManager::GetDPI();
|
||||
float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * APZCTreeManager::GetDPI();
|
||||
|
||||
if (fabs(aDX) > breakThreshold || fabs(aDY) > breakThreshold) {
|
||||
if (mState == PANNING_LOCKED_X || mState == CROSS_SLIDING_X) {
|
||||
if (!IsCloseToHorizontal(angle, AXIS_BREAKOUT_ANGLE)) {
|
||||
if (!IsCloseToHorizontal(angle, gfxPrefs::APZAxisBreakoutAngle())) {
|
||||
mY.SetAxisLocked(false);
|
||||
SetState(PANNING);
|
||||
}
|
||||
} else if (mState == PANNING_LOCKED_Y || mState == CROSS_SLIDING_Y) {
|
||||
if (!IsCloseToVertical(angle, AXIS_BREAKOUT_ANGLE)) {
|
||||
if (!IsCloseToVertical(angle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(false);
|
||||
SetState(PANNING);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Constants.h" // for M_PI
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
// First time gfxPrefs::GetSingleton() needs to be called on the main thread,
|
||||
@ -132,7 +133,11 @@ private:
|
||||
DECL_GFX_PREF(Live, "apz.allow_checkerboarding", APZAllowCheckerboarding, bool, true);
|
||||
DECL_GFX_PREF(Live, "apz.asyncscroll.throttle", APZAsyncScrollThrottleTime, int32_t, 100);
|
||||
DECL_GFX_PREF(Live, "apz.asyncscroll.timeout", APZAsyncScrollTimeout, int32_t, 300);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock_mode", APZAxisLockMode, int32_t, 0);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.mode", APZAxisLockMode, int32_t, 0);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle", APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold", APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle", APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle", APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
|
||||
DECL_GFX_PREF(Live, "apz.content_response_timeout", APZContentResponseTimeout, int32_t, 300);
|
||||
DECL_GFX_PREF(Live, "apz.cross_slide.enabled", APZCrossSlideEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.danger_zone_x", APZDangerZoneX, int32_t, 50);
|
||||
|
@ -439,8 +439,11 @@ pref("apz.asyncscroll.timeout", 300);
|
||||
// 0 = FREE (No locking at all)
|
||||
// 1 = STANDARD (Once locked, remain locked until scrolling ends)
|
||||
// 2 = STICKY (Allow lock to be broken, with hysteresis)
|
||||
pref("apz.axis_lock_mode", 0);
|
||||
|
||||
pref("apz.axis_lock.mode", 0);
|
||||
pref("apz.axis_lock.lock_angle", "0.5235987"); // PI / 6 (30 degrees)
|
||||
pref("apz.axis_lock.breakout_threshold", "0.03125"); // 1/32 inches
|
||||
pref("apz.axis_lock.breakout_angle", "0.3926991"); // PI / 8 (22.5 degrees)
|
||||
pref("apz.axis_lock.direct_pan_angle", "1.047197"); // PI / 3 (60 degrees)
|
||||
pref("apz.content_response_timeout", 300);
|
||||
pref("apz.cross_slide.enabled", false);
|
||||
pref("apz.danger_zone_x", 50);
|
||||
|
Loading…
Reference in New Issue
Block a user