Bug 1307100 - Add handlesOffset only if height > 0. r?sebastian draft
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 05 Oct 2016 13:47:11 +0800
changeset 421012 99ca3998b944a40daea973f0cda98548f9bfb6fc
parent 420990 ea104eeb14cc54da9a06c3766da63f73117723a0
child 532949 23947b099ec1a188db8ad0ea64f8cb321ee6513f
push id31354
push userbmo:tlin@mozilla.com
push dateWed, 05 Oct 2016 05:52:07 +0000
reviewerssebastian
bugs1307100
milestone52.0a1
Bug 1307100 - Add handlesOffset only if height > 0. r?sebastian Per bug 1307100 comment 3, we use "height equals to 0" to hide the floating toolbar so we only need to adjust the handlesOffset when height > 0. MozReview-Commit-ID: AdIOxIFUrI
mobile/android/base/java/org/mozilla/gecko/text/FloatingToolbarTextSelection.java
--- a/mobile/android/base/java/org/mozilla/gecko/text/FloatingToolbarTextSelection.java
+++ b/mobile/android/base/java/org/mozilla/gecko/text/FloatingToolbarTextSelection.java
@@ -192,14 +192,15 @@ public class FloatingToolbarTextSelectio
 
             final float zoomFactor = layerView.getZoomFactor();
             layerView.getLocationInWindow(locationInWindow);
 
             contentRect = new Rect(
                     (int) (x * zoomFactor + locationInWindow[0]),
                     (int) (y * zoomFactor + locationInWindow[1]),
                     (int) ((x + width) * zoomFactor + locationInWindow[0]),
-                    (int) ((y + height) * zoomFactor + locationInWindow[1] + handlesOffset));
+                    (int) ((y + height) * zoomFactor + locationInWindow[1] +
+                           (height > 0 ? handlesOffset : 0)));
         } catch (JSONException e) {
             Log.w(LOGTAG, "Could not calculate content rect", e);
         }
     }
 }