Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: ash/launcher/launcher_view.cc

Issue 14574009: Use correctly mirrored points for ideal bounds of launcher item icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add RTL icon reordering test. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/launcher/launcher_view.cc
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index bf7b96ba250405f228e486d5661ddf9382fa3d23..f79a432ec118612a9f253ba79dd4a3afe75c5fb2 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -439,8 +439,9 @@ gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) {
LauncherButton* button =
static_cast<LauncherButton*>(view_model_->view_at(index));
gfx::Rect icon_bounds = button->GetIconBounds();
- return gfx::Rect(ideal_bounds.x() + icon_bounds.x(),
- ideal_bounds.y() + icon_bounds.y(),
+ return gfx::Rect(GetMirroredXWithWidthInView(ideal_bounds.x(),
+ icon_bounds.width()),
+ ideal_bounds.y(),
icon_bounds.width(),
icon_bounds.height());
}
@@ -452,19 +453,21 @@ void LauncherView::UpdatePanelIconPosition(LauncherID id,
if (current_index < first_panel_index)
return;
+ gfx::Point midpoint_in_view(GetMirroredXInView(midpoint.x()),
+ midpoint.y());
ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
int target_index = current_index;
while (target_index > first_panel_index &&
shelf->PrimaryAxisValue(view_model_->ideal_bounds(target_index).x(),
view_model_->ideal_bounds(target_index).y()) >
- shelf->PrimaryAxisValue(midpoint.x(), midpoint.y())) {
+ shelf->PrimaryAxisValue(midpoint_in_view.x(), midpoint_in_view.y())) {
--target_index;
}
while (target_index < view_model_->view_size() - 1 &&
shelf->PrimaryAxisValue(
view_model_->ideal_bounds(target_index).right(),
view_model_->ideal_bounds(target_index).bottom()) <
- shelf->PrimaryAxisValue(midpoint.x(), midpoint.y())) {
+ shelf->PrimaryAxisValue(midpoint_in_view.x(), midpoint_in_view.y())) {
++target_index;
}
if (current_index != target_index)
« no previous file with comments | « no previous file | ash/launcher/launcher_view_unittest.cc » ('j') | ash/wm/panels/panel_layout_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698