@@ -262,6 +262,66 @@ void TabDragController::DetachAndAttachToNewContext(
262
262
}
263
263
}
264
264
265
+ gfx::Rect TabDragController::CalculateNonMaximizedDraggedBrowserBounds (
266
+ views::Widget* widget,
267
+ const gfx::Point & point_in_screen) {
268
+ // This method is called when dragging all tabs and moving window.
269
+ auto bounds =
270
+ TabDragControllerChromium::CalculateNonMaximizedDraggedBrowserBounds (
271
+ widget, point_in_screen);
272
+ #if BUILDFLAG(IS_MAC)
273
+ // According to what's been observed, this only needed on Mac. Per platform,
274
+ // window management mechanism is different so this could happen.
275
+ if (is_showing_vertical_tabs_) {
276
+ bounds.Offset (GetVerticalTabStripWidgetOffset ());
277
+ }
278
+ #endif
279
+
280
+ if (is_showing_vertical_tabs_) {
281
+ bounds.set_size (widget->GetTopLevelWidget ()->GetRestoredBounds ().size ());
282
+ }
283
+
284
+ return bounds;
285
+ }
286
+
287
+ gfx::Rect TabDragController::CalculateDraggedBrowserBounds (
288
+ TabDragContext* source,
289
+ const gfx::Point & point_in_screen,
290
+ std::vector<gfx::Rect >* drag_bounds) {
291
+ // This method is called when creating new browser by detaching tabs and
292
+ // when dragging all tabs in maximized window.
293
+ auto bounds = TabDragControllerChromium::CalculateDraggedBrowserBounds (
294
+ source, point_in_screen, drag_bounds);
295
+ if (is_showing_vertical_tabs_) {
296
+ // Revert back coordinate adjustment done by Chromium impl.
297
+ bounds.set_origin (point_in_screen);
298
+
299
+ // Adjust coordinate so that dragged tabs are under cursor.
300
+ DCHECK (!drag_bounds->empty ());
301
+ bounds.Offset (-(mouse_offset_.OffsetFromOrigin ()));
302
+ bounds.Offset ({-drag_bounds->front ().x (), 0 });
303
+ bounds.Offset ({-GetXCoordinateAdjustmentForMultiSelectedTabs (
304
+ attached_views_, source_view_index_),
305
+ 0 });
306
+
307
+ auto * browser_view = static_cast <BraveBrowserView*>(
308
+ BrowserView::GetBrowserViewForNativeWindow (
309
+ GetAttachedBrowserWidget ()->GetNativeWindow ()));
310
+ DCHECK (browser_view);
311
+
312
+ auto * widget_delegate_view =
313
+ browser_view->vertical_tab_strip_widget_delegate_view ();
314
+ DCHECK (widget_delegate_view);
315
+
316
+ bounds.Offset (GetVerticalTabStripWidgetOffset ());
317
+ bounds.Offset (-widget_delegate_view->vertical_tab_strip_region_view ()
318
+ ->GetOffsetForDraggedTab ());
319
+ bounds.set_size (browser_view->GetRestoredBounds ().size ());
320
+ }
321
+
322
+ return bounds;
323
+ }
324
+
265
325
[[nodiscard]] TabDragController::Liveness TabDragController::ContinueDragging (
266
326
const gfx::Point & point_in_screen) {
267
327
auto * browser_widget = GetAttachedBrowserWidget ();
0 commit comments