Reland "Simplify layout when creating a window during tab dragging."

This is a reland of commit 8f3d075ebf5ff02504a72ac34e0adcc088376881

That CL had a flickering issue on Windows, where new windows would
appear for one frame at the top-left corner of the display before moving
to the correct offset.

The fix is to wait to show the window until its position has been set.

Original change's description:
> Simplify layout when creating a window during tab dragging.
>
> There were several compounding complexities in the old approach:
> - the window and tab bounds calculations were distributed across several
> methods, with unclear responsibilities and interactions
> - the two cases (dragging all tabs in a window, and dragging some tabs
> out into a new window) reused some of these methods, and duplicated
> (with some important differences) other parts of the logic
> - Wayland doesn't support screen coordinates or programmatically
> positioning windows; this required special handling whenever any window
> origin math was done (as that all happens in screen space)
>
> It turns out that a lot of this complexity can just cancel out if you
> arrange things the right way.
>
> This CL does several things:
> - skips calculating the detached window origin (over and over, and
> incrementally nudging the window around). The move loop will reposition
> it for us, so we can just calculate the drag offset once at the end.
> - greatly simplifies the dragging all tabs in a window case, which was
> only complicated because it was reusing too much of the other case
> - clearly defines the responsibilities of, and information flow between,
> the helper methods of DragBrowserToNewTabStrip
> - unifies calculations between Wayland (which doesn't support screen
> coordinates or programmatically positioning windows) and other platforms
> - more strictly separates the calculation of different pieces of
> information (mainly window size/origin and tab sizes/origins)
>
> Bug: 382754501
> Change-Id: Icf0296f81ee0e5b660c0a0bfd21b8e9862722a8f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6160815
> Reviewed-by: Max Ihlenfeldt <max@igalia.com>
> Reviewed-by: David Pennington <dpenning@chromium.org>
> Reviewed-by: Nick Yamane <nickdiego@igalia.com>
> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> Commit-Queue: Taylor Bergquist <tbergquist@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1409303}

Bug: 382754501
Change-Id: Ic988ba017209fe274c19245da58b4955164f196e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6236187
Auto-Submit: Taylor Bergquist <tbergquist@chromium.org>
Reviewed-by: David Pennington <dpenning@chromium.org>
Commit-Queue: Taylor Bergquist <tbergquist@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416475}
2 files changed
tree: a63f4fa774e450f7957948feff3d75bdc7ca8b0e
  1. android_webview/
  2. apps/
  3. ash/
  4. base/
  5. build/
  6. build_overrides/
  7. buildtools/
  8. cc/
  9. chrome/
  10. chromecast/
  11. chromeos/
  12. codelabs/
  13. components/
  14. content/
  15. crypto/
  16. dbus/
  17. device/
  18. docs/
  19. extensions/
  20. fuchsia_web/
  21. gin/
  22. google_apis/
  23. gpu/
  24. headless/
  25. infra/
  26. ios/
  27. ipc/
  28. media/
  29. mojo/
  30. native_client_sdk/
  31. net/
  32. pdf/
  33. ppapi/
  34. printing/
  35. remoting/
  36. rlz/
  37. sandbox/
  38. services/
  39. skia/
  40. sql/
  41. storage/
  42. styleguide/
  43. testing/
  44. third_party/
  45. tools/
  46. ui/
  47. url/
  48. webkit/
  49. .clang-format
  50. .clang-tidy
  51. .clangd
  52. .git-blame-ignore-revs
  53. .gitallowed
  54. .gitattributes
  55. .gitignore
  56. .gitmodules
  57. .gn
  58. .mailmap
  59. .rustfmt.toml
  60. .vpython3
  61. .yapfignore
  62. ATL_OWNERS
  63. AUTHORS
  64. BUILD.gn
  65. CODE_OF_CONDUCT.md
  66. codereview.settings
  67. CPPLINT.cfg
  68. CRYPTO_OWNERS
  69. DEPS
  70. DIR_METADATA
  71. LICENSE
  72. LICENSE.chromium_os
  73. OWNERS
  74. PRESUBMIT.py
  75. PRESUBMIT_test.py
  76. PRESUBMIT_test_mocks.py
  77. README.md
  78. WATCHLISTS
README.md

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure.

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

If you found a bug, please file it at https://crbug.com/new.