Commit 18bdf8a0 authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[TTS] Remove the close icon in new layout.

Removes the close icon from the Bar in the new overlay
layout for Contextual Search. Leaves the Preview Tab unchanged.

Also changes the behavior of Tap on the Bar when not peeking in
the new layout -- now that just returns to the peeking position.

BUG=997748, 1000792

Change-Id: Icbd503d8cb5129af5ca4a9db164bf2ebdbc85ed5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1785085Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Auto-Submit: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694351}
parent 0e62fcd0
...@@ -125,9 +125,8 @@ ...@@ -125,9 +125,8 @@
<dimen name="contextual_search_term_caption_spacing"> <dimen name="contextual_search_term_caption_spacing">
@dimen/overlay_panel_caption_spacing @dimen/overlay_panel_caption_spacing
</dimen> </dimen>
<dimen name="contextual_search_padded_button_width">36dp</dimen> <dimen name="contextual_search_padded_button_width">
<dimen name="contextual_search_end_buttons_width"> @dimen/overlay_panel_padded_button_width
@dimen/overlay_panel_end_buttons_width
</dimen> </dimen>
<dimen name="contextual_search_divider_line_width">1dp</dimen> <dimen name="contextual_search_divider_line_width">1dp</dimen>
<dimen name="contextual_search_divider_line_height">24dp</dimen> <dimen name="contextual_search_divider_line_height">24dp</dimen>
......
...@@ -646,11 +646,12 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState ...@@ -646,11 +646,12 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
/** /**
* @param x The x coordinate in dp. * @param x The x coordinate in dp.
* @return Whether the given |x| coordinate is inside the close button. * @return Whether the given |x| coordinate is inside the open-in-new-tab button.
*/ */
protected boolean isCoordinateInsideOpenTabButton(float x) { protected boolean isCoordinateInsideOpenTabButton(float x) {
float width = getOpenTabIconDimension() + 2 * mButtonPaddingDps; // Calculation is the same for RTL: within the button plus padding.
return getOpenTabIconX() - mButtonPaddingDps <= x && x <= getOpenTabIconX() + width; return getOpenTabIconX() - mButtonPaddingDps <= x
&& x <= getOpenTabIconX() + getOpenTabIconDimension() + mButtonPaddingDps;
} }
/** /**
......
...@@ -375,14 +375,14 @@ abstract class OverlayPanelBase { ...@@ -375,14 +375,14 @@ abstract class OverlayPanelBase {
private boolean mIsMaximized; private boolean mIsMaximized;
/** /**
* @return The vertical offset of the Overlay Panel. * @return The horizontal offset of the Overlay Panel in DPs.
*/ */
public float getOffsetX() { public float getOffsetX() {
return mOffsetX; return mOffsetX;
} }
/** /**
* @return The vertical offset of the Overlay Panel. * @return The vertical offset of the Overlay Panel in DPs.
*/ */
public float getOffsetY() { public float getOffsetY() {
return mOffsetY; return mOffsetY;
...@@ -548,7 +548,7 @@ abstract class OverlayPanelBase { ...@@ -548,7 +548,7 @@ abstract class OverlayPanelBase {
} }
/** /**
* @return The width/height of the open tab icon. * @return The width/height of the open tab icon in DPs.
*/ */
public float getOpenTabIconDimension() { public float getOpenTabIconDimension() {
if (mOpenTabIconWidth == 0) { if (mOpenTabIconWidth == 0) {
...@@ -560,7 +560,7 @@ abstract class OverlayPanelBase { ...@@ -560,7 +560,7 @@ abstract class OverlayPanelBase {
} }
/** /**
* @return The left X coordinate of the open new tab icon. * @return The left X coordinate of the open new tab icon in DPs.
*/ */
public float getOpenTabIconX() { public float getOpenTabIconX() {
float offset = getCloseIconDimension() + 2 * mButtonPaddingDps; float offset = getCloseIconDimension() + 2 * mButtonPaddingDps;
......
...@@ -60,12 +60,9 @@ public class ContextualSearchBarControl { ...@@ -60,12 +60,9 @@ public class ContextualSearchBarControl {
*/ */
private final ContextualSearchCardIconControl mCardIconControl; private final ContextualSearchCardIconControl mCardIconControl;
/** The width of our icons, including padding, in pixels. */ /** The width of our icon, including padding, in pixels. */
private final float mPaddedIconWidthPx; private final float mPaddedIconWidthPx;
/** The start offset of the middle icon in the Bar, in pixels. */
private final int mMiddleIconStartPx;
/** /**
* The {@link ContextualSearchImageControl} for the panel. * The {@link ContextualSearchImageControl} for the panel.
*/ */
...@@ -170,17 +167,11 @@ public class ContextualSearchBarControl { ...@@ -170,17 +167,11 @@ public class ContextualSearchBarControl {
mDividerLineColor = ApiCompatibilityUtils.getColor( mDividerLineColor = ApiCompatibilityUtils.getColor(
context.getResources(), R.color.contextual_search_divider_line_color); context.getResources(), R.color.contextual_search_divider_line_color);
int endButtonsWidthDimension = // Icon attributes.
ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? R.dimen.contextual_search_end_buttons_width
: R.dimen.contextual_search_padded_button_width;
mEndButtonWidth = context.getResources().getDimension(endButtonsWidthDimension)
+ context.getResources().getDimension(R.dimen.overlay_panel_button_padding);
// Number of pixels from the end of the Bar.
mMiddleIconStartPx = context.getResources().getDimensionPixelSize(
R.dimen.overlay_panel_end_buttons_width);
mPaddedIconWidthPx = mPaddedIconWidthPx =
context.getResources().getDimension(R.dimen.overlay_panel_padded_button_width); context.getResources().getDimension(R.dimen.contextual_search_padded_button_width);
mEndButtonWidth = mPaddedIconWidthPx
+ context.getResources().getDimension(R.dimen.overlay_panel_button_padding);
mDpToPx = context.getResources().getDisplayMetrics().density; mDpToPx = context.getResources().getDisplayMetrics().density;
} }
...@@ -577,33 +568,31 @@ public class ContextualSearchBarControl { ...@@ -577,33 +568,31 @@ public class ContextualSearchBarControl {
private void classifyTouchLocation(float xPx) { private void classifyTouchLocation(float xPx) {
assert ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT); assert ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT);
// There are 4 cases: // There are 3 cases:
// 1) The whole Bar minus icons (when 2 icons present) // 1) The whole Bar minus icon (when the icon is present)
// 2) The middle icon // 2) The icon
// 3) The end icon // 3) The whole Bar (without any icons)
// 4) The whole Bar (without any icons)
boolean wereIconsVisibleOnTouch = !mContextualSearchPanel.isPeeking(); boolean wereIconsVisibleOnTouch = !mContextualSearchPanel.isPeeking();
int panelWidth = mContextualSearchPanel.getContentViewWidthPx(); int panelWidth = mContextualSearchPanel.getContentViewWidthPx();
if (wereIconsVisibleOnTouch) { if (wereIconsVisibleOnTouch) {
int barWidthMinusIcons = panelWidth - mMiddleIconStartPx; float iconOffsetPx = (mContextualSearchPanel.getOpenTabIconX()
if (xPx < barWidthMinusIcons) { - mContextualSearchPanel.getButtonPaddingDps())
// Case 1 - whole Bar minus icons. * mDpToPx;
if (xPx < iconOffsetPx) {
// Case 1 - whole Bar minus icon.
mTouchHighlightXOffsetPx = 0; mTouchHighlightXOffsetPx = 0;
mTouchHighlightWidthPx = barWidthMinusIcons; mTouchHighlightWidthPx = iconOffsetPx;
} else if (xPx < barWidthMinusIcons + mPaddedIconWidthPx) {
// Case 2 - middle icon.
mTouchHighlightXOffsetPx = barWidthMinusIcons;
mTouchHighlightWidthPx = mPaddedIconWidthPx;
} else { } else {
// Case 3 - end icon. // Case 2 - the icon.
mTouchHighlightXOffsetPx = barWidthMinusIcons + mPaddedIconWidthPx; mTouchHighlightXOffsetPx = iconOffsetPx;
mTouchHighlightWidthPx = panelWidth - mTouchHighlightXOffsetPx; mTouchHighlightWidthPx = panelWidth - iconOffsetPx;
} }
} else { } else {
// Case 4 - whole Bar. // Case 3 - whole Bar.
mTouchHighlightXOffsetPx = 0; mTouchHighlightXOffsetPx = 0;
mTouchHighlightWidthPx = panelWidth; mTouchHighlightWidthPx = panelWidth;
} }
// If RTL then width is correct, just move offset to the other side of the panel.
if (LocalizationUtils.isLayoutRtl()) { if (LocalizationUtils.isLayoutRtl()) {
mTouchHighlightXOffsetPx = panelWidth - mTouchHighlightXOffsetPx; mTouchHighlightXOffsetPx = panelWidth - mTouchHighlightXOffsetPx;
} }
......
...@@ -90,13 +90,8 @@ public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater ...@@ -90,13 +90,8 @@ public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater
public ContextualSearchCaptionControl(OverlayPanel panel, Context context, ViewGroup container, public ContextualSearchCaptionControl(OverlayPanel panel, Context context, ViewGroup container,
DynamicResourceLoader resourceLoader, boolean shouldShowExpandedCaption) { DynamicResourceLoader resourceLoader, boolean shouldShowExpandedCaption) {
super(panel, R.layout.contextual_search_caption_view, R.id.contextual_search_caption_view, super(panel, R.layout.contextual_search_caption_view, R.id.contextual_search_caption_view,
context, container, resourceLoader, context, container, resourceLoader, R.dimen.contextual_search_padded_button_width,
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) R.dimen.contextual_search_padded_button_width);
? R.dimen.contextual_search_end_padding
: R.dimen.overlay_panel_padded_button_width),
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? R.dimen.contextual_search_end_buttons_width
: R.dimen.overlay_panel_padded_button_width));
mShouldShowExpandedCaption = shouldShowExpandedCaption; mShouldShowExpandedCaption = shouldShowExpandedCaption;
} }
...@@ -266,8 +261,9 @@ public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater ...@@ -266,8 +261,9 @@ public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater
if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) {
animateTransitionIn(); animateTransitionIn();
} else if (!mShowingExpandedCaption) } else if (!mShowingExpandedCaption) {
animateTransitionIn(); animateTransitionIn();
}
} }
// ============================================================================================ // ============================================================================================
......
...@@ -10,7 +10,6 @@ import android.view.ViewGroup; ...@@ -10,7 +10,6 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelRepaddingTextView; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelRepaddingTextView;
import org.chromium.ui.resources.dynamics.DynamicResourceLoader; import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
...@@ -40,13 +39,8 @@ public class ContextualSearchContextControl extends OverlayPanelRepaddingTextVie ...@@ -40,13 +39,8 @@ public class ContextualSearchContextControl extends OverlayPanelRepaddingTextVie
ViewGroup container, ViewGroup container,
DynamicResourceLoader resourceLoader) { DynamicResourceLoader resourceLoader) {
super(panel, R.layout.contextual_search_context_view, R.id.contextual_search_context_view, super(panel, R.layout.contextual_search_context_view, R.id.contextual_search_context_view,
context, container, resourceLoader, context, container, resourceLoader, R.dimen.contextual_search_padded_button_width,
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) R.dimen.contextual_search_padded_button_width);
? R.dimen.contextual_search_end_padding
: R.dimen.overlay_panel_padded_button_width),
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? R.dimen.contextual_search_end_buttons_width
: R.dimen.overlay_panel_padded_button_width));
} }
/** /**
......
...@@ -94,13 +94,9 @@ public class ContextualSearchPanel extends OverlayPanel { ...@@ -94,13 +94,9 @@ public class ContextualSearchPanel extends OverlayPanel {
ApiCompatibilityUtils ApiCompatibilityUtils
.getDrawable(mContext.getResources(), R.drawable.modern_toolbar_shadow) .getDrawable(mContext.getResources(), R.drawable.modern_toolbar_shadow)
.getIntrinsicHeight(); .getIntrinsicHeight();
// We may have 1 or 2 buttons depending on old/new layout. mEndButtonWidthDp = mContext.getResources().getDimensionPixelSize(
int endButtonsWidthDimension = R.dimen.contextual_search_padded_button_width)
ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) * mPxToDp;
? R.dimen.contextual_search_end_buttons_width
: R.dimen.contextual_search_padded_button_width;
mEndButtonWidthDp =
mPxToDp * mContext.getResources().getDimensionPixelSize(endButtonsWidthDimension);
} }
@Override @Override
...@@ -282,6 +278,8 @@ public class ContextualSearchPanel extends OverlayPanel { ...@@ -282,6 +278,8 @@ public class ContextualSearchPanel extends OverlayPanel {
|| ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) || ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
&& isCoordinateInsideOpenTabButton(x))) { && isCoordinateInsideOpenTabButton(x))) {
mManagementDelegate.promoteToTab(); mManagementDelegate.promoteToTab();
} else {
peekPanel(StateChangeReason.UNKNOWN);
} }
} }
} }
...@@ -352,6 +350,32 @@ public class ContextualSearchPanel extends OverlayPanel { ...@@ -352,6 +350,32 @@ public class ContextualSearchPanel extends OverlayPanel {
} }
} }
@Override
public float getOpenTabIconX() {
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) {
return super.getOpenTabIconX();
} else {
if (LocalizationUtils.isLayoutRtl()) {
return getOffsetX() + getBarMarginSide();
} else {
return getOffsetX() + getWidth() - getBarMarginSide() - getCloseIconDimension();
}
}
}
@Override
protected boolean isCoordinateInsideCloseButton(float x) {
if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) return false;
return super.isCoordinateInsideCloseButton(x);
}
@Override
protected boolean isCoordinateInsideOpenTabButton(float x) {
return getOpenTabIconX() - getButtonPaddingDps() <= x
&& x <= getOpenTabIconX() + getOpenTabIconDimension() + getButtonPaddingDps();
}
@Override @Override
public float getContentY() { public float getContentY() {
return getOffsetY() + getBarContainerHeight() + getPromoHeightPx() * mPxToDp; return getOffsetY() + getBarContainerHeight() + getPromoHeightPx() * mPxToDp;
...@@ -630,6 +654,11 @@ public class ContextualSearchPanel extends OverlayPanel { ...@@ -630,6 +654,11 @@ public class ContextualSearchPanel extends OverlayPanel {
return new Rect(left, top, right, bottom); return new Rect(left, top, right, bottom);
} }
/** @return The padding used for each side of the button in the Bar. */
public float getButtonPaddingDps() {
return mButtonPaddingDps;
}
// ============================================================================================ // ============================================================================================
// Panel Metrics // Panel Metrics
// ============================================================================================ // ============================================================================================
......
...@@ -39,9 +39,7 @@ public class ContextualSearchTermControl extends OverlayPanelTextViewInflater { ...@@ -39,9 +39,7 @@ public class ContextualSearchTermControl extends OverlayPanelTextViewInflater {
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? R.dimen.contextual_search_end_padding ? R.dimen.contextual_search_end_padding
: R.dimen.overlay_panel_padded_button_width), : R.dimen.overlay_panel_padded_button_width),
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) R.dimen.contextual_search_padded_button_width);
? R.dimen.contextual_search_end_buttons_width
: R.dimen.overlay_panel_padded_button_width));
} }
/** /**
......
...@@ -150,23 +150,25 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer { ...@@ -150,23 +150,25 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer {
int panelShadowResourceId = panel.getPanelShadowVisible() int panelShadowResourceId = panel.getPanelShadowVisible()
? R.drawable.contextual_search_bar_background ? R.drawable.contextual_search_bar_background
: INVALID_RESOURCE_ID; : INVALID_RESOURCE_ID;
int closeIconResourceId = ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? INVALID_RESOURCE_ID
: ContextualSearchPanel.CLOSE_ICON_DRAWABLE_ID;
ContextualSearchSceneLayerJni.get().updateContextualSearchLayer(mNativePtr, ContextualSearchSceneLayerJni.get().updateContextualSearchLayer(mNativePtr,
ContextualSearchSceneLayer.this, panelShadowResourceId, searchBarBackgroundColor, ContextualSearchSceneLayer.this, panelShadowResourceId, searchBarBackgroundColor,
searchContextViewId, searchTermViewId, searchCaptionViewId, searchContextViewId, searchTermViewId, searchCaptionViewId,
R.drawable.modern_toolbar_shadow, R.drawable.ic_logo_googleg_24dp, R.drawable.modern_toolbar_shadow, R.drawable.ic_logo_googleg_24dp,
quickActionIconResId, R.drawable.breadcrumb_arrow, dragHandlebarId, quickActionIconResId, R.drawable.breadcrumb_arrow, dragHandlebarId,
openNewTabIconId, ContextualSearchPanel.CLOSE_ICON_DRAWABLE_ID, openNewTabIconId, closeIconResourceId, R.drawable.progress_bar_background,
R.drawable.progress_bar_background, R.drawable.progress_bar_foreground, R.drawable.progress_bar_foreground, searchPromoViewId,
searchPromoViewId, R.drawable.contextual_search_promo_ripple, R.drawable.contextual_search_promo_ripple, searchBarBannerTextViewId, mDpToPx,
searchBarBannerTextViewId, mDpToPx, panel.getFullscreenWidth() * mDpToPx, panel.getFullscreenWidth() * mDpToPx, panel.getTabHeight() * mDpToPx,
panel.getTabHeight() * mDpToPx, panel.getBasePageBrightness(), panel.getBasePageBrightness(), panel.getBasePageY() * mDpToPx, panelWebContents,
panel.getBasePageY() * mDpToPx, panelWebContents, searchPromoVisible, searchPromoVisible, searchPromoHeightPx, searchPromoOpacity,
searchPromoHeightPx, searchPromoOpacity, searchPromoBackgroundColor, searchPromoBackgroundColor, searchBarBannerVisible, searchBarBannerHeightPx,
searchBarBannerVisible, searchBarBannerHeightPx, searchBarBannerPaddingPx, searchBarBannerPaddingPx, searchBarBannerRippleWidthPx,
searchBarBannerRippleWidthPx, searchBarBannerRippleOpacity, searchBarBannerRippleOpacity, searchBarBannerTextOpacity, searchPanelX * mDpToPx,
searchBarBannerTextOpacity, searchPanelX * mDpToPx, searchPanelY * mDpToPx, searchPanelY * mDpToPx, searchPanelWidth * mDpToPx, searchPanelHeight * mDpToPx,
searchPanelWidth * mDpToPx, searchPanelHeight * mDpToPx,
searchBarMarginSide * mDpToPx, searchBarMarginTop * mDpToPx, searchBarMarginSide * mDpToPx, searchBarMarginTop * mDpToPx,
searchBarHeight * mDpToPx, searchContextOpacity, searchBarHeight * mDpToPx, searchContextOpacity,
searchBarControl.getTextLayerMinHeight(), searchTermOpacity, searchBarControl.getTextLayerMinHeight(), searchTermOpacity,
......
...@@ -67,7 +67,7 @@ public class MockResourcesForLayout extends MockResources { ...@@ -67,7 +67,7 @@ public class MockResourcesForLayout extends MockResources {
mFloats.put(org.chromium.chrome.R.dimen.overlay_panel_bar_height, 56.f); mFloats.put(org.chromium.chrome.R.dimen.overlay_panel_bar_height, 56.f);
mFloats.put(org.chromium.chrome.R.dimen.control_container_height, 56.f); mFloats.put(org.chromium.chrome.R.dimen.control_container_height, 56.f);
mFloats.put(org.chromium.chrome.R.dimen.contextual_search_bar_banner_padding, 12.f); mFloats.put(org.chromium.chrome.R.dimen.contextual_search_bar_banner_padding, 12.f);
mFloats.put(org.chromium.chrome.R.dimen.contextual_search_end_buttons_width, 48.f); mFloats.put(org.chromium.chrome.R.dimen.contextual_search_padded_button_width, 48.f);
mFloats.put(org.chromium.chrome.R.dimen.overlay_panel_end_buttons_width, 94.f); mFloats.put(org.chromium.chrome.R.dimen.overlay_panel_end_buttons_width, 94.f);
mFloats.put(org.chromium.chrome.R.dimen.toolbar_height_no_shadow, 56.f); mFloats.put(org.chromium.chrome.R.dimen.toolbar_height_no_shadow, 56.f);
mIntegers.put(R.color.modern_grey_100, 0xFFF1F3F4); mIntegers.put(R.color.modern_grey_100, 0xFFF1F3F4);
......
...@@ -234,29 +234,34 @@ void OverlayPanelLayer::SetProperties( ...@@ -234,29 +234,34 @@ void OverlayPanelLayer::SetProperties(
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Close Icon // Close Icon
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Grab the Close Icon resource. int close_icon_width = 0;
ui::Resource* close_icon_resource = float close_icon_left = 0.f;
resource_manager_->GetStaticResourceWithTint(close_icon_resource_id_,
icon_tint);
// Positions the icon at the end of the bar. // Positions the icon at the end of the bar.
float close_icon_left;
if (is_rtl) { if (is_rtl) {
close_icon_left = bar_margin_side; close_icon_left = bar_margin_side;
} else { } else {
close_icon_left = close_icon_left = panel_width - bar_margin_side;
panel_width - close_icon_resource->size().width() - bar_margin_side;
} }
if (close_icon_resource_id_ != kInvalidResourceID) {
// Grab the Close Icon resource.
ui::Resource* close_icon_resource =
resource_manager_->GetStaticResourceWithTint(close_icon_resource_id_,
icon_tint);
// Centers the Close Icon vertically in the bar. // Positions the icon at the end of the bar.
float close_icon_top = close_icon_width = close_icon_resource->size().width();
bar_top_y + bar_height / 2 - close_icon_resource->size().height() / 2; if (!is_rtl) {
close_icon_left = close_icon_left - close_icon_width;
}
close_icon_->SetUIResourceId(close_icon_resource->ui_resource()->id()); // Centers the Close Icon vertically in the bar.
close_icon_->SetBounds(close_icon_resource->size()); float close_icon_top =
close_icon_->SetPosition( bar_top_y + bar_height / 2 - close_icon_resource->size().height() / 2;
gfx::PointF(close_icon_left, close_icon_top)); close_icon_->SetUIResourceId(close_icon_resource->ui_resource()->id());
close_icon_->SetOpacity(icon_opacity); close_icon_->SetBounds(close_icon_resource->size());
close_icon_->SetPosition(gfx::PointF(close_icon_left, close_icon_top));
close_icon_->SetOpacity(icon_opacity);
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Open Tab icon // Open Tab icon
...@@ -265,13 +270,12 @@ void OverlayPanelLayer::SetProperties( ...@@ -265,13 +270,12 @@ void OverlayPanelLayer::SetProperties(
ui::Resource* open_tab_icon_resource = ui::Resource* open_tab_icon_resource =
resource_manager_->GetStaticResourceWithTint(open_tab_icon_resource_id_, resource_manager_->GetStaticResourceWithTint(open_tab_icon_resource_id_,
icon_tint); icon_tint);
// Positions the icon at the end of the bar. // Positions the icon at the end of the bar.
float open_tab_top = close_icon_top; float open_tab_top = bar_top_y + bar_height / 2 -
open_tab_icon_resource->size().height() / 2;
float open_tab_left; float open_tab_left;
float spacing_between_icons = 2 * bar_margin_side; float spacing_between_icons = 2 * bar_margin_side;
float margin_from_close_icon = float margin_from_close_icon = close_icon_width + spacing_between_icons;
close_icon_resource->size().width() + spacing_between_icons;
if (is_rtl) { if (is_rtl) {
open_tab_left = close_icon_left + margin_from_close_icon; open_tab_left = close_icon_left + margin_from_close_icon;
} else { } else {
......
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