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

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

Issue 11958004: Make new-style page scale work on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 80-col limit Created 7 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 e8a0b3a2101e373d36443c8bc89f226ec387ca5e..e91656248c8bbf52c07b3af69ad2c7a066fc7c99 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -8,6 +8,7 @@
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h"
+#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
@@ -37,6 +38,7 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/page_transition_types.h"
#include "jni/ContentViewCore_jni.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
@@ -45,6 +47,8 @@
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/android/window_android.h"
#include "ui/gfx/screen.h"
+#include "ui/gfx/size_conversions.h"
+#include "ui/gfx/size_f.h"
#include "webkit/glue/webmenuitem.h"
#include "webkit/user_agent/user_agent_util.h"
@@ -168,7 +172,8 @@ ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env, jobject obj,
InitJNI(env, obj);
- if (!gfx::Screen::GetNativeScreen()->IsDIPEnabled()) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableCssTransformPinch)) {
no sievers 2013/01/18 00:21:19 indent
dpi_scale_ = 1;
} else {
scoped_ptr<content::DeviceInfo> device_info(new content::DeviceInfo());
@@ -585,15 +590,19 @@ void ContentViewCoreImpl::ShowDisambiguationPopup(
java_bitmap.obj());
}
-gfx::Rect ContentViewCoreImpl::GetBounds() const {
+gfx::Size ContentViewCoreImpl::GetPhysicalSize() const {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
if (j_obj.is_null())
- return gfx::Rect();
- return gfx::Rect(Java_ContentViewCore_getWidth(env, j_obj.obj()),
+ return gfx::Size();
+ return gfx::Size(Java_ContentViewCore_getWidth(env, j_obj.obj()),
Java_ContentViewCore_getHeight(env, j_obj.obj()));
}
+gfx::Size ContentViewCoreImpl::GetDIPSize() const {
+ return gfx::ToCeiledSize(gfx::ScaleSize(GetPhysicalSize(), 1 / DpiScale()));
+}
+
void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) {
root_layer_->addChild(layer);
}

Powered by Google App Engine
This is Rietveld 408576698