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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 2626723003: Revert "Introduce ViewRoot forwarding input/view events to native" (Closed)
Patch Set: Created 3 years, 11 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/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 38cea2a8e61c20b88e5c14dad60be825ffb4465e..426e3e7a1f7fe68bc701e7fae133d4f870ecb986 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -230,6 +230,12 @@ ContentViewCoreImpl::ContentViewCoreImpl(
dpi_scale_(dpi_scale),
device_orientation_(0),
accessibility_enabled_(false) {
+ GetViewAndroid()->SetLayer(cc::Layer::Create());
+ gfx::Size physical_size(
+ Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj),
+ Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj));
+ GetViewAndroid()->GetLayer()->SetBounds(physical_size);
+
// Currently, the only use case we have for overriding a user agent involves
// spoofing a desktop Linux user agent for "Request desktop site".
// Automatically set it for all WebContents so that it is available when a
@@ -726,6 +732,16 @@ gfx::Size ContentViewCoreImpl::GetViewSize() const {
return size;
}
+gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
+ if (j_obj.is_null())
+ return gfx::Size();
+ return gfx::Size(
+ Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj),
+ Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj));
+}
+
gfx::Size ContentViewCoreImpl::GetViewportSizePix() const {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
@@ -1249,6 +1265,11 @@ void ContentViewCoreImpl::RemoveJavascriptInterface(
void ContentViewCoreImpl::WasResized(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
+ gfx::Size physical_size(
+ Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj),
+ Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj));
+ GetViewAndroid()->GetLayer()->SetBounds(physical_size);
+
SendScreenRectsAndResizeWidget();
}
@@ -1538,7 +1559,6 @@ jlong Init(JNIEnv* env,
"A ContentViewCoreImpl should be created with a valid WebContents.";
ui::ViewAndroid* view_android = web_contents->GetView()->GetNativeView();
view_android->SetDelegate(jview_android_delegate);
- view_android->SetLayer(cc::Layer::Create());
ui::WindowAndroid* window_android =
reinterpret_cast<ui::WindowAndroid*>(jwindow_android);
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698