From b2e7f360ff7ef3baee572bac59254b5dd89d9254 Mon Sep 17 00:00:00 2001 From: Max Li Date: Tue, 9 Jul 2013 09:55:03 -0400 Subject: [PATCH] Bug 890940 - Visual bounds box is very wrong. r=eeejay Also fix EBT coordinates --- accessible/src/jsat/AccessFu.jsm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/accessible/src/jsat/AccessFu.jsm b/accessible/src/jsat/AccessFu.jsm index 8d0a92353f26..5651436977c8 100644 --- a/accessible/src/jsat/AccessFu.jsm +++ b/accessible/src/jsat/AccessFu.jsm @@ -509,7 +509,7 @@ var Output = { for each (let androidEvent in aDetails) { androidEvent.type = 'Accessibility:Event'; if (androidEvent.bounds) - androidEvent.bounds = this._adjustBounds(androidEvent.bounds, aBrowser); + androidEvent.bounds = this._adjustBounds(androidEvent.bounds, aBrowser, true); if (androidEvent.eventType === ANDROID_VIEW_TEXT_CHANGED) { androidEvent.brailleText = this.brailleState.update(androidEvent.text); } @@ -530,7 +530,7 @@ var Output = { Logger.debug('Braille output: ' + aDetails.text); }, - _adjustBounds: function(aJsonBounds, aBrowser) { + _adjustBounds: function(aJsonBounds, aBrowser, aIncludeZoom) { let bounds = new Rect(aJsonBounds.left, aJsonBounds.top, aJsonBounds.right - aJsonBounds.left, aJsonBounds.bottom - aJsonBounds.top); @@ -548,8 +548,13 @@ var Output = { offset.top += clientRect.top + win.mozInnerScreenY; } - return bounds.scale(scale, scale).translate(offset.left, offset.top). - scale(vp.zoom, vp.zoom).expandToIntegers(); + let newBounds = bounds.scale(scale, scale).translate(offset.left, offset.top); + + if (aIncludeZoom) { + newBounds = newBounds.scale(vp.zoom, vp.zoom); + } + + return newBounds.expandToIntegers(); } }; @@ -579,6 +584,9 @@ var Input = { this._handleKeypress(aEvent); break; case 'mozAccessFuGesture': + let vp = Utils.getViewport(Utils.win) || { zoom: 1.0 }; + aEvent.detail.x *= vp.zoom; + aEvent.detail.y *= vp.zoom; this._handleGesture(aEvent.detail); break; }