Commit 6410b129 authored by Yusuf Ozuysal's avatar Yusuf Ozuysal Committed by Commit Bot

Revert "Remove LayoutTab#mInsetBorderVertical and related logic"

This reverts commit d4fc9d34.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Remove LayoutTab#mInsetBorderVertical and related logic
> 
> TabLayer::SetProperties() currently has a param, inset_border, that changes the
> geometry logic for showing tabs in the tab switcher. Currently, we're always
> setting the param to true. We then use it to set another variable:
> 
> const bool inset_toolbar = !inset_border;
> 
> which is always false. This is immediately followed by this check, which always
> passes:
> 
> if (!inset_toolbar) {...}
> 
> 
> In addition to being unnecessary, this param is also extremely
> confusing/misleading. We do actually start out with the toolbar inset on top of
> the tab thumbnail (before we fade it into the tab title), and we only inset the
> top and bottom borders, not the ones on the left and right.
> 
> This CL removes this unnecessary logic.
> 
> Bug: 849401
> Change-Id: I5ccfa35f766baf477837be1d886a2974d0009a54
> Reviewed-on: https://chromium-review.googlesource.com/1114330
> Reviewed-by: David Trainor <dtrainor@chromium.org>
> Commit-Queue: Ryan Landay <rlanday@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#570971}

TBR=dtrainor@chromium.org,rlanday@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 849401
Change-Id: I124cce58f105b75164acc05ce6b6cb6831db8a91
Reviewed-on: https://chromium-review.googlesource.com/1124820Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Yusuf Ozuysal <yusufo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572258}
parent f7ee3ca8
...@@ -93,6 +93,7 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property> ...@@ -93,6 +93,7 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
private boolean mShowToolbar; private boolean mShowToolbar;
private boolean mAnonymizeToolbar; private boolean mAnonymizeToolbar;
private float mToolbarAlpha; private float mToolbarAlpha;
private boolean mInsetBorderVertical;
private float mToolbarYOffset; private float mToolbarYOffset;
private float mSideBorderScale; private float mSideBorderScale;
private boolean mCloseButtonIsOnRight; private boolean mCloseButtonIsOnRight;
...@@ -190,6 +191,7 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property> ...@@ -190,6 +191,7 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
mShowToolbar = false; mShowToolbar = false;
mAnonymizeToolbar = false; mAnonymizeToolbar = false;
mToolbarAlpha = 1.f; mToolbarAlpha = 1.f;
mInsetBorderVertical = false;
mToolbarYOffset = 0.f; mToolbarYOffset = 0.f;
mSideBorderScale = 1.f; mSideBorderScale = 1.f;
mOriginalContentWidth = maxContentTextureWidth * sPxToDp; mOriginalContentWidth = maxContentTextureWidth * sPxToDp;
...@@ -862,6 +864,20 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property> ...@@ -862,6 +864,20 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
return mToolbarAlpha; return mToolbarAlpha;
} }
/**
* @param inset Whether or not to inset the top vertical component of the tab border or not.
*/
public void setInsetBorderVertical(boolean inset) {
mInsetBorderVertical = inset;
}
/**
* @return Whether or not to inset the top vertical component of the tab border or not.
*/
public boolean insetBorderVertical() {
return mInsetBorderVertical;
}
public void setCloseButtonIsOnRight(boolean closeButtonIsOnRight) { public void setCloseButtonIsOnRight(boolean closeButtonIsOnRight) {
mCloseButtonIsOnRight = closeButtonIsOnRight; mCloseButtonIsOnRight = closeButtonIsOnRight;
} }
......
...@@ -1644,6 +1644,7 @@ public abstract class Stack implements ChromeAnimation.Animatable<Stack.Property ...@@ -1644,6 +1644,7 @@ public abstract class Stack implements ChromeAnimation.Animatable<Stack.Property
LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito, LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito,
Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight); Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight);
layoutTab.setInsetBorderVertical(true);
layoutTab.setShowToolbar(true); layoutTab.setShowToolbar(true);
layoutTab.setToolbarAlpha(0.f); layoutTab.setToolbarAlpha(0.f);
layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabList || mTabList.index() != i); layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabList || mTabList.index() != i);
......
...@@ -114,7 +114,8 @@ public class TabListSceneLayer extends SceneLayer { ...@@ -114,7 +114,8 @@ public class TabListSceneLayer extends SceneLayer {
defaultThemeColor, t.getToolbarBackgroundColor(), closeButtonColor, defaultThemeColor, t.getToolbarBackgroundColor(), closeButtonColor,
t.anonymizeToolbar(), t.isTitleNeeded(), urlBarBackgroundId, t.anonymizeToolbar(), t.isTitleNeeded(), urlBarBackgroundId,
t.getTextBoxBackgroundColor(), textBoxAlpha, t.getToolbarAlpha(), t.getTextBoxBackgroundColor(), textBoxAlpha, t.getToolbarAlpha(),
t.getToolbarYOffset() * dpToPx, t.getSideBorderScale()); t.getToolbarYOffset() * dpToPx, t.getSideBorderScale(),
t.insetBorderVertical());
} }
nativeFinishBuildingFrame(mNativePtr); nativeFinishBuildingFrame(mNativePtr);
} }
...@@ -177,16 +178,17 @@ public class TabListSceneLayer extends SceneLayer { ...@@ -177,16 +178,17 @@ public class TabListSceneLayer extends SceneLayer {
private native void nativePutTabLayer(long nativeTabListSceneLayer, int id, private native void nativePutTabLayer(long nativeTabListSceneLayer, int id,
int toolbarResourceId, int closeButtonResourceId, int shadowResourceId, int toolbarResourceId, int closeButtonResourceId, int shadowResourceId,
int contourResourceId, int backLogoResourceId, int borderResourceId, int contourResourceId, int backLogoResourceId, int borderResourceId,
int borderInnerShadowResourceId, boolean canUseLiveLayer, boolean modernDesignEnabled, int borderInnerShadowResourceId, boolean canUseLiveLayer,
int tabBackgroundColor, int backLogoColor, boolean incognito, boolean isPortrait, boolean modernDesignEnabled, int tabBackgroundColor,
float x, float y, float width, float height, float contentWidth, float contentHeight, int backLogoColor, boolean incognito, boolean isPortrait, float x, float y, float width,
float visibleContentHeight, float shadowX, float shadowY, float shadowWidth, float height, float contentWidth, float contentHeight, float visibleContentHeight,
float shadowHeight, float pivotX, float pivotY, float rotationX, float rotationY, float shadowX, float shadowY, float shadowWidth, float shadowHeight, float pivotX,
float alpha, float borderAlpha, float borderInnerShadowAlpha, float contourAlpha, float pivotY, float rotationX, float rotationY, float alpha, float borderAlpha,
float shadowAlpha, float closeAlpha, float closeBtnWidth, float staticToViewBlend, float borderInnerShadowAlpha, float contourAlpha, float shadowAlpha, float closeAlpha,
float borderScale, float saturation, float brightness, boolean showToolbar, float closeBtnWidth, float staticToViewBlend, float borderScale, float saturation,
int defaultThemeColor, int toolbarBackgroundColor, int closeButtonColor, float brightness, boolean showToolbar, int defaultThemeColor,
boolean anonymizeToolbar, boolean showTabTitle, int toolbarTextBoxResource, int toolbarBackgroundColor, int closeButtonColor, boolean anonymizeToolbar,
int toolbarTextBoxBackgroundColor, float toolbarTextBoxAlpha, float toolbarAlpha, boolean showTabTitle, int toolbarTextBoxResource, int toolbarTextBoxBackgroundColor,
float toolbarYOffset, float sideBorderScale); float toolbarTextBoxAlpha, float toolbarAlpha, float toolbarYOffset,
float sideBorderScale, boolean insetVerticalBorder);
} }
...@@ -142,7 +142,8 @@ void TabLayer::SetProperties(int id, ...@@ -142,7 +142,8 @@ void TabLayer::SetProperties(int id,
float toolbar_textbox_alpha, float toolbar_textbox_alpha,
float toolbar_alpha, float toolbar_alpha,
float toolbar_y_offset, float toolbar_y_offset,
float side_border_scale) { float side_border_scale,
bool inset_border) {
if (alpha <= 0) { if (alpha <= 0) {
layer_->SetHideLayerAndSubtree(true); layer_->SetHideLayerAndSubtree(true);
return; return;
...@@ -341,35 +342,39 @@ void TabLayer::SetProperties(int id, ...@@ -341,35 +342,39 @@ void TabLayer::SetProperties(int id,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Handle Insetting the Top Border Component // Handle Insetting the Top Border Component
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
descaled_local_content_area.set_height(descaled_local_content_area.height() - if (inset_border) {
border_padding.y()); float inset_diff = inset_border ? border_padding.y() : 0.f;
scaled_local_content_area.set_height(scaled_local_content_area.height() - descaled_local_content_area.set_height(
border_padding.y() * content_scale); descaled_local_content_area.height() - inset_diff);
shadow_size.set_height(shadow_size.height() - border_padding.y()); scaled_local_content_area.set_height(scaled_local_content_area.height() -
border_size.set_height(border_size.height() - border_padding.y()); inset_diff * content_scale);
border_inner_shadow_size.set_height(border_inner_shadow_size.height() - shadow_size.set_height(shadow_size.height() - inset_diff);
border_padding.y()); border_size.set_height(border_size.height() - inset_diff);
contour_size.set_height(contour_size.height() - border_padding.y()); border_inner_shadow_size.set_height(
shadow_position.set_y(shadow_position.y() + border_padding.y()); border_inner_shadow_size.height() - inset_diff);
border_position.set_y(border_position.y() + border_padding.y()); contour_size.set_height(contour_size.height() - inset_diff);
border_inner_shadow_position.set_y(border_inner_shadow_position.y() + shadow_position.set_y(shadow_position.y() + inset_diff);
border_padding.y()); border_position.set_y(border_position.y() + inset_diff);
contour_position.set_y(contour_position.y() + border_padding.y()); border_inner_shadow_position.set_y(
close_button_position.set_y(close_button_position.y() + border_padding.y()); border_inner_shadow_position.y() + inset_diff);
title_position.set_y(title_position.y() + border_padding.y()); contour_position.set_y(contour_position.y() + inset_diff);
close_button_position.set_y(close_button_position.y() + inset_diff);
// Scaled eventually, so have to descale the size difference first. title_position.set_y(title_position.y() + inset_diff);
toolbar_position.set_y(toolbar_position.y() +
border_padding.y() / content_scale); // Scaled eventually, so have to descale the size difference first.
content_position.set_y(content_position.y() + toolbar_position.set_y(toolbar_position.y() + inset_diff / content_scale);
border_padding.y() / content_scale); content_position.set_y(content_position.y() + inset_diff / content_scale);
desired_content_size_pt.set_y(desired_content_size_pt.y() - desired_content_size_pt.set_y(desired_content_size_pt.y() -
border_padding.y() / content_scale); inset_diff / content_scale);
}
toolbar_position.set_y(toolbar_position.y() - toolbar_impact_height);
content_position.set_y(content_position.y() - toolbar_impact_height); const bool inset_toolbar = !inset_border;
desired_content_size_pt.set_y(desired_content_size_pt.y() + if (!inset_toolbar) {
toolbar_impact_height); float inset_diff = toolbar_impact_height;
toolbar_position.set_y(toolbar_position.y() - inset_diff);
content_position.set_y(content_position.y() - inset_diff);
desired_content_size_pt.set_y(desired_content_size_pt.y() + inset_diff);
}
// Finally build the sizes that might have calculations that go negative. // Finally build the sizes that might have calculations that go negative.
gfx::Size desired_content_size(desired_content_size_pt.x(), gfx::Size desired_content_size(desired_content_size_pt.x(),
......
...@@ -93,7 +93,8 @@ class TabLayer : public Layer { ...@@ -93,7 +93,8 @@ class TabLayer : public Layer {
float toolbar_textbox_alpha, float toolbar_textbox_alpha,
float toolbar_alpha, float toolbar_alpha,
float toolbar_y_offset, float toolbar_y_offset,
float side_border_scale); float side_border_scale,
bool inset_border);
bool is_incognito() const { return incognito_; } bool is_incognito() const { return incognito_; }
......
...@@ -139,7 +139,8 @@ void TabListSceneLayer::PutTabLayer(JNIEnv* env, ...@@ -139,7 +139,8 @@ void TabListSceneLayer::PutTabLayer(JNIEnv* env,
jfloat toolbar_textbox_alpha, jfloat toolbar_textbox_alpha,
jfloat toolbar_alpha, jfloat toolbar_alpha,
jfloat toolbar_y_offset, jfloat toolbar_y_offset,
jfloat side_border_scale) { jfloat side_border_scale,
jboolean inset_border) {
scoped_refptr<TabLayer> layer; scoped_refptr<TabLayer> layer;
auto iter = tab_map_.find(id); auto iter = tab_map_.find(id);
if (iter != tab_map_.end()) { if (iter != tab_map_.end()) {
...@@ -177,7 +178,7 @@ void TabListSceneLayer::PutTabLayer(JNIEnv* env, ...@@ -177,7 +178,7 @@ void TabListSceneLayer::PutTabLayer(JNIEnv* env,
default_theme_color, toolbar_background_color, close_button_color, default_theme_color, toolbar_background_color, close_button_color,
anonymize_toolbar, show_tab_title, toolbar_textbox_resource_id, anonymize_toolbar, show_tab_title, toolbar_textbox_resource_id,
toolbar_textbox_background_color, toolbar_textbox_alpha, toolbar_alpha, toolbar_textbox_background_color, toolbar_textbox_alpha, toolbar_alpha,
toolbar_y_offset, side_border_scale); toolbar_y_offset, side_border_scale, inset_border);
} }
gfx::RectF self(own_tree_->position(), gfx::SizeF(own_tree_->bounds())); gfx::RectF self(own_tree_->position(), gfx::SizeF(own_tree_->bounds()));
......
...@@ -100,7 +100,8 @@ class TabListSceneLayer : public SceneLayer { ...@@ -100,7 +100,8 @@ class TabListSceneLayer : public SceneLayer {
jfloat toolbar_textbox_alpha, jfloat toolbar_textbox_alpha,
jfloat toolbar_alpha, jfloat toolbar_alpha,
jfloat toolbar_y_offset, jfloat toolbar_y_offset,
jfloat side_border_scale); jfloat side_border_scale,
jboolean inset_border);
void OnDetach() override; void OnDetach() override;
bool ShouldShowBackground() override; bool ShouldShowBackground() override;
......
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