Index: content/browser/android/popup_touch_handle_drawable.cc |
diff --git a/content/browser/android/popup_touch_handle_drawable.cc b/content/browser/android/popup_touch_handle_drawable.cc |
index 7791ddfe452faf63e9b81d2133e810f86057b0f1..28b0525361f45ce0e3dc6773ea8a094b9d5e1931 100644 |
--- a/content/browser/android/popup_touch_handle_drawable.cc |
+++ b/content/browser/android/popup_touch_handle_drawable.cc |
@@ -29,6 +29,8 @@ PopupTouchHandleDrawable::PopupTouchHandleDrawable(JNIEnv* env, |
float dpi_scale) |
: java_ref_(env, obj), dpi_scale_(dpi_scale) { |
DCHECK(!java_ref_.is_empty()); |
+ drawable_horizontal_padding_ratio_ = |
+ Java_PopupTouchHandleDrawable_getHandleHorizontalPaddingRatio(env, obj); |
} |
PopupTouchHandleDrawable::~PopupTouchHandleDrawable() { |
@@ -50,31 +52,34 @@ void PopupTouchHandleDrawable::SetEnabled(bool enabled) { |
} |
void PopupTouchHandleDrawable::SetOrientation( |
- ui::TouchHandleOrientation orientation) { |
+ ui::TouchHandleOrientation orientation, |
+ bool mirror_vertical, |
+ bool mirror_horizontal) { |
JNIEnv* env = base::android::AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
if (!obj.is_null()) { |
- Java_PopupTouchHandleDrawable_setOrientation(env, obj.obj(), |
- static_cast<int>(orientation)); |
+ Java_PopupTouchHandleDrawable_setOrientation( |
+ env, obj.obj(), static_cast<int>(orientation), mirror_vertical, |
+ mirror_horizontal); |
} |
} |
-void PopupTouchHandleDrawable::SetAlpha(float alpha) { |
+void PopupTouchHandleDrawable::SetOrigin(const gfx::PointF& origin) { |
JNIEnv* env = base::android::AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
- bool visible = alpha > 0; |
- if (!obj.is_null()) |
- Java_PopupTouchHandleDrawable_setVisible(env, obj.obj(), visible); |
+ if (!obj.is_null()) { |
+ const gfx::PointF origin_pix = gfx::ScalePoint(origin, dpi_scale_); |
+ Java_PopupTouchHandleDrawable_setOrigin(env, obj.obj(), origin_pix.x(), |
+ origin_pix.y()); |
+ } |
} |
-void PopupTouchHandleDrawable::SetFocus(const gfx::PointF& position) { |
- const gfx::PointF position_pix = gfx::ScalePoint(position, dpi_scale_); |
+void PopupTouchHandleDrawable::SetAlpha(float alpha) { |
JNIEnv* env = base::android::AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
- if (!obj.is_null()) { |
- Java_PopupTouchHandleDrawable_setFocus(env, obj.obj(), position_pix.x(), |
- position_pix.y()); |
- } |
+ bool visible = alpha > 0; |
+ if (!obj.is_null()) |
+ Java_PopupTouchHandleDrawable_setVisible(env, obj.obj(), visible); |
} |
gfx::RectF PopupTouchHandleDrawable::GetVisibleBounds() const { |
@@ -90,6 +95,10 @@ gfx::RectF PopupTouchHandleDrawable::GetVisibleBounds() const { |
return gfx::ScaleRect(unscaled_rect, 1.f / dpi_scale_); |
} |
+float PopupTouchHandleDrawable::GetDrawableHorizontalPaddingRatio() const { |
+ return drawable_horizontal_padding_ratio_; |
+} |
+ |
// static |
bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) { |
return RegisterNativesImpl(env); |