Bug 1307100 - Add handlesOffset only if height > 0. r=sebastian, a=ritu
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 05 Oct 2016 13:47:11 +0800
changeset 340527 2583041da3fcc262f616dab06abe6a5bd39b0e08
parent 340526 5b3bccfe462b65f6021b7ddc99adb5c317fa3729
child 340528 b3ed087a00417c2df14aee87127ee3ddbca56e2e
push id10127
push usercbook@mozilla.com
push dateWed, 12 Oct 2016 07:51:57 +0000
treeherdermozilla-aurora@ff79bdf882fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, ritu
bugs1307100
milestone51.0a2
Bug 1307100 - Add handlesOffset only if height > 0. r=sebastian, a=ritu 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
@@ -191,14 +191,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);
         }
     }
 }