Chromium Code Reviews| Index: android_webview/java/src/org/chromium/android_webview/AwContents.java |
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| index a98057a4637da49194007cea9199dedd19c32741..982752913676fe86ccfebf81857c4f2adb4c70e2 100644 |
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| @@ -297,7 +297,7 @@ public class AwContents implements SmartClipProvider, |
| private Bitmap mFavicon; |
| private boolean mHasRequestedVisitedHistoryFromClient; |
| // TODO(boliu): This should be in a global context, not per webview. |
| - private final double mDIPScale; |
| + private double mDIPScale; |
| // Whether this WebView is a popup. |
| private boolean mIsPopupWindow = false; |
| @@ -700,6 +700,17 @@ public class AwContents implements SmartClipProvider, |
| public void onConfigurationChanged(Configuration configuration) { |
| setLocale(LocaleUtils.getLocale(configuration.locale)); |
| mSettings.updateAcceptLanguages(); |
| + |
| + DeviceDisplayInfo displayInfo = DeviceDisplayInfo.create(mContext); |
| + // Update all display related parameters. |
| + displayInfo.updateNativeSharedDisplayInfo(); |
| + |
| + final double newDIPScale = displayInfo.getDIPScale(); |
| + if (newDIPScale != mDIPScale) { |
| + mContentViewCore.setDeviceScaleFactor((float) newDIPScale); |
| + setDIPScale(newDIPScale); |
|
Tima Vaisburd
2016/08/16 00:21:00
Bo, as far as I understand you suggested to force
boliu
2016/08/16 14:53:46
That's just coming from the re-layout, because vie
|
| + mContainerView.requestLayout(); |
|
Tima Vaisburd
2016/08/02 17:27:19
Do we need to request layout on the container?
boliu
2016/08/02 18:09:27
Don't think so. If the scale ends up needing a red
Tima Vaisburd
2016/08/16 00:21:01
Removed mContainerView.requestLayout();
|
| + } |
| } |
| }; |
| @@ -759,9 +770,7 @@ public class AwContents implements SmartClipProvider, |
| mContentViewClient = new AwContentViewClient(contentsClient, settings, this, mContext); |
| mLayoutSizer = dependencyFactory.createLayoutSizer(); |
| mSettings = settings; |
| - mDIPScale = DeviceDisplayInfo.create(mContext).getDIPScale(); |
| mLayoutSizer.setDelegate(new AwLayoutSizerDelegate()); |
| - mLayoutSizer.setDIPScale(mDIPScale); |
| mWebContentsDelegate = new AwWebContentsDelegateAdapter( |
| this, contentsClient, mContentViewClient, mContext, mContainerView); |
| mContentsClientBridge = new AwContentsClientBridge(mContext, contentsClient, |
| @@ -792,7 +801,6 @@ public class AwContents implements SmartClipProvider, |
| mDefaultVideoPosterRequestHandler = new DefaultVideoPosterRequestHandler(mContentsClient); |
| mSettings.setDefaultVideoPosterURL( |
| mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL()); |
| - mSettings.setDIPScale(mDIPScale); |
| mScrollOffsetManager = |
| dependencyFactory.createScrollOffsetManager(new AwScrollOffsetManagerDelegate()); |
| mScrollAccessibilityHelper = new ScrollAccessibilityHelper(mContainerView); |
| @@ -820,6 +828,13 @@ public class AwContents implements SmartClipProvider, |
| return contentViewCore; |
| } |
| + private void setDIPScale(double dipScale) { |
| + mDIPScale = dipScale; |
| + nativeSetDipScale(mNativeAwContents, (float) mDIPScale); |
| + mSettings.setDIPScale(mDIPScale); |
| + mLayoutSizer.setDIPScale(mDIPScale); |
| + } |
| + |
| boolean isFullScreen() { |
| return mFullScreenTransitionsState.isFullScreen(); |
| } |
| @@ -1048,7 +1063,10 @@ public class AwContents implements SmartClipProvider, |
| mNavigationController = mWebContents.getNavigationController(); |
| installWebContentsObserver(); |
| mSettings.setWebContents(webContents); |
| - nativeSetDipScale(mNativeAwContents, (float) mDIPScale); |
| + |
| + // ContentViewCore requests and stores the device scale factor. |
| + setDIPScale(mContentViewCore.getDeviceScaleFactor()); |
| + |
| updateContentViewCoreVisibility(); |
| // The native side object has been bound to this java instance, so now is the time to |
| @@ -3184,8 +3202,7 @@ public class AwContents implements SmartClipProvider, |
| // to enter fixedLayoutSize mode is sent before the first resize |
| // update. |
| mLayoutSizer.onSizeChanged(w, h, ow, oh); |
| - mContentViewCore.onPhysicalBackingSizeChanged(w, h); |
|
Tima Vaisburd
2016/08/02 17:27:19
onPhysicalBackingSizeChanges() calls nativeWasResi
boliu
2016/08/02 18:09:27
what do you mean by "late"?
It sounds like you ar
Tima Vaisburd
2016/08/02 18:53:27
I tried to explain why I merged these two calls bu
boliu
2016/08/02 19:00:02
Why would you expect it to "fix" anything? You sai
Tima Vaisburd
2016/08/16 00:21:00
I restored the orininal code which means I need to
|
| - mContentViewCore.onSizeChanged(w, h, ow, oh); |
| + mContentViewCore.onBackingAndViewportSizeChanged(w, h, w, h, ow, oh); |
| nativeOnSizeChanged(mNativeAwContents, w, h, ow, oh); |
| } |