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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java

Issue 2499733002: Remove cached dp viewports in LayoutManager (Closed)
Patch Set: use Float.compare 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: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
index b5c41b85f737337db260541c8376243f7baf1a8c..da15fb6f280878ea46753153d6149d88d47f2699 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
@@ -146,15 +146,15 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
*
* @param tabId The id of the source {@link Tab}.
* @param isIncognito Whether the tab in the in the incognito stack.
- * @param maxContentTextureWidth The maximum width for drawing the content.
- * @param maxContentTextureHeight The maximum height for drawing the content.
+ * @param maxContentTextureWidth The maximum width for drawing the content in px.
+ * @param maxContentTextureHeight The maximum height for drawing the content in px.
* @param showCloseButton Whether a close button should be displayed in the corner.
* @param isTitleNeeded Whether that tab need a title texture. This is an
* optimization to save cycles and memory. This is
* ignored if the title texture is already set.
*/
- public LayoutTab(int tabId, boolean isIncognito, float maxContentTextureWidth,
- float maxContentTextureHeight, boolean showCloseButton, boolean isTitleNeeded) {
+ public LayoutTab(int tabId, boolean isIncognito, int maxContentTextureWidth,
+ int maxContentTextureHeight, boolean showCloseButton, boolean isTitleNeeded) {
mId = tabId;
mIsIncognito = isIncognito;
init(maxContentTextureWidth, maxContentTextureHeight, showCloseButton, isTitleNeeded);
@@ -163,14 +163,14 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
/**
* Initializes a {@link LayoutTab} to its default value so it can be reused.
*
- * @param maxContentTextureWidth The maximum width of the page content in dp.
- * @param maxContentTextureHeight The maximum height of the page content in dp.
+ * @param maxContentTextureWidth The maximum width of the page content in px.
+ * @param maxContentTextureHeight The maximum height of the page content in px.
* @param showCloseButton Whether to show the close button on the tab border.
* @param isTitleNeeded Whether that tab need a title texture. This is an
* optimization to save cycles and memory. This is
* ignored if the title texture is already set.
*/
- public void init(float maxContentTextureWidth, float maxContentTextureHeight,
+ public void init(int maxContentTextureWidth, int maxContentTextureHeight,
boolean showCloseButton, boolean isTitleNeeded) {
mAlpha = 1.0f;
mSaturation = 1.0f;
@@ -200,10 +200,10 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
mInsetBorderVertical = false;
mToolbarYOffset = 0.f;
mSideBorderScale = 1.f;
- mOriginalContentWidth = maxContentTextureWidth;
- mOriginalContentHeight = maxContentTextureHeight;
- mMaxContentWidth = maxContentTextureWidth;
- mMaxContentHeight = maxContentTextureHeight;
+ mOriginalContentWidth = maxContentTextureWidth * sPxToDp;
+ mOriginalContentHeight = maxContentTextureHeight * sPxToDp;
+ mMaxContentWidth = maxContentTextureWidth * sPxToDp;
+ mMaxContentHeight = maxContentTextureHeight * sPxToDp;
mInitFromHostCalled = false;
}
@@ -804,12 +804,12 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
}
/**
- * @param originalContentWidth The maximum content width for the given orientation.
- * @param originalContentHeight The maximum content height for the given orientation.
+ * @param originalContentWidth The maximum content width for the given orientation in px.
+ * @param originalContentHeight The maximum content height for the given orientation in px.
*/
- public void setContentSize(float originalContentWidth, float originalContentHeight) {
- mOriginalContentWidth = originalContentWidth;
- mOriginalContentHeight = originalContentHeight;
+ public void setContentSize(int originalContentWidth, int originalContentHeight) {
+ mOriginalContentWidth = originalContentWidth * sPxToDp;
+ mOriginalContentHeight = originalContentHeight * sPxToDp;
}
/**

Powered by Google App Engine
This is Rietveld 408576698