Commit a3a082b8 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Unify Finch parameter "thumbnail_aspect_ratio"

Reuse a single string literal for Finch parameter
"thumbnail_aspect_ratio", so that it's easier to cross reference.

Bug: None
Change-Id: Iff9434ec4b3d759f40d40b799ec0a3c27f8c33c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2139431
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarMei Liang <meiliang@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Auto-Submit: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757540}
parent d76895fc
...@@ -27,8 +27,10 @@ public class NewTabTileMediator { ...@@ -27,8 +27,10 @@ public class NewTabTileMediator {
TabCreatorManager tabCreatorManager) { TabCreatorManager tabCreatorManager) {
mTabModelSelector = tabModelSelector; mTabModelSelector = tabModelSelector;
// Deliberately use un-cached value to match with native.
float aspectRatio = (float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble( float aspectRatio = (float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble(
ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID, "thumbnail_aspect_ratio", 1.0); ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO_PARAM, 1.0);
aspectRatio = MathUtils.clamp(aspectRatio, 0.5f, 2.0f); aspectRatio = MathUtils.clamp(aspectRatio, 0.5f, 2.0f);
model.set(NewTabTileViewProperties.THUMBNAIL_ASPECT_RATIO, aspectRatio); model.set(NewTabTileViewProperties.THUMBNAIL_ASPECT_RATIO, aspectRatio);
model.set(NewTabTileViewProperties.CARD_HEIGHT_INTERCEPT, 0); model.set(NewTabTileViewProperties.CARD_HEIGHT_INTERCEPT, 0);
......
...@@ -300,8 +300,8 @@ class TabGridViewBinder { ...@@ -300,8 +300,8 @@ class TabGridViewBinder {
if (TabUiFeatureUtilities.isTabThumbnailAspectRatioNotOne()) { if (TabUiFeatureUtilities.isTabThumbnailAspectRatioNotOne()) {
float expectedThumbnailAspectRatio = float expectedThumbnailAspectRatio =
(float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble( (float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble(
ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID, "thumbnail_aspect_ratio", ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
1.0); TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO_PARAM, 1.0);
expectedThumbnailAspectRatio = expectedThumbnailAspectRatio =
MathUtils.clamp(expectedThumbnailAspectRatio, 0.5f, 2.0f); MathUtils.clamp(expectedThumbnailAspectRatio, 0.5f, 2.0f);
int height = (int) (thumbnail.getWidth() * 1.0 / expectedThumbnailAspectRatio); int height = (int) (thumbnail.getWidth() * 1.0 / expectedThumbnailAspectRatio);
......
...@@ -152,7 +152,7 @@ public class TabListCoordinator implements Destroyable { ...@@ -152,7 +152,7 @@ public class TabListCoordinator implements Destroyable {
float expectedThumbnailAspectRatio = float expectedThumbnailAspectRatio =
(float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble( (float) ChromeFeatureList.getFieldTrialParamByFeatureAsDouble(
ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID, ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
"thumbnail_aspect_ratio", 1.0); TabUiFeatureUtilities.THUMBNAIL_ASPECT_RATIO_PARAM, 1.0);
expectedThumbnailAspectRatio = expectedThumbnailAspectRatio =
MathUtils.clamp(expectedThumbnailAspectRatio, 0.5f, 2.0f); MathUtils.clamp(expectedThumbnailAspectRatio, 0.5f, 2.0f);
int height = (int) (thumbnail.getWidth() * 1.0 / expectedThumbnailAspectRatio); 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