Commit 33b81ae0 authored by Sinan Sahin's avatar Sinan Sahin Committed by Commit Bot

[Offline indicator v2] Fix tablet CCT toolbar margin

Currently, top margin for the control container is calculated using
top_controls_height - tab_strip_and_toolbar_height (dimen). On tablet
CCTs, this may be negative since the tablet CCTs don't have a tab strip
while the tab_strip_and_toolbar_height always includes the tab strip
height on tablets.

A better way is to use the real view heights instead of dimens.

Bug: 1098716
Change-Id: I7428536b722df4489028115511a0c743665fd964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2265176Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Cr-Commit-Position: refs/heads/master@{#782656}
parent cc3949fb
......@@ -1123,9 +1123,14 @@ public class ToolbarManager implements UrlFocusChangeListener, ThemeColorObserve
* @return The extra Y offset for the toolbar in pixels.
*/
private int getToolbarExtraYOffset() {
final int stripAndToolbarHeight = mActivity.getResources().getDimensionPixelSize(
R.dimen.tab_strip_and_toolbar_height);
return mBrowserControlsSizer.getTopControlsHeight() - stripAndToolbarHeight;
return mBrowserControlsSizer.getTopControlsHeight()
- getControlContainerHeightWithoutShadow();
}
private int getControlContainerHeightWithoutShadow() {
final View toolbarShadow = mControlContainer.findViewById(R.id.toolbar_shadow);
final int shadowHeight = toolbarShadow != null ? toolbarShadow.getHeight() : 0;
return mControlContainer.getHeight() - shadowHeight;
}
/**
......
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