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

Unified Diff: ui/android/view_android.cc

Issue 2202123002: Make WebView respond to device scale change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made WindowAndroid::content_offset() device scale independent, restored AwContents.onSizeChanged(),… Created 4 years, 4 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: ui/android/view_android.cc
diff --git a/ui/android/view_android.cc b/ui/android/view_android.cc
index 259aed6e162c13910e1571d036dfa2cd585031de..f5a02499bccff688a8807864e9152917521f7c49 100644
--- a/ui/android/view_android.cc
+++ b/ui/android/view_android.cc
@@ -130,8 +130,8 @@ void ViewAndroid::SetAnchorRect(const JavaRef<jobject>& anchor,
int left_margin = std::round(bounds.x() * scale);
// TODO(jinsukkim): Move content_offset() to ViewAndroid, since it's
// specific to a given web contents/render widget.
- float content_offset_y_pix = GetWindowAndroid()->content_offset().y();
- int top_margin = std::round(content_offset_y_pix + bounds.y() * scale);
+ int top_margin = std::round(
+ (GetWindowAndroid()->content_offset().y() + bounds.y()) * scale);
JNIEnv* env = base::android::AttachCurrentThread();
Java_ViewAndroidDelegate_setViewPosition(env,
delegate.obj(),

Powered by Google App Engine
This is Rietveld 408576698