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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 2202123002: Make WebView respond to device scale change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index be34d7dcd57cad827f55dae5c70fc4d44f7cdb6f..e628cbc6b8c44810f60ca51e3c7f893a04147309 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -1128,6 +1128,15 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
}
/**
+ * Sets the device scale factor (maps DIP pixels to physical pixels).
+ */
+ public void setDeviceScaleFactor(float value) {
+ mRenderCoordinates.setDeviceScaleFactor(value);
+ if (mNativeContentViewCore == 0) return;
+ nativeSetDeviceScaleFactor(mNativeContentViewCore, value);
+ }
+
+ /**
* @return Current page scale factor (maps CSS pixels to DIP pixels).
*/
@VisibleForTesting
@@ -1643,6 +1652,28 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
}
}
+ /**
+ * Called when the view size change is accompanied by the size of the underlying surface change.
+ */
+ public void onBackingAndViewportSizeChanged(
boliu 2016/08/02 18:09:27 if the above two methods needs to be merged, then
Tima Vaisburd 2016/08/16 00:21:01 Removed this method for now.
+ int wPixPhys, int hPixPhys, int wPix, int hPix, int owPix, int ohPix) {
+ if (mPhysicalBackingWidthPix == wPixPhys && mPhysicalBackingHeightPix == hPixPhys
+ && getViewportWidthPix() == wPix && getViewportHeightPix() == hPix) {
+ return;
+ }
+
+ mPhysicalBackingWidthPix = wPixPhys;
+ mPhysicalBackingHeightPix = hPixPhys;
+ mViewportWidthPix = wPix;
+ mViewportHeightPix = hPix;
+
+ if (mNativeContentViewCore != 0) {
+ nativeWasResized(mNativeContentViewCore);
+ }
+
+ updateAfterSizeChanged();
+ }
+
private void updateAfterSizeChanged() {
mPopupZoomer.hide(false);
@@ -3484,6 +3515,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
private native void nativeSetFocus(long nativeContentViewCoreImpl, boolean focused);
+ private native void nativeSetDeviceScaleFactor(long nativeContentViewCoreImpl, float value);
+
private native void nativeSendOrientationChangeEvent(
long nativeContentViewCoreImpl, int orientation);

Powered by Google App Engine
This is Rietveld 408576698