Bug 826025 - Part 2: Add some variables to cache properties which are accessed many times. r=cpeterson

This commit is contained in:
Tetsuharu OHZEKI 2013-01-03 17:18:44 -05:00
parent 80f48cde90
commit 22d74b47e2

View File

@ -3942,12 +3942,12 @@ var BrowserEventHandler = {
// subject to minor rounding errors because of zoom values. I've seen values
// like 0.99 come in here and get truncated to 0; this avoids that problem.
let zoom = BrowserApp.selectedTab._zoom;
data.x = Math.round(data.x / zoom);
data.y = Math.round(data.y / zoom);
let x = Math.round(data.x / zoom);
let y = Math.round(data.y / zoom);
if (this._firstScrollEvent) {
while (this._scrollableElement != null &&
!this._elementCanScroll(this._scrollableElement, data.x, data.y))
!this._elementCanScroll(this._scrollableElement, x, y))
this._scrollableElement = this._findScrollableElement(this._scrollableElement, false);
let doc = BrowserApp.selectedBrowser.contentDocument;
@ -3962,8 +3962,8 @@ var BrowserEventHandler = {
}
// Scroll the scrollable element
if (this._elementCanScroll(this._scrollableElement, data.x, data.y)) {
this._scrollElementBy(this._scrollableElement, data.x, data.y);
if (this._elementCanScroll(this._scrollableElement, x, y)) {
this._scrollElementBy(this._scrollableElement, x, y);
sendMessageToJava({ gecko: { type: "Gesture:ScrollAck", scrolled: true } });
SelectionHandler.subdocumentScrolled(this._scrollableElement);
} else {
@ -3982,14 +3982,15 @@ var BrowserEventHandler = {
if (element) {
try {
let data = JSON.parse(aData);
let [x, y] = [data.x, data.y];
if (ElementTouchHelper.isElementClickable(element)) {
[data.x, data.y] = this._moveClickPoint(element, data.x, data.y);
element = ElementTouchHelper.anyElementFromPoint(data.x, data.y);
[x, y] = this._moveClickPoint(element, x, y);
element = ElementTouchHelper.anyElementFromPoint(x, y);
}
this._sendMouseEvent("mousemove", element, data.x, data.y);
this._sendMouseEvent("mousedown", element, data.x, data.y);
this._sendMouseEvent("mouseup", element, data.x, data.y);
this._sendMouseEvent("mousemove", element, x, y);
this._sendMouseEvent("mousedown", element, x, y);
this._sendMouseEvent("mouseup", element, x, y);
// See if its a input element
if ((element instanceof HTMLInputElement && element.mozIsTextField(false)) ||