зеркало из https://github.com/mozilla/gecko-dev.git
Bug 770371 - Add a margin to the tappable area for copying selected text [r=margaret]
This commit is contained in:
Родитель
44034475aa
Коммит
9942c1c338
|
@ -1746,8 +1746,11 @@ var SelectionHandler = {
|
||||||
win = win.parent;
|
win = win.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (aX - offset.x > this.cache.rect.left && aX - offset.x < this.cache.rect.right) &&
|
let radius = ElementTouchHelper.getTouchRadius();
|
||||||
(aY - offset.y > this.cache.rect.top && aY - offset.y < this.cache.rect.bottom);
|
return (aX - offset.x > this.cache.rect.left - radius.left &&
|
||||||
|
aX - offset.x < this.cache.rect.right + radius.right &&
|
||||||
|
aY - offset.y > this.cache.rect.top - radius.top &&
|
||||||
|
aY - offset.y < this.cache.rect.bottom + radius.bottom);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns true if the selection has been reversed. Takes optional aIsStartHandle
|
// Returns true if the selection has been reversed. Takes optional aIsStartHandle
|
||||||
|
@ -3623,6 +3626,19 @@ const ElementTouchHelper = {
|
||||||
return elem;
|
return elem;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* Returns the touch radius in content px. */
|
||||||
|
getTouchRadius: function getTouchRadius() {
|
||||||
|
let dpiRatio = ViewportHandler.displayDPI / kReferenceDpi;
|
||||||
|
let zoom = BrowserApp.selectedTab._zoom;
|
||||||
|
return {
|
||||||
|
top: this.radius.top * dpiRatio / zoom,
|
||||||
|
right: this.radius.right * dpiRatio / zoom,
|
||||||
|
bottom: this.radius.bottom * dpiRatio / zoom,
|
||||||
|
left: this.radius.left * dpiRatio / zoom
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Returns the touch radius in reference pixels. */
|
||||||
get radius() {
|
get radius() {
|
||||||
let prefs = Services.prefs;
|
let prefs = Services.prefs;
|
||||||
delete this.radius;
|
delete this.radius;
|
||||||
|
@ -3640,11 +3656,6 @@ const ElementTouchHelper = {
|
||||||
|
|
||||||
/* Retrieve the closest element to a point by looking at borders position */
|
/* Retrieve the closest element to a point by looking at borders position */
|
||||||
getClosest: function getClosest(aWindowUtils, aX, aY) {
|
getClosest: function getClosest(aWindowUtils, aX, aY) {
|
||||||
if (!this.dpiRatio)
|
|
||||||
this.dpiRatio = aWindowUtils.displayDPI / kReferenceDpi;
|
|
||||||
|
|
||||||
let dpiRatio = this.dpiRatio;
|
|
||||||
|
|
||||||
let target = aWindowUtils.elementFromPoint(aX, aY,
|
let target = aWindowUtils.elementFromPoint(aX, aY,
|
||||||
true, /* ignore root scroll frame*/
|
true, /* ignore root scroll frame*/
|
||||||
false); /* don't flush layout */
|
false); /* don't flush layout */
|
||||||
|
@ -3657,11 +3668,8 @@ const ElementTouchHelper = {
|
||||||
return target;
|
return target;
|
||||||
|
|
||||||
target = null;
|
target = null;
|
||||||
let zoom = BrowserApp.selectedTab._zoom;
|
let radius = this.getTouchRadius();
|
||||||
let nodes = aWindowUtils.nodesFromRect(aX, aY, this.radius.top * dpiRatio / zoom,
|
let nodes = aWindowUtils.nodesFromRect(aX, aY, radius.top, radius.right, radius.bottom, radius.left, true, false);
|
||||||
this.radius.right * dpiRatio / zoom,
|
|
||||||
this.radius.bottom * dpiRatio / zoom,
|
|
||||||
this.radius.left * dpiRatio / zoom, true, false);
|
|
||||||
|
|
||||||
let threshold = Number.POSITIVE_INFINITY;
|
let threshold = Number.POSITIVE_INFINITY;
|
||||||
for (let i = 0; i < nodes.length; i++) {
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче