diff options
author | Daniel Playfair Cal | 2020-01-12 01:15:04 +1100 |
---|---|---|
committer | Daniel Playfair Cal | 2020-01-12 01:17:55 +1100 |
commit | 849fc03d9e5cf971762a366fcda21b8fba156864 (patch) | |
tree | 44b4fb65c1d3f4d22afcc288accbaa4810ec48a0 /0003-ozone-Wayland-move-bounds-translation-util-to-utilit.patch | |
parent | b26c568927542ce7d5084c654382c51fea251f75 (diff) | |
download | aur-849fc03d9e5cf971762a366fcda21b8fba156864.tar.gz |
80.0.3987.42
Diffstat (limited to '0003-ozone-Wayland-move-bounds-translation-util-to-utilit.patch')
-rw-r--r-- | 0003-ozone-Wayland-move-bounds-translation-util-to-utilit.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/0003-ozone-Wayland-move-bounds-translation-util-to-utilit.patch b/0003-ozone-Wayland-move-bounds-translation-util-to-utilit.patch new file mode 100644 index 000000000000..14d5143a81e3 --- /dev/null +++ b/0003-ozone-Wayland-move-bounds-translation-util-to-utilit.patch @@ -0,0 +1,137 @@ +From d7680c81c95c4609bf4ffbad05656a09d589a382 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov <msisov@igalia.com> +Date: Fri, 6 Dec 2019 19:49:45 +0000 +Subject: [PATCH 3/9] ozone/Wayland: move bounds translation util to utilities. + +Just moving the translation helper method to utilities. + +Bug: 1028919 +Change-Id: I6e60bcdf804e4aaff9cb39d437e4302af2ed3fd2 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1953710 +Commit-Queue: Maksim Sisov <msisov@igalia.com> +Reviewed-by: Michael Spang <spang@chromium.org> +Cr-Commit-Position: refs/heads/master@{#722582} +--- + .../platform/wayland/common/wayland_util.cc | 14 ++++++++++ + .../platform/wayland/common/wayland_util.h | 8 ++++++ + .../platform/wayland/host/wayland_window.cc | 27 +++---------------- + 3 files changed, 26 insertions(+), 23 deletions(-) + +diff --git a/ui/ozone/platform/wayland/common/wayland_util.cc b/ui/ozone/platform/wayland/common/wayland_util.cc +index 0201f689e90d..e0430b860adf 100644 +--- a/ui/ozone/platform/wayland/common/wayland_util.cc ++++ b/ui/ozone/platform/wayland/common/wayland_util.cc +@@ -141,4 +141,18 @@ void ReadDataFromFD(base::ScopedFD fd, std::vector<uint8_t>* contents) { + contents->insert(contents->end(), buffer, buffer + length); + } + ++gfx::Rect TranslateBoundsToParentCoordinates(const gfx::Rect& child_bounds, ++ const gfx::Rect& parent_bounds) { ++ return gfx::Rect( ++ (child_bounds.origin() - parent_bounds.origin().OffsetFromOrigin()), ++ child_bounds.size()); ++} ++ ++gfx::Rect TranslateBoundsToTopLevelCoordinates(const gfx::Rect& child_bounds, ++ const gfx::Rect& parent_bounds) { ++ return gfx::Rect( ++ (child_bounds.origin() + parent_bounds.origin().OffsetFromOrigin()), ++ child_bounds.size()); ++} ++ + } // namespace wl +diff --git a/ui/ozone/platform/wayland/common/wayland_util.h b/ui/ozone/platform/wayland/common/wayland_util.h +index 368f3d9a9427..48332e059da0 100644 +--- a/ui/ozone/platform/wayland/common/wayland_util.h ++++ b/ui/ozone/platform/wayland/common/wayland_util.h +@@ -13,6 +13,7 @@ + #include "base/containers/flat_map.h" + #include "base/files/scoped_file.h" + #include "base/macros.h" ++#include "ui/gfx/geometry/rect.h" + #include "ui/ozone/platform/wayland/common/wayland_object.h" + + class SkBitmap; +@@ -50,6 +51,13 @@ bool DrawBitmap(const SkBitmap& bitmap, ui::WaylandShmBuffer* out_buffer); + // Helper function to read data from a file. + void ReadDataFromFD(base::ScopedFD fd, std::vector<uint8_t>* contents); + ++// Translates bounds relative to top level window to specified parent. ++gfx::Rect TranslateBoundsToParentCoordinates(const gfx::Rect& child_bounds, ++ const gfx::Rect& parent_bounds); ++// Translates bounds relative to parent window to top level window. ++gfx::Rect TranslateBoundsToTopLevelCoordinates(const gfx::Rect& child_bounds, ++ const gfx::Rect& parent_bounds); ++ + } // namespace wl + + #endif // UI_OZONE_PLATFORM_WAYLAND_COMMON_WAYLAND_UTIL_H_ +diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc +index da9a4cb368b8..709fb681f7d9 100644 +--- a/ui/ozone/platform/wayland/host/wayland_window.cc ++++ b/ui/ozone/platform/wayland/host/wayland_window.cc +@@ -16,6 +16,7 @@ + #include "ui/events/event_utils.h" + #include "ui/events/ozone/events_ozone.h" + #include "ui/gfx/geometry/point_f.h" ++#include "ui/ozone/platform/wayland/common/wayland_util.h" + #include "ui/ozone/platform/wayland/host/shell_object_factory.h" + #include "ui/ozone/platform/wayland/host/shell_popup_wrapper.h" + #include "ui/ozone/platform/wayland/host/shell_surface_wrapper.h" +@@ -28,26 +29,6 @@ + + namespace ui { + +-namespace { +- +-// Translates bounds relative to top level window to specified parent. +-gfx::Rect TranslateBoundsToParentCoordinates(const gfx::Rect& child_bounds, +- const gfx::Rect& parent_bounds) { +- return gfx::Rect(gfx::Point(child_bounds.x() - parent_bounds.x(), +- child_bounds.y() - parent_bounds.y()), +- child_bounds.size()); +-} +- +-// Translates bounds relative to parent window to top level window. +-gfx::Rect TranslateBoundsToTopLevelCoordinates(const gfx::Rect& child_bounds, +- const gfx::Rect& parent_bounds) { +- return gfx::Rect(gfx::Point(child_bounds.x() + parent_bounds.x(), +- child_bounds.y() + parent_bounds.y()), +- child_bounds.size()); +-} +- +-} // namespace +- + WaylandWindow::WaylandWindow(PlatformWindowDelegate* delegate, + WaylandConnection* connection) + : delegate_(delegate), +@@ -177,7 +158,7 @@ void WaylandWindow::CreateAndShowTooltipSubSurface() { + const auto parent_bounds_dip = + gfx::ScaleToRoundedRect(parent_window->GetBounds(), 1.0 / ui_scale_); + auto new_bounds_dip = +- TranslateBoundsToParentCoordinates(bounds_px_, parent_bounds_dip); ++ wl::TranslateBoundsToParentCoordinates(bounds_px_, parent_bounds_dip); + auto bounds_px = + gfx::ScaleToRoundedRect(new_bounds_dip, ui_scale_ / buffer_scale_); + +@@ -671,7 +652,7 @@ void WaylandWindow::HandlePopupConfigure(const gfx::Rect& bounds_dip) { + // window, which automatically becomes the same as relative to an origin of + // a display. + new_bounds_dip = gfx::ScaleToRoundedRect( +- TranslateBoundsToTopLevelCoordinates( ++ wl::TranslateBoundsToTopLevelCoordinates( + gfx::ScaleToRoundedRect(new_bounds_dip, buffer_scale_), + parent_window_->GetBounds()), + 1.0 / buffer_scale_); +@@ -962,7 +943,7 @@ gfx::Rect WaylandWindow::AdjustPopupWindowPosition() const { + const gfx::Rect parent_bounds_dip = + gfx::ScaleToRoundedRect(parent_window_->GetBounds(), 1.0 / ui_scale_); + gfx::Rect new_bounds_dip = +- TranslateBoundsToParentCoordinates(bounds_px_, parent_bounds_dip); ++ wl::TranslateBoundsToParentCoordinates(bounds_px_, parent_bounds_dip); + + // Chromium may decide to position nested menu windows on the left side + // instead of the right side of parent menu windows when the size of the +-- +2.24.1 + |