Commit 6fd9af2e authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Get the thumbnail aspect ratio from the cached value

This CL updates the two acquired thumbnail aspect ratio usages to use
the cached value. Both of the usages has been gated by
TabUiFeatureUtilities#isTabThumbnailAspectRatioNotOne which is already
using the cached valued.

Note: this CL is split from crrev.com/c/2427345

Change-Id: Ida6f5e1a4785896f4b9dd47ae81d4f2f74f92301
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427149
Commit-Queue: Mei Liang <meiliang@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810465}
parent a51a7473
......@@ -27,7 +27,6 @@ import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Callback;
import org.chromium.base.MathUtils;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.tab_ui.R;
import org.chromium.ui.modelutil.PropertyKey;
import org.chromium.ui.modelutil.PropertyModel;
......@@ -314,9 +313,7 @@ class TabGridViewBinder {
if (TabUiFeatureUtilities.isTabThumbnailAspectRatioNotOne()) {
float expectedThumbnailAspectRatio =
(float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble(
ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO_PARAM, 1.0);
(float) TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO.getValue();
expectedThumbnailAspectRatio =
MathUtils.clamp(expectedThumbnailAspectRatio, 0.5f, 2.0f);
int height = (int) (thumbnail.getWidth() * 1.0 / expectedThumbnailAspectRatio);
......
......@@ -25,7 +25,6 @@ import androidx.recyclerview.widget.RecyclerView;
import org.chromium.base.MathUtils;
import org.chromium.chrome.browser.app.ChromeActivity;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.lifecycle.Destroyable;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.Tab;
......@@ -168,9 +167,7 @@ public class TabListCoordinator implements Destroyable {
if (TabUiFeatureUtilities.isTabThumbnailAspectRatioNotOne()) {
float expectedThumbnailAspectRatio =
(float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble(
ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO_PARAM, 1.0);
(float) TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO.getValue();
expectedThumbnailAspectRatio =
MathUtils.clamp(expectedThumbnailAspectRatio, 0.5f, 2.0f);
int height = (int) (thumbnail.getWidth() * 1.0 / expectedThumbnailAspectRatio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment