Commit 6d6f2396 authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Commit Bot

Revert "Miscellaneous holding space fixes."

This reverts commit 9a224d53.

Reason for revert: causing a crash of HoldingSpaceUiBrowserTest.OpenItem on linux-chromeos-chrome

BUG=1133808

Original change's description:
> Miscellaneous holding space fixes.
>
> Fix pin toggle bounds in HoldingSpaceItemScreenshotView:
> The bounds of the pin toggle button were being stretched to match the
> full height of its parent container.
>
> Fix context menu bounds:
> Context menu should be below the associated view (when space allows).
>
> Fix long press gesture:
> When long pressing, the pressed view should become the selection just
> prior to showing the context menu.
>
> Fix crash in HoldingSpaceTrayBubble:
> If closing bubble due to ESC, bubble widget should only be closed if it
> exists and hasn't already been marked closed.
>
> Fix drag behavior:
> The holding space bubble should be closed during drag events.
>
> Bug: 1131262, 1131267, 1129981
> Change-Id: I5a1f0536ae6badeed841e0a6106e9c423cbf3781
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436671
> Reviewed-by: Ahmed Mehfooz <amehfooz@chromium.org>
> Commit-Queue: David Black <dmblack@google.com>
> Cr-Commit-Position: refs/heads/master@{#812064}

TBR=dmblack@google.com,amehfooz@chromium.org

Change-Id: I1a1321e8ad5a5c3dc9d7371a62908d06f4d8bdf4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1131262
Bug: 1131267
Bug: 1129981
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441320Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812272}
parent 13f7711e
......@@ -24,7 +24,6 @@ constexpr int kHoldingSpaceChipWidth = 160;
constexpr int kHoldingSpaceChipsPerRow = 2;
constexpr int kHoldingSpaceColumnSpacing = 8;
constexpr int kHoldingSpaceColumnWidth = 160;
constexpr int kHoldingSpaceContextMenuMargin = 8;
constexpr int kHoldingSpaceCornerRadius = 8;
constexpr int kHoldingSpacePinIconSize = 20;
constexpr int kHoldingSpaceRowSpacing = 8;
......
......@@ -41,9 +41,6 @@ HoldingSpaceItemScreenshotView::HoldingSpaceItemScreenshotView(
views::BoxLayout::Orientation::kHorizontal,
kHoldingSpaceScreenshotPadding));
layout->set_main_axis_alignment(views::BoxLayout::MainAxisAlignment::kEnd);
layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kStart);
AddPin(pin_button_container);
}
......
......@@ -76,12 +76,6 @@ void HoldingSpaceItemViewDelegate::OnHoldingSpaceItemViewDestroyed(
void HoldingSpaceItemViewDelegate::OnHoldingSpaceItemViewGestureEvent(
HoldingSpaceItemView* view,
const ui::GestureEvent& event) {
// When a long press gesture occurs we are going to show the context menu.
// Ensure that the pressed `view` is the only view selected.
if (event.type() == ui::ET_GESTURE_LONG_PRESS) {
SetSelection(view);
return;
}
// When a tap gesture occurs, we select and open only the item corresponding
// to the tapped `view`.
if (event.type() == ui::ET_GESTURE_TAP) {
......@@ -182,19 +176,17 @@ void HoldingSpaceItemViewDelegate::ShowContextMenuForViewImpl(
views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
const int run_types = views::MenuRunner::USE_TOUCHABLE_LAYOUT |
views::MenuRunner::CONTEXT_MENU |
views::MenuRunner::FIXED_ANCHOR;
int run_types = views::MenuRunner::USE_TOUCHABLE_LAYOUT |
views::MenuRunner::CONTEXT_MENU |
views::MenuRunner::FIXED_ANCHOR;
context_menu_runner_ =
std::make_unique<views::MenuRunner>(BuildMenuModel(), run_types);
gfx::Rect bounds = source->GetBoundsInScreen();
bounds.Inset(gfx::Insets(-kHoldingSpaceContextMenuMargin, 0));
context_menu_runner_->RunMenuAt(
source->GetWidget(), nullptr /*button_controller*/, bounds,
views::MenuAnchorPosition::kTopLeft, source_type);
source->GetWidget(), nullptr /*button_controller*/,
source->GetBoundsInScreen(), views::MenuAnchorPosition::kBubbleRight,
source_type);
}
bool HoldingSpaceItemViewDelegate::CanStartDragForView(
......
......@@ -64,16 +64,6 @@ void HoldingSpaceTray::HideBubble(const TrayBubbleView* bubble_view) {
CloseBubble();
}
void HoldingSpaceTray::OnWidgetDragWillStart(views::Widget* widget) {
// The holding space bubble should be closed while dragging holding space
// items so as not to obstruct drop targets. Post the task to close the bubble
// so that we don't attempt to destroy the bubble widget before the associated
// drag event has been fully initialized.
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&HoldingSpaceTray::CloseBubble,
weak_factory_.GetWeakPtr()));
}
void HoldingSpaceTray::OnWidgetDestroying(views::Widget* widget) {
widget->RemoveObserver(this);
CloseBubble();
......
......@@ -49,7 +49,6 @@ class ASH_EXPORT HoldingSpaceTray : public TrayBackgroundView,
void HideBubble(const TrayBubbleView* bubble_view) override;
// views::WidgetObserver:
void OnWidgetDragWillStart(views::Widget* widget) override;
void OnWidgetDestroying(views::Widget* widget) override;
std::unique_ptr<HoldingSpaceTrayBubble> bubble_;
......
......@@ -134,10 +134,7 @@ HoldingSpaceTrayBubble::HoldingSpaceTrayBubble(
HoldingSpaceTrayBubble::~HoldingSpaceTrayBubble() {
bubble_wrapper_->bubble_view()->ResetDelegate();
if (bubble_wrapper_->GetBubbleWidget() &&
!bubble_wrapper_->GetBubbleWidget()->IsClosed()) {
bubble_wrapper_->GetBubbleWidget()->CloseNow();
}
bubble_wrapper_->GetBubbleWidget()->CloseNow();
}
void HoldingSpaceTrayBubble::AnchorUpdated() {
......
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