Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java b/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java
index 9dfccc8cae26f71f75985956a85595684723b1ba..f4ad96f27339b7b7dbc915d8b9e2ec7845e807c3 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java
@@ -21,6 +21,11 @@ import org.chromium.base.annotations.JNINamespace;
*/
@JNINamespace("content")
public class HandleViewResources {
+ // Android handle drawables have a transparent horizontal padding,
+ // which is one-fourth of the image. This variable is to take the
+ // padding ratio into account while calculating the handle origin position.
+ private static final float HANDLE_HORIZONTAL_PADDING_RATIO = 0.25f;
+
private static final int[] LEFT_HANDLE_ATTRS = {
android.R.attr.textSelectHandleLeft,
};
@@ -96,6 +101,11 @@ public class HandleViewResources {
}
@CalledByNative
+ public static float getHandleHorizontalPaddingRatio() {
+ return HANDLE_HORIZONTAL_PADDING_RATIO;
+ }
+
+ @CalledByNative
private static Bitmap getLeftHandleBitmap(Context context) {
return getHandleBitmap(context, LEFT_HANDLE_ATTRS);
}

Powered by Google App Engine
This is Rietveld 408576698