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