Commit 016b8002 authored by Connie Wan's avatar Connie Wan Committed by Commit Bot

Fix regression in tab dragging

Introduced here: https://chromium-review.googlesource.com/c/chromium/src/+/1866058/16/chrome/browser/ui/views/tabs/tab_strip.cc#683

Not sure how to regression test this given that it's a visual/animation issue. Suggestions welcome!

Bug: 1021582
Change-Id: Ie57d4b767b84e6b3a975841538e1eb54e1037d66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900206
Commit-Queue: Connie Wan <connily@chromium.org>
Reviewed-by: default avatarCharlene Yan <cyan@chromium.org>
Reviewed-by: default avatarTaylor Bergquist <tbergquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712842}
parent 4780268b
...@@ -680,9 +680,6 @@ class TabStrip::TabDragContextImpl : public TabDragContext { ...@@ -680,9 +680,6 @@ class TabStrip::TabDragContextImpl : public TabDragContext {
// Let the controller know that the user stopped dragging tabs. // Let the controller know that the user stopped dragging tabs.
tab_strip_->controller_->OnStoppedDragging(); tab_strip_->controller_->OnStoppedDragging();
for (size_t i = 0; i < views.size(); ++i)
views[i]->set_dragging(false);
SetNewTabButtonVisible(true); SetNewTabButtonVisible(true);
if (move_only && tab_strip_->touch_layout_) { if (move_only && tab_strip_->touch_layout_) {
if (completed) if (completed)
...@@ -2641,6 +2638,14 @@ void TabStrip::OnGroupCloseAnimationCompleted(TabGroupId group) { ...@@ -2641,6 +2638,14 @@ void TabStrip::OnGroupCloseAnimationCompleted(TabGroupId group) {
void TabStrip::StoppedDraggingView(TabSlotView* view, bool* is_first_view) { void TabStrip::StoppedDraggingView(TabSlotView* view, bool* is_first_view) {
int tab_data_index = GetModelIndexOf(view); int tab_data_index = GetModelIndexOf(view);
if (tab_data_index == -1) { if (tab_data_index == -1) {
// Ensure the drag status is updated even if the view is not a valid tab.
// This is primarily to make sure group headers are updated correctly.
// Otherwise, tab drag status is only updated in PrepareForAnimation().
// TODO(crbug.com/1021689): Incorporate group headers in the normal
// animation flow instead of handling it here and then ignoring it.
if (view)
view->set_dragging(false);
// The tab was removed before the drag completed. Don't do anything. // The tab was removed before the drag completed. Don't do anything.
return; return;
} }
......
...@@ -481,8 +481,8 @@ class TabStrip : public views::AccessiblePaneView, ...@@ -481,8 +481,8 @@ class TabStrip : public views::AccessiblePaneView,
// from the tab animation code and is not a general-purpose method. // from the tab animation code and is not a general-purpose method.
void OnGroupCloseAnimationCompleted(TabGroupId group); void OnGroupCloseAnimationCompleted(TabGroupId group);
// Invoked from StoppedDraggingTabs to cleanup |tab|. If |tab| is known // Invoked from StoppedDraggingTabs to cleanup |view|. If |view| is known
// |is_first_tab| is set to true. // |is_first_view| is set to true.
void StoppedDraggingView(TabSlotView* view, bool* is_first_view); void StoppedDraggingView(TabSlotView* view, bool* is_first_view);
// Invoked when a mouse event occurs over |source|. Potentially switches the // Invoked when a mouse event occurs over |source|. Potentially switches the
......
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