Commit b5ba1510 authored by Eric Lawrence's avatar Eric Lawrence Committed by Chromium LUCI CQ

Remove defunct divider from Contextual Search old layout

Remove the code for the divider line that is no longer used in the new
layout.

Bug: 1143472
Change-Id: I80c06e671de8bd061c983a47c9755064a1509c6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567503Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarDonn Denman <donnd@chromium.org>
Commit-Queue: Eric Lawrence [MSFT] <ericlaw@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#833177}
parent 15fb453e
......@@ -69,7 +69,6 @@
<!-- Contextual Search colors -->
<color name="contextual_search_promo_background_color">@color/default_bg_color_elev_0</color>
<color name="contextual_search_promo_border_color">#C2C2C2</color>
<color name="contextual_search_divider_line_color">@color/default_bg_color_secondary</color>
<!-- Toolbar colors -->
<color name="toolbar_text_box_background_incognito">@color/black_alpha_38</color>
......
......@@ -79,8 +79,6 @@
<dimen name="contextual_search_padded_button_width">
@dimen/overlay_panel_padded_button_width
</dimen>
<dimen name="contextual_search_divider_line_width">1dp</dimen>
<dimen name="contextual_search_divider_line_height">24dp</dimen>
<!-- Padding at the end of the Bar. -->
<dimen name="contextual_search_end_padding">7dp</dimen>
<dimen name="contextual_search_bubble_y_inset">-3dp</dimen>
......
......@@ -11,7 +11,6 @@ import android.view.ViewGroup;
import androidx.annotation.VisibleForTesting;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation;
import org.chromium.chrome.browser.contextualsearch.QuickActionCategory;
......@@ -87,26 +86,6 @@ public class ContextualSearchBarControl {
private final float mTextLayerMinHeight;
private final float mTermCaptionSpacing;
/**
* The visibility percentage for the divider line ranging from 0.f to 1.f.
*/
private float mDividerLineVisibilityPercentage;
/**
* The width of the divider line in px.
*/
private final float mDividerLineWidth;
/**
* The height of the divider line in px.
*/
private final float mDividerLineHeight;
/**
* The divider line color.
*/
private final int mDividerLineColor;
/**
* The width of the end button in px.
*/
......@@ -130,9 +109,6 @@ public class ContextualSearchBarControl {
/** The animator that controls the text opacity. */
private CompositorAnimator mTextOpacityAnimation;
/** The animator that controls the divider line visibility. */
private CompositorAnimator mDividerLineVisibilityAnimation;
/** The animator that controls touch highlighting. */
private CompositorAnimator mTouchHighlightAnimation;
......@@ -162,14 +138,6 @@ public class ContextualSearchBarControl {
mTermCaptionSpacing = context.getResources().getDimension(
R.dimen.contextual_search_term_caption_spacing);
// Divider line values.
mDividerLineWidth = context.getResources().getDimension(
R.dimen.contextual_search_divider_line_width);
mDividerLineHeight = context.getResources().getDimension(
R.dimen.contextual_search_divider_line_height);
mDividerLineColor = ApiCompatibilityUtils.getColor(
context.getResources(), R.color.contextual_search_divider_line_color);
// Icon attributes.
mPaddedIconWidthPx =
context.getResources().getDimension(R.dimen.contextual_search_padded_button_width);
......@@ -399,49 +367,6 @@ public class ContextualSearchBarControl {
mCaptionControl.hide();
}
// ============================================================================================
// Divider Line
// ============================================================================================
/**
* @return The visibility percentage for the divider line ranging from 0.f to 1.f.
*/
public float getDividerLineVisibilityPercentage() {
return mDividerLineVisibilityPercentage;
}
/**
* @return The width of the divider line in px.
*/
public float getDividerLineWidth() {
return mDividerLineWidth;
}
/**
* @return The height of the divider line in px.
*/
public float getDividerLineHeight() {
return mDividerLineHeight;
}
/**
* @return The divider line color.
*/
public int getDividerLineColor() {
return mDividerLineColor;
}
/**
* @return The x-offset for the divider line relative to the x-position of the Bar in px.
*/
public float getDividerLineXOffset() {
if (LocalizationUtils.isLayoutRtl()) {
return mEndButtonWidth;
} else {
return mContextualSearchPanel.getContentViewWidthPx() - mEndButtonWidth
- getDividerLineWidth();
}
}
// ============================================================================================
// Touch Highlight
// ============================================================================================
......@@ -451,16 +376,6 @@ public class ContextualSearchBarControl {
*/
private boolean mTouchHighlightVisible;
/**
* Whether the touch that triggered showing the touch highlight was on the end Bar button.
*/
private boolean mWasTouchOnEndButton;
/**
* Whether the divider line was visible when the touch highlight started showing.
*/
private boolean mWasDividerVisibleOnTouch;
/** Where the touch highlight should start, in pixels. */
private float mTouchHighlightXOffsetPx;
......@@ -549,8 +464,6 @@ public class ContextualSearchBarControl {
private void showTouchHighlight(float x) {
if (mTouchHighlightVisible) return;
mWasTouchOnEndButton = isTouchOnEndButton(x);
// If the panel is expanded or maximized and the panel content cannot be promoted to a new
// tab, then tapping anywhere besides the end buttons does nothing. In this case, the touch
// highlight should not be shown.
......@@ -577,20 +490,6 @@ public class ContextualSearchBarControl {
mTouchHighlightAnimation.start();
}
/**
* @param xPx The x-position of the touch in px.
* @return Whether the touch occurred on the search Bar's end button.
*/
private boolean isTouchOnEndButton(float xPx) {
if (getDividerLineVisibilityPercentage() == TRANSPARENT_OPACITY) return false;
// Adjust the touch position to compensate for the narrow panel.
xPx -= mContextualSearchPanel.getOffsetX() * mDpToPx;
if (LocalizationUtils.isLayoutRtl()) return xPx <= getDividerLineXOffset();
return xPx > getDividerLineXOffset();
}
// ============================================================================================
// Search Bar Animation
// ============================================================================================
......
......@@ -122,13 +122,6 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer {
float progressBarOpacity = panel.getProgressBarOpacity();
float progressBarCompletion = panel.getProgressBarCompletion();
float dividerLineVisibilityPercentage =
searchBarControl.getDividerLineVisibilityPercentage();
float dividerLineWidth = searchBarControl.getDividerLineWidth();
float dividerLineHeight = searchBarControl.getDividerLineHeight();
int dividerLineColor = searchBarControl.getDividerLineColor();
float dividerLineXOffset = searchBarControl.getDividerLineXOffset();
boolean touchHighlightVisible = searchBarControl.getTouchHighlightVisible();
float touchHighlightXOffset = searchBarControl.getTouchHighlightXOffsetPx();
float touchHighlightWidth = searchBarControl.getTouchHighlightWidthPx();
......@@ -168,10 +161,9 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer {
quickActionIconVisible, thumbnailVisible, thumbnailUrl,
customImageVisibilityPercentage, barImageSize, iconColor, dragHandlebarColor,
closeIconOpacity, isProgressBarVisible, progressBarHeight * mDpToPx,
progressBarOpacity, progressBarCompletion, dividerLineVisibilityPercentage,
dividerLineWidth, dividerLineHeight, dividerLineColor, dividerLineXOffset,
touchHighlightVisible, touchHighlightXOffset, touchHighlightWidth,
Profile.getLastUsedRegularProfile(), roundedBarTopResourceId, separatorLineColor);
progressBarOpacity, progressBarCompletion, touchHighlightVisible,
touchHighlightXOffset, touchHighlightWidth, Profile.getLastUsedRegularProfile(),
roundedBarTopResourceId, separatorLineColor);
}
@CalledByNative
......@@ -244,8 +236,6 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer {
float customImageVisibilityPercentage, int barImageSize, int iconColor,
int dragHandlebarColor, float closeIconOpacity, boolean isProgressBarVisible,
float progressBarHeight, float progressBarOpacity, float progressBarCompletion,
float dividerLineVisibilityPercentage, float dividerLineWidth,
float dividerLineHeight, int dividerLineColor, float dividerLineXOffset,
boolean touchHighlightVisible, float touchHighlightXOffset,
float toucHighlightWidth, Profile profile, int barBackgroundResourceId,
int separatorLineColor);
......
......@@ -87,11 +87,6 @@ void ContextualSearchLayer::SetProperties(
float progress_bar_height,
float progress_bar_opacity,
float progress_bar_completion,
float divider_line_visibility_percentage,
float divider_line_width,
float divider_line_height,
int divider_line_color,
float divider_line_x_offset,
bool touch_highlight_visible,
float touch_highlight_x_offset,
float touch_highlight_width,
......@@ -281,30 +276,6 @@ void ContextualSearchLayer::SetProperties(
progress_bar_visible, search_bar_bottom, progress_bar_height,
progress_bar_opacity, progress_bar_completion, search_panel_width);
// ---------------------------------------------------------------------------
// Divider Line separator. Deprecated -- old layout only.
// ---------------------------------------------------------------------------
if (divider_line_visibility_percentage > 0.f) {
if (divider_line_->parent() != layer_)
layer_->AddChild(divider_line_);
// The divider line animates in from the bottom.
float divider_line_y_offset =
((search_bar_height - divider_line_height) / 2) +
(divider_line_height * (1.f - divider_line_visibility_percentage));
divider_line_->SetPosition(gfx::PointF(divider_line_x_offset,
divider_line_y_offset));
// The divider line should not draw below its final resting place.
// Set bounds to restrict the vertical draw position.
divider_line_->SetBounds(
gfx::Size(divider_line_width,
divider_line_height * divider_line_visibility_percentage));
divider_line_->SetBackgroundColor(divider_line_color);
} else if (divider_line_->parent()) {
divider_line_->RemoveFromParent();
}
// ---------------------------------------------------------------------------
// Touch Highlight Layer
// ---------------------------------------------------------------------------
......@@ -655,7 +626,6 @@ ContextualSearchLayer::ContextualSearchLayer(
bar_banner_text_(cc::UIResourceLayer::Create()),
search_caption_(cc::UIResourceLayer::Create()),
text_layer_(cc::UIResourceLayer::Create()),
divider_line_(cc::SolidColorLayer::Create()),
touch_highlight_layer_(cc::SolidColorLayer::Create()) {
// Search Bar Banner
bar_banner_container_->SetIsDrawable(true);
......@@ -690,9 +660,6 @@ ContextualSearchLayer::ContextualSearchLayer(
// Quick action icon
quick_action_icon_layer_->SetIsDrawable(true);
// Divider line
divider_line_->SetIsDrawable(true);
// Content layer
text_layer_->SetIsDrawable(true);
// NOTE(mdjones): This can be called multiple times to add other text layers.
......
......@@ -89,11 +89,6 @@ class ContextualSearchLayer : public OverlayPanelLayer {
float progress_bar_height,
float progress_bar_opacity,
float progress_bar_completion,
float divider_line_visibility_percentage,
float divider_line_width,
float divider_line_height,
int divider_line_color,
float divider_line_x_offset,
bool touch_highlight_visible,
float touch_highlight_x_offset,
float touch_highlight_width,
......@@ -151,7 +146,6 @@ class ContextualSearchLayer : public OverlayPanelLayer {
scoped_refptr<cc::UIResourceLayer> bar_banner_text_;
scoped_refptr<cc::UIResourceLayer> search_caption_;
scoped_refptr<cc::UIResourceLayer> text_layer_;
scoped_refptr<cc::SolidColorLayer> divider_line_;
scoped_refptr<cc::SolidColorLayer> touch_highlight_layer_;
};
......
......@@ -127,11 +127,6 @@ void ContextualSearchSceneLayer::UpdateContextualSearchLayer(
jfloat progress_bar_height,
jfloat progress_bar_opacity,
jfloat progress_bar_completion,
jfloat divider_line_visibility_percentage,
jfloat divider_line_width,
jfloat divider_line_height,
jint divider_line_color,
jfloat divider_line_x_offset,
jboolean touch_highlight_visible,
jfloat touch_highlight_x_offset,
jfloat touch_highlight_width,
......@@ -186,8 +181,6 @@ void ContextualSearchSceneLayer::UpdateContextualSearchLayer(
custom_image_visibility_percentage, bar_image_size, icon_color,
drag_handlebar_color, close_icon_opacity, progress_bar_visible,
progress_bar_height, progress_bar_opacity, progress_bar_completion,
divider_line_visibility_percentage, divider_line_width,
divider_line_height, divider_line_color, divider_line_x_offset,
touch_highlight_visible, touch_highlight_x_offset, touch_highlight_width,
rounded_bar_top_resource_id, separator_line_color);
......
......@@ -102,11 +102,6 @@ class ContextualSearchSceneLayer : public SceneLayer,
jfloat progress_bar_height,
jfloat progress_bar_opacity,
jfloat progress_bar_completion,
jfloat divider_line_visibility_percentage,
jfloat divider_line_width,
jfloat divider_line_height,
jint divider_line_color,
jfloat divider_line_x_offset,
jboolean touch_highlight_visible,
jfloat touch_highlight_x_offset,
jfloat touch_highlight_width,
......
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