Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/drag_drop/drag_image_view.h" | 11 #include "ash/drag_drop/drag_image_view.h" |
| 12 #include "ash/launcher/launcher_button.h" | 12 #include "ash/launcher/launcher_button.h" |
| 13 #include "ash/launcher/launcher_delegate.h" | 13 #include "ash/launcher/launcher_delegate.h" |
| 14 #include "ash/launcher/launcher_icon_observer.h" | 14 #include "ash/launcher/launcher_icon_observer.h" |
| 15 #include "ash/launcher/launcher_item_delegate.h" | |
| 16 #include "ash/launcher/launcher_item_delegate_manager.h" | |
| 15 #include "ash/launcher/launcher_model.h" | 17 #include "ash/launcher/launcher_model.h" |
| 16 #include "ash/launcher/launcher_tooltip_manager.h" | 18 #include "ash/launcher/launcher_tooltip_manager.h" |
| 17 #include "ash/launcher/overflow_bubble.h" | 19 #include "ash/launcher/overflow_bubble.h" |
| 18 #include "ash/launcher/overflow_button.h" | 20 #include "ash/launcher/overflow_button.h" |
| 19 #include "ash/launcher/tabbed_launcher_button.h" | 21 #include "ash/launcher/tabbed_launcher_button.h" |
| 20 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 21 #include "ash/scoped_target_root_window.h" | 23 #include "ash/scoped_target_root_window.h" |
| 22 #include "ash/shelf/alternate_app_list_button.h" | 24 #include "ash/shelf/alternate_app_list_button.h" |
| 23 #include "ash/shelf/app_list_button.h" | 25 #include "ash/shelf/app_list_button.h" |
| 24 #include "ash/shelf/shelf_layout_manager.h" | 26 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 drag_offset_(0), | 403 drag_offset_(0), |
| 402 start_drag_index_(-1), | 404 start_drag_index_(-1), |
| 403 context_menu_id_(0), | 405 context_menu_id_(0), |
| 404 leading_inset_(kDefaultLeadingInset), | 406 leading_inset_(kDefaultLeadingInset), |
| 405 cancelling_drag_model_changed_(false), | 407 cancelling_drag_model_changed_(false), |
| 406 last_hidden_index_(0), | 408 last_hidden_index_(0), |
| 407 closing_event_time_(base::TimeDelta()), | 409 closing_event_time_(base::TimeDelta()), |
| 408 got_deleted_(NULL), | 410 got_deleted_(NULL), |
| 409 drag_and_drop_item_pinned_(false), | 411 drag_and_drop_item_pinned_(false), |
| 410 drag_and_drop_launcher_id_(0), | 412 drag_and_drop_launcher_id_(0), |
| 411 dragged_off_shelf_(false) { | 413 dragged_off_shelf_(false), |
| 414 item_manager_(Shell::GetInstance()->launcher_item_delegate_manager()) { | |
| 412 DCHECK(model_); | 415 DCHECK(model_); |
| 413 bounds_animator_.reset(new views::BoundsAnimator(this)); | 416 bounds_animator_.reset(new views::BoundsAnimator(this)); |
| 414 bounds_animator_->AddObserver(this); | 417 bounds_animator_->AddObserver(this); |
| 415 set_context_menu_controller(this); | 418 set_context_menu_controller(this); |
| 416 focus_search_.reset(new LauncherFocusSearch(view_model_.get())); | 419 focus_search_.reset(new LauncherFocusSearch(view_model_.get())); |
| 417 tooltip_.reset(new LauncherTooltipManager( | 420 tooltip_.reset(new LauncherTooltipManager( |
| 418 shelf_layout_manager, this)); | 421 shelf_layout_manager, this)); |
| 419 } | 422 } |
| 420 | 423 |
| 421 LauncherView::~LauncherView() { | 424 LauncherView::~LauncherView() { |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 974 view, new FadeInAnimationDelegate(view), true); | 977 view, new FadeInAnimationDelegate(view), true); |
| 975 } | 978 } |
| 976 | 979 |
| 977 void LauncherView::PrepareForDrag(Pointer pointer, | 980 void LauncherView::PrepareForDrag(Pointer pointer, |
| 978 const ui::LocatedEvent& event) { | 981 const ui::LocatedEvent& event) { |
| 979 DCHECK(!dragging()); | 982 DCHECK(!dragging()); |
| 980 DCHECK(drag_view_); | 983 DCHECK(drag_view_); |
| 981 drag_pointer_ = pointer; | 984 drag_pointer_ = pointer; |
| 982 start_drag_index_ = view_model_->GetIndexOfView(drag_view_); | 985 start_drag_index_ = view_model_->GetIndexOfView(drag_view_); |
| 983 | 986 |
| 984 // If the item is no longer draggable, bail out. | 987 if (start_drag_index_== -1) { |
| 985 if (start_drag_index_ == -1 || | |
| 986 !delegate_->IsDraggable(model_->items()[start_drag_index_])) { | |
| 987 CancelDrag(-1); | 988 CancelDrag(-1); |
| 988 return; | 989 return; |
| 989 } | 990 } |
| 991 | |
| 992 // If the item is no longer draggable, bail out. | |
| 993 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( | |
| 994 model_->items()[start_drag_index_].type); | |
| 995 if (!item_delegate->IsDraggable(model_->items()[start_drag_index_])) { | |
| 996 CancelDrag(-1); | |
| 997 return; | |
| 998 } | |
| 990 | 999 |
| 991 // Move the view to the front so that it appears on top of other views. | 1000 // Move the view to the front so that it appears on top of other views. |
| 992 ReorderChildView(drag_view_, -1); | 1001 ReorderChildView(drag_view_, -1); |
| 993 bounds_animator_->StopAnimatingView(drag_view_); | 1002 bounds_animator_->StopAnimatingView(drag_view_); |
| 994 } | 1003 } |
| 995 | 1004 |
| 996 void LauncherView::ContinueDrag(const ui::LocatedEvent& event) { | 1005 void LauncherView::ContinueDrag(const ui::LocatedEvent& event) { |
| 997 // Due to a syncing operation the application might have been removed. | 1006 // Due to a syncing operation the application might have been removed. |
| 998 // Bail if it is gone. | 1007 // Bail if it is gone. |
| 999 int current_index = view_model_->GetIndexOfView(drag_view_); | 1008 int current_index = view_model_->GetIndexOfView(drag_view_); |
| 1000 DCHECK_NE(-1, current_index); | 1009 DCHECK_NE(-1, current_index); |
| 1001 if (current_index == -1 || | 1010 |
| 1002 !delegate_->IsDraggable(model_->items()[current_index])) { | 1011 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( |
| 1012 model_->items()[current_index].type); | |
| 1013 if (!item_delegate->IsDraggable(model_->items()[current_index])) { | |
| 1003 CancelDrag(-1); | 1014 CancelDrag(-1); |
| 1004 return; | 1015 return; |
| 1005 } | 1016 } |
| 1006 | 1017 |
| 1007 // If this is not a drag and drop host operation, check if the item got | 1018 // If this is not a drag and drop host operation, check if the item got |
| 1008 // ripped off the shelf - if it did we are done. | 1019 // ripped off the shelf - if it did we are done. |
| 1009 if (!drag_and_drop_launcher_id_ && ash::switches::UseDragOffShelf()) { | 1020 if (!drag_and_drop_launcher_id_ && ash::switches::UseDragOffShelf()) { |
| 1010 if (HandleRipOffDrag(event)) | 1021 if (HandleRipOffDrag(event)) |
| 1011 return; | 1022 return; |
| 1012 // The rip off handler could have changed the location of the item. | 1023 // The rip off handler could have changed the location of the item. |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1489 } | 1500 } |
| 1490 | 1501 |
| 1491 void LauncherView::PointerPressedOnButton(views::View* view, | 1502 void LauncherView::PointerPressedOnButton(views::View* view, |
| 1492 Pointer pointer, | 1503 Pointer pointer, |
| 1493 const ui::LocatedEvent& event) { | 1504 const ui::LocatedEvent& event) { |
| 1494 if (drag_view_) | 1505 if (drag_view_) |
| 1495 return; | 1506 return; |
| 1496 | 1507 |
| 1497 tooltip_->Close(); | 1508 tooltip_->Close(); |
| 1498 int index = view_model_->GetIndexOfView(view); | 1509 int index = view_model_->GetIndexOfView(view); |
| 1499 if (index == -1 || | 1510 if (index == -1) |
| 1500 view_model_->view_size() <= 1 || | 1511 return; |
| 1501 !delegate_->IsDraggable(model_->items()[index])) | 1512 |
| 1513 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( | |
| 1514 model_->items()[index].type); | |
| 1515 if (view_model_->view_size() <= 1 || | |
| 1516 !item_delegate->IsDraggable(model_->items()[index])) | |
| 1502 return; // View is being deleted or not draggable, ignore request. | 1517 return; // View is being deleted or not draggable, ignore request. |
| 1503 | 1518 |
| 1504 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager(); | 1519 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager(); |
| 1505 | 1520 |
| 1506 drag_view_ = view; | 1521 drag_view_ = view; |
| 1507 drag_offset_ = shelf->PrimaryAxisValue(event.x(), event.y()); | 1522 drag_offset_ = shelf->PrimaryAxisValue(event.x(), event.y()); |
| 1508 } | 1523 } |
| 1509 | 1524 |
| 1510 void LauncherView::PointerDraggedOnButton(views::View* view, | 1525 void LauncherView::PointerDraggedOnButton(views::View* view, |
| 1511 Pointer pointer, | 1526 Pointer pointer, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1560 if (!tooltip_->IsVisible()) | 1575 if (!tooltip_->IsVisible()) |
| 1561 tooltip_->StopTimer(); | 1576 tooltip_->StopTimer(); |
| 1562 } | 1577 } |
| 1563 | 1578 |
| 1564 base::string16 LauncherView::GetAccessibleName(const views::View* view) { | 1579 base::string16 LauncherView::GetAccessibleName(const views::View* view) { |
| 1565 int view_index = view_model_->GetIndexOfView(view); | 1580 int view_index = view_model_->GetIndexOfView(view); |
| 1566 // May be -1 while in the process of animating closed. | 1581 // May be -1 while in the process of animating closed. |
| 1567 if (view_index == -1) | 1582 if (view_index == -1) |
| 1568 return base::string16(); | 1583 return base::string16(); |
| 1569 | 1584 |
| 1570 switch (model_->items()[view_index].type) { | 1585 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( |
| 1571 case TYPE_TABBED: | 1586 model_->items()[view_index].type); |
| 1572 case TYPE_APP_PANEL: | 1587 return item_delegate->GetTitle(model_->items()[view_index]); |
| 1573 case TYPE_APP_SHORTCUT: | |
| 1574 case TYPE_WINDOWED_APP: | |
| 1575 case TYPE_PLATFORM_APP: | |
| 1576 case TYPE_BROWSER_SHORTCUT: | |
| 1577 return delegate_->GetTitle(model_->items()[view_index]); | |
| 1578 | |
| 1579 case TYPE_APP_LIST: | |
| 1580 return model_->status() == LauncherModel::STATUS_LOADING ? | |
| 1581 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) : | |
| 1582 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); | |
| 1583 } | |
| 1584 return base::string16(); | |
| 1585 } | 1588 } |
| 1586 | 1589 |
| 1587 void LauncherView::ButtonPressed(views::Button* sender, | 1590 void LauncherView::ButtonPressed(views::Button* sender, |
| 1588 const ui::Event& event) { | 1591 const ui::Event& event) { |
| 1589 // Do not handle mouse release during drag. | 1592 // Do not handle mouse release during drag. |
| 1590 if (dragging()) | 1593 if (dragging()) |
| 1591 return; | 1594 return; |
| 1592 | 1595 |
| 1593 tooltip_->Close(); | 1596 tooltip_->Close(); |
| 1594 | 1597 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1618 } | 1621 } |
| 1619 | 1622 |
| 1620 // Collect usage statistics before we decide what to do with the click. | 1623 // Collect usage statistics before we decide what to do with the click. |
| 1621 switch (model_->items()[view_index].type) { | 1624 switch (model_->items()[view_index].type) { |
| 1622 case TYPE_APP_SHORTCUT: | 1625 case TYPE_APP_SHORTCUT: |
| 1623 case TYPE_WINDOWED_APP: | 1626 case TYPE_WINDOWED_APP: |
| 1624 case TYPE_PLATFORM_APP: | 1627 case TYPE_PLATFORM_APP: |
| 1625 case TYPE_BROWSER_SHORTCUT: | 1628 case TYPE_BROWSER_SHORTCUT: |
| 1626 Shell::GetInstance()->delegate()->RecordUserMetricsAction( | 1629 Shell::GetInstance()->delegate()->RecordUserMetricsAction( |
| 1627 UMA_LAUNCHER_CLICK_ON_APP); | 1630 UMA_LAUNCHER_CLICK_ON_APP); |
| 1628 // Fallthrough | |
| 1629 case TYPE_TABBED: | |
| 1630 case TYPE_APP_PANEL: | |
| 1631 delegate_->ItemSelected(model_->items()[view_index], event); | |
| 1632 // Don't show the menu when the user creates a new browser using ctrl | |
| 1633 // click. | |
| 1634 if (model_->items()[view_index].type != TYPE_BROWSER_SHORTCUT || | |
| 1635 !(event.flags() & ui::EF_CONTROL_DOWN)) | |
| 1636 ShowListMenuForView(model_->items()[view_index], sender, event); | |
| 1637 break; | 1631 break; |
| 1638 | 1632 |
| 1639 case TYPE_APP_LIST: | 1633 case TYPE_APP_LIST: |
| 1640 Shell::GetInstance()->delegate()->RecordUserMetricsAction( | 1634 Shell::GetInstance()->delegate()->RecordUserMetricsAction( |
| 1641 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON); | 1635 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON); |
| 1642 Shell::GetInstance()->ToggleAppList(GetWidget()->GetNativeView()); | 1636 break; |
| 1637 | |
| 1638 case TYPE_TABBED: | |
| 1639 case TYPE_APP_PANEL: | |
| 1643 break; | 1640 break; |
| 1644 } | 1641 } |
| 1642 | |
| 1643 LauncherItemDelegate* item_delegate = | |
| 1644 item_manager_->GetLauncherItemDelegate( | |
| 1645 model_->items()[view_index].type); | |
| 1646 item_delegate->ItemSelected(model_->items()[view_index], event); | |
| 1647 | |
| 1648 ShowListMenuForView(model_->items()[view_index], sender, event); | |
|
simonhong_
2013/08/27 21:52:00
I moved this refactoring code into ScopedTargetRoo
Mr4D (OOO till 08-26)
2013/08/28 00:06:06
Sorry, but did you test why this was failing?
Thi
simonhong_
2013/08/28 00:33:58
Yes, I tested and found failing reason.
Failing re
oshima
2013/08/28 05:27:46
Yes, that's correct fix.
| |
| 1645 } | 1649 } |
| 1646 } | 1650 } |
| 1647 | 1651 |
| 1648 bool LauncherView::ShowListMenuForView(const LauncherItem& item, | 1652 bool LauncherView::ShowListMenuForView(const LauncherItem& item, |
| 1649 views::View* source, | 1653 views::View* source, |
| 1650 const ui::Event& event) { | 1654 const ui::Event& event) { |
| 1651 scoped_ptr<ash::LauncherMenuModel> menu_model; | 1655 scoped_ptr<ash::LauncherMenuModel> menu_model; |
| 1652 menu_model.reset(delegate_->CreateApplicationMenu(item, event.flags())); | 1656 LauncherItemDelegate* item_delegate = |
| 1657 item_manager_->GetLauncherItemDelegate(item.type); | |
| 1658 menu_model.reset(item_delegate->CreateApplicationMenu(item, event.flags())); | |
| 1653 | 1659 |
| 1654 // Make sure we have a menu and it has at least two items in addition to the | 1660 // Make sure we have a menu and it has at least two items in addition to the |
| 1655 // application title and the 3 spacing separators. | 1661 // application title and the 3 spacing separators. |
| 1656 if (!menu_model.get() || menu_model->GetItemCount() <= 5) | 1662 if (!menu_model.get() || menu_model->GetItemCount() <= 5) |
| 1657 return false; | 1663 return false; |
| 1658 | 1664 |
| 1659 ShowMenu(scoped_ptr<views::MenuModelAdapter>( | 1665 ShowMenu(scoped_ptr<views::MenuModelAdapter>( |
| 1660 new LauncherMenuModelAdapter(menu_model.get())), | 1666 new LauncherMenuModelAdapter(menu_model.get())), |
| 1661 source, | 1667 source, |
| 1662 gfx::Point(), | 1668 gfx::Point(), |
| 1663 false, | 1669 false, |
| 1664 ui::GetMenuSourceTypeForEvent(event)); | 1670 ui::GetMenuSourceTypeForEvent(event)); |
| 1665 return true; | 1671 return true; |
| 1666 } | 1672 } |
| 1667 | 1673 |
| 1668 void LauncherView::ShowContextMenuForView(views::View* source, | 1674 void LauncherView::ShowContextMenuForView(views::View* source, |
| 1669 const gfx::Point& point, | 1675 const gfx::Point& point, |
| 1670 ui:: MenuSourceType source_type) { | 1676 ui:: MenuSourceType source_type) { |
| 1671 int view_index = view_model_->GetIndexOfView(source); | 1677 int view_index = view_model_->GetIndexOfView(source); |
| 1678 // TODO(simon.hong81): Create LauncherContextMenu for applist in its | |
| 1679 // LauncherItemDelegate. | |
| 1672 if (view_index != -1 && | 1680 if (view_index != -1 && |
| 1673 model_->items()[view_index].type == TYPE_APP_LIST) { | 1681 model_->items()[view_index].type == TYPE_APP_LIST) { |
| 1674 view_index = -1; | 1682 view_index = -1; |
| 1675 } | 1683 } |
| 1676 | 1684 |
| 1677 tooltip_->Close(); | 1685 tooltip_->Close(); |
| 1678 | 1686 |
| 1679 if (view_index == -1) { | 1687 if (view_index == -1) { |
| 1680 Shell::GetInstance()->ShowContextMenu(point, source_type); | 1688 Shell::GetInstance()->ShowContextMenu(point, source_type); |
| 1681 return; | 1689 return; |
| 1682 } | 1690 } |
| 1683 scoped_ptr<ui::MenuModel> menu_model(delegate_->CreateContextMenu( | 1691 scoped_ptr<ui::MenuModel> menu_model; |
| 1692 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( | |
| 1693 model_->items()[view_index].type); | |
| 1694 menu_model.reset(item_delegate->CreateContextMenu( | |
| 1684 model_->items()[view_index], | 1695 model_->items()[view_index], |
| 1685 source->GetWidget()->GetNativeView()->GetRootWindow())); | 1696 source->GetWidget()->GetNativeView()->GetRootWindow())); |
| 1686 if (!menu_model) | 1697 if (!menu_model) |
| 1687 return; | 1698 return; |
| 1699 | |
| 1688 base::AutoReset<LauncherID> reseter( | 1700 base::AutoReset<LauncherID> reseter( |
| 1689 &context_menu_id_, | 1701 &context_menu_id_, |
| 1690 view_index == -1 ? 0 : model_->items()[view_index].id); | 1702 view_index == -1 ? 0 : model_->items()[view_index].id); |
| 1691 | 1703 |
| 1692 ShowMenu(scoped_ptr<views::MenuModelAdapter>( | 1704 ShowMenu(scoped_ptr<views::MenuModelAdapter>( |
| 1693 new views::MenuModelAdapter(menu_model.get())), | 1705 new views::MenuModelAdapter(menu_model.get())), |
| 1694 source, | 1706 source, |
| 1695 point, | 1707 point, |
| 1696 true, | 1708 true, |
| 1697 source_type); | 1709 source_type); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1809 if (view_index == -1) | 1821 if (view_index == -1) |
| 1810 return NULL; | 1822 return NULL; |
| 1811 return &(model_->items()[view_index]); | 1823 return &(model_->items()[view_index]); |
| 1812 } | 1824 } |
| 1813 | 1825 |
| 1814 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { | 1826 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { |
| 1815 if (view == GetAppListButtonView() && | 1827 if (view == GetAppListButtonView() && |
| 1816 Shell::GetInstance()->GetAppListWindow()) | 1828 Shell::GetInstance()->GetAppListWindow()) |
| 1817 return false; | 1829 return false; |
| 1818 const LauncherItem* item = LauncherItemForView(view); | 1830 const LauncherItem* item = LauncherItemForView(view); |
| 1819 return (!item || delegate_->ShouldShowTooltip(*item)); | 1831 if (!item) |
| 1832 return true; | |
| 1833 LauncherItemDelegate* item_delegate = | |
| 1834 item_manager_->GetLauncherItemDelegate(item->type); | |
| 1835 return item_delegate->ShouldShowTooltip(*item); | |
| 1820 } | 1836 } |
| 1821 | 1837 |
| 1822 int LauncherView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1838 int LauncherView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1823 ShelfWidget* shelf = RootWindowController::ForLauncher( | 1839 ShelfWidget* shelf = RootWindowController::ForLauncher( |
| 1824 GetWidget()->GetNativeView())->shelf(); | 1840 GetWidget()->GetNativeView())->shelf(); |
| 1825 ash::ShelfAlignment align = shelf->GetAlignment(); | 1841 ash::ShelfAlignment align = shelf->GetAlignment(); |
| 1826 const gfx::Rect bounds = GetBoundsInScreen(); | 1842 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1827 int distance = 0; | 1843 int distance = 0; |
| 1828 switch (align) { | 1844 switch (align) { |
| 1829 case ash::SHELF_ALIGNMENT_BOTTOM: | 1845 case ash::SHELF_ALIGNMENT_BOTTOM: |
| 1830 distance = bounds.y() - coordinate.y(); | 1846 distance = bounds.y() - coordinate.y(); |
| 1831 break; | 1847 break; |
| 1832 case ash::SHELF_ALIGNMENT_LEFT: | 1848 case ash::SHELF_ALIGNMENT_LEFT: |
| 1833 distance = coordinate.x() - bounds.right(); | 1849 distance = coordinate.x() - bounds.right(); |
| 1834 break; | 1850 break; |
| 1835 case ash::SHELF_ALIGNMENT_RIGHT: | 1851 case ash::SHELF_ALIGNMENT_RIGHT: |
| 1836 distance = bounds.x() - coordinate.x(); | 1852 distance = bounds.x() - coordinate.x(); |
| 1837 break; | 1853 break; |
| 1838 case ash::SHELF_ALIGNMENT_TOP: | 1854 case ash::SHELF_ALIGNMENT_TOP: |
| 1839 distance = coordinate.y() - bounds.bottom(); | 1855 distance = coordinate.y() - bounds.bottom(); |
| 1840 break; | 1856 break; |
| 1841 } | 1857 } |
| 1842 return distance > 0 ? distance : 0; | 1858 return distance > 0 ? distance : 0; |
| 1843 } | 1859 } |
| 1844 | 1860 |
| 1845 } // namespace internal | 1861 } // namespace internal |
| 1846 } // namespace ash | 1862 } // namespace ash |
| OLD | NEW |