| Index: content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java b/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
|
| index 2df4f974938fc00b0ed8930b8fab2d0c6fdca053..5bcebc28c86b732dac67dbb830cd7e9c03ab5c00 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
|
| @@ -7,9 +7,8 @@ package org.chromium.content.browser;
|
| import android.content.Context;
|
| import android.util.TypedValue;
|
|
|
| -import org.chromium.base.CommandLine;
|
| import org.chromium.base.VisibleForTesting;
|
| -import org.chromium.content.common.ContentSwitches;
|
| +import org.chromium.ui.base.WindowAndroid;
|
|
|
| /**
|
| * Cached copy of all positions and scales (CSS-to-DIP-to-physical pixels)
|
| @@ -62,22 +61,19 @@ public class RenderCoordinates {
|
| mContentHeightCss = contentHeightCss;
|
| }
|
|
|
| - void setDeviceScaleFactor(Context context) {
|
| - String forceScaleFactor =
|
| - CommandLine.getInstance().getSwitchValue(ContentSwitches.FORCE_DEVICE_SCALE_FACTOR);
|
| - mDeviceScaleFactor = forceScaleFactor != null
|
| - ? Float.valueOf(forceScaleFactor)
|
| - : context.getResources().getDisplayMetrics().density;
|
| + void updateDeviceScaleFactorFromWindow(WindowAndroid windowAndroid) {
|
| + mDeviceScaleFactor = windowAndroid.getDisplay().getDIPScale();
|
|
|
| // The wheel scroll factor depends on the theme in the context.
|
| // This code assumes that the theme won't change between this call and
|
| - // getWheelScrollScale().
|
| + // getWheelScrollFactor().
|
|
|
| + Context context = windowAndroid.getContext().get();
|
| TypedValue outValue = new TypedValue();
|
| // This is the same attribute used by Android Views to scale wheel
|
| // event motion into scroll deltas.
|
| - if (context.getTheme().resolveAttribute(
|
| - android.R.attr.listPreferredItemHeight, outValue, true)) {
|
| + if (context != null && context.getTheme().resolveAttribute(
|
| + android.R.attr.listPreferredItemHeight, outValue, true)) {
|
| mWheelScrollFactor = outValue.getDimension(context.getResources().getDisplayMetrics());
|
| } else {
|
| // If attribute retrieval fails, just use a sensible default.
|
|
|