Commit 0219d22b authored by Yunke Zhou's avatar Yunke Zhou Committed by Commit Bot

Cros lock screen: fix login bubble misplacement issue for RTL language

In RTL case, the coordinate system is from right to left and the origin is the right upper corner. The coordinates for everything on the lock screen should be the same in both LTR and RTL cases and therefor mirroring is not needed.

The misplacement is due to doing mirroring in `ConvertPointToTarget` when finding the position of the bubble. We need to remove the mirroring effect in order to find the correct position for login bubble.

Bug: 937245
Change-Id: I4c4ce54ab7617a5c4c56e861afb7a103b045ef8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505869
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822175}
parent 82893270
......@@ -180,10 +180,20 @@ gfx::Point LoginBaseBubbleView::CalculatePosition() {
// calculated by using the root view's coordinates system. kShowAbove and
// kShowBelow are less complicated, they only use the coordinate system of the
// the anchor view's parent.
// In RTL case, we are doing mirroring in `ConvertPointToTarget` when finding
// the position of the bubble. However, there's no need to mirror since the
// coordinate system is from right to left and the origin is the right upper
// corner. `GetMirroredXWithWidthInView` is called to cancel out the mirroring
// effect and returning the correct position for the bubble.
gfx::Point anchor_position = GetAnchorView()->bounds().origin();
gfx::Point origin;
ConvertPointToTarget(GetAnchorView()->parent() /*source*/,
GetAnchorView()->GetWidget()->GetRootView() /*target*/,
&anchor_position);
&origin);
origin.set_x(parent()->GetMirroredXWithWidthInView(
origin.x(), GetAnchorView()->parent()->width()));
anchor_position += origin.OffsetFromOrigin();
auto bounds = GetBoundsAvailableToShowBubble();
gfx::Size bubble_size(width() + 2 * horizontal_padding_,
height() + vertical_padding_);
......
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