| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/android/view_android.h" | 5 #include "ui/android/view_android.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); | 122 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
| 123 if (delegate.is_null()) | 123 if (delegate.is_null()) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 float scale = display::Screen::GetScreen() | 126 float scale = display::Screen::GetScreen() |
| 127 ->GetDisplayNearestWindow(this) | 127 ->GetDisplayNearestWindow(this) |
| 128 .device_scale_factor(); | 128 .device_scale_factor(); |
| 129 int left_margin = std::round(bounds.x() * scale); | 129 int left_margin = std::round(bounds.x() * scale); |
| 130 // TODO(jinsukkim): Move content_offset() to ViewAndroid, since it's | 130 float content_offset_y_pix = content_offset().y(); |
| 131 // specific to a given web contents/render widget. | |
| 132 float content_offset_y_pix = GetWindowAndroid()->content_offset().y(); | |
| 133 int top_margin = std::round(content_offset_y_pix + bounds.y() * scale); | 131 int top_margin = std::round(content_offset_y_pix + bounds.y() * scale); |
| 134 JNIEnv* env = base::android::AttachCurrentThread(); | 132 JNIEnv* env = base::android::AttachCurrentThread(); |
| 135 Java_ViewAndroidDelegate_setViewPosition(env, | 133 Java_ViewAndroidDelegate_setViewPosition(env, |
| 136 delegate.obj(), | 134 delegate.obj(), |
| 137 anchor.obj(), | 135 anchor.obj(), |
| 138 bounds.x(), | 136 bounds.x(), |
| 139 bounds.y(), | 137 bounds.y(), |
| 140 bounds.width(), | 138 bounds.width(), |
| 141 bounds.height(), | 139 bounds.height(), |
| 142 scale, | 140 scale, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (delegate.is_null()) | 181 if (delegate.is_null()) |
| 184 return; | 182 return; |
| 185 JNIEnv* env = base::android::AttachCurrentThread(); | 183 JNIEnv* env = base::android::AttachCurrentThread(); |
| 186 Java_ViewAndroidDelegate_startDragAndDrop(env, | 184 Java_ViewAndroidDelegate_startDragAndDrop(env, |
| 187 delegate.obj(), | 185 delegate.obj(), |
| 188 jtext.obj(), | 186 jtext.obj(), |
| 189 jimage.obj()); | 187 jimage.obj()); |
| 190 } | 188 } |
| 191 | 189 |
| 192 } // namespace ui | 190 } // namespace ui |
| OLD | NEW |