Commit 4b299a40 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

App list folder RTL fixes

Adds few missing mirrored x transformations for app list folder view:
*    folder_item_icon_bounds_, which is intended to be in the folder
     view's coordinates, were calculated from apps container bounds
     without adjustments for RTL (messing up folder show/hide animation
     original/target bounds)
*    reparent drag location was transformed from folder item coordinates
     in container view to container view coordinates to root apps grid
     view coordinates, both steps without RTL adjustments.

BUG=1048841

Change-Id: I7a158858e6e9067b2711a3b2d53a1f452ad5dd14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037645
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738387}
parent c0a1ae1c
......@@ -617,6 +617,14 @@ void AppListFolderView::UpdatePreferredBounds() {
// Calculate the folder icon's bounds relative to this view.
folder_item_icon_bounds_ =
icon_bounds_in_container - preferred_bounds_.OffsetFromOrigin();
// Adjust folder item icon bounds for RTL (cannot use GetMirroredRect(), as
// the current view bounds might not match the preferred bounds).
if (base::i18n::IsRTL()) {
folder_item_icon_bounds_.set_x(preferred_bounds_.width() -
folder_item_icon_bounds_.x() -
folder_item_icon_bounds_.width());
}
}
int AppListFolderView::GetYOffsetForFolder() {
......@@ -785,7 +793,9 @@ void AppListFolderView::DispatchDragEventForReparent(
AppsGridView::Pointer pointer,
const gfx::Point& drag_point_in_folder_grid) {
AppsGridView* root_grid = container_view_->apps_grid_view();
gfx::Point drag_point_in_root_grid = drag_point_in_folder_grid;
gfx::Point drag_point_in_root_grid(
GetMirroredXInView(drag_point_in_folder_grid.x()),
drag_point_in_folder_grid.y());
// Temporarily reset the transform of the contents container so that the point
// can be correctly converted to the root grid's coordinates.
......@@ -794,6 +804,8 @@ void AppListFolderView::DispatchDragEventForReparent(
ConvertPointToTarget(items_grid_view_, root_grid, &drag_point_in_root_grid);
contents_container_->SetTransform(original_transform);
drag_point_in_root_grid.set_x(
root_grid->GetMirroredXInView(drag_point_in_root_grid.x()));
root_grid->UpdateDragFromReparentItem(pointer, drag_point_in_root_grid);
}
......
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