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

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

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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/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 0b05834a70eaa6c8ecb1140b6df75d3b6b230900..fcce242dfc979089b99932d87ebd2243df607d07 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
@@ -8,7 +8,8 @@ import android.content.Context;
import android.util.TypedValue;
import org.chromium.base.VisibleForTesting;
-import org.chromium.ui.base.WindowAndroid;
+
+import java.lang.ref.WeakReference;
/**
* Cached copy of all positions and scales (CSS-to-DIP-to-physical pixels)
@@ -38,7 +39,7 @@ public class RenderCoordinates {
private float mMaxPageScaleFactor = 1.0f;
// Cached device density.
- private float mDeviceScaleFactor;
+ private float mDeviceScaleFactor = 1.0f;
// Multiplier that determines how many (device) pixels to scroll per mouse
// wheel tick. Defaults to the preferred list item height.
@@ -61,14 +62,14 @@ public class RenderCoordinates {
mContentHeightCss = contentHeightCss;
}
- void updateDeviceScaleFactorFromWindow(WindowAndroid windowAndroid) {
- mDeviceScaleFactor = windowAndroid.getDisplay().getDIPScale();
+ void setDeviceScaleFactor(float dipScale, WeakReference<Context> displayContext) {
+ mDeviceScaleFactor = dipScale;
// The wheel scroll factor depends on the theme in the context.
// This code assumes that the theme won't change between this call and
// getWheelScrollFactor().
- Context context = windowAndroid.getContext().get();
+ Context context = displayContext.get();
TypedValue outValue = new TypedValue();
// This is the same attribute used by Android Views to scale wheel
// event motion into scroll deltas.

Powered by Google App Engine
This is Rietveld 408576698