Chrome Version : 70.0.3528.4
OS Version: Chrome
See also Issue 805612 (new shelf ui)
Context: in https://crrev.com/c/1186218 I experimented with consolidating some seemingly-unused logic for ShelfTooltipBubble for catering for an arrow on the bubble, which no longer exists.
Removing that logic makes the tooltips hug the shelf rather than positioning away from it to leave room for an arrow. See screenshots at https://crbug.com/869928#c6 . The consensus is that the screenshots "look weird". Although, it would be consistent with the IME and stylus popup bubbles. However, there are other bubbles that do other things.
I'm wondering whether we should try to remove this complexity and just have a single constant for all "bubbles" appearing above the shelf due to hover/touch/click. It's currently a bit of a mess.
There is
- ShelfTooltipBubble --> ash::kBubblePaddingHorizontalBottom = 6;
- Right-click menus --> views::MenuConfig::touchable_anchor_offset = 8
- IME popup, stylus palette --> 0
- unified system tray -->tray->shelf()->GetSystemTrayAnchor()->GetBubbleAnchorInsets() = 9 (from constants in views/bubble_border.cc)
tray->shelf()->GetSystemTrayAnchor()->GetBubbleAnchorInsets() is complex, but the distance-from-shelf offset boils down to "9". First there is some logic to find the distance from the button *on* the shelf that shows the tray to to the edge of the shelf. That's from -1*TrayBackgroundView::GetInsets(), which ... comes from ash::StatusAreaWidgetDelegate::SetBorderOnChild(), which is also complex, but it's "basically"
const int padding = (ShelfConstants::shelf_size() - kTrayItemSize) / 2;
which is (chromeos::switches::ShouldUseShelfNewUi() ? kShelfSizeNewUi : kShelfSize) - kTrayItemSize) / 2
which is [for me] ((false ? 56 : 48) - 32) / 2
which is (48 - 32) / 2 == 16 / 2 == 8 \o/
.. unless we run with --shelf-new-ui, which makes it 12.
The remaining offset comes from TrayBubbleView::GetBorderInsets(), which comes from BubbleBorder::GetInsets(), which is GetBorderAndShadowInsets(nullopt), which is kShadowBlur + kBorderThicknessDip + kShadowVerticalOffset = 6 + 2 + 1 == 9 \o/
Comment 1 by tapted@chromium.org
, Aug 30