Commit c6607a2f authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

X11 and Ozone: cleanup views_unittests

There are some USE_X11 guards that I needed to fix.

-----

PS: Please note that this is a temp solution that will help to choose
between ozone and non-ozone X11 build. The switch that will be used
to choose the path is --enable-features=UseOzonePlatform. Once
non-Ozone X11 path is removed (hopefully by Q1 2021 depending on how
the finch trial goes), the wrapper will be removed.

Please also note that it's impossible to build use_x11 && use_ozone
without some hacks in PlatformCursor code. The changes to that are
on their way to upstream.

----

Bug: 1085700
Change-Id: I5562751867d876b0cbf6a4bde7e71daf2395d541
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333842Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Maksim Sisov (GMT+3) <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#794877}
parent 13e803b0
...@@ -74,6 +74,7 @@ jumbo_component("x") { ...@@ -74,6 +74,7 @@ jumbo_component("x") {
"//net", "//net",
"//skia", "//skia",
"//ui/base:data_exchange", "//ui/base:data_exchange",
"//ui/base:features",
"//ui/base:hit_test", "//ui/base:hit_test",
"//ui/base:wm_role_names", "//ui/base:wm_role_names",
"//ui/base/clipboard:clipboard_types", "//ui/base/clipboard:clipboard_types",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "net/base/network_interfaces.h" #include "net/base/network_interfaces.h"
#include "third_party/skia/include/core/SkRegion.h" #include "third_party/skia/include/core/SkRegion.h"
#include "ui/base/hit_test_x11.h" #include "ui/base/hit_test_x11.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/wm_role_names_linux.h" #include "ui/base/wm_role_names_linux.h"
#include "ui/base/x/x11_menu_registrar.h" #include "ui/base/x/x11_menu_registrar.h"
#include "ui/base/x/x11_pointer_grab.h" #include "ui/base/x/x11_pointer_grab.h"
...@@ -216,7 +217,6 @@ void XWindow::Init(const Configuration& config) { ...@@ -216,7 +217,6 @@ void XWindow::Init(const Configuration& config) {
if (!activatable_ || config.override_redirect) if (!activatable_ || config.override_redirect)
req.override_redirect = x11::Bool32(true); req.override_redirect = x11::Bool32(true);
#if !defined(USE_X11)
// It seems like there is a difference how tests are instantiated in case of // It seems like there is a difference how tests are instantiated in case of
// non-Ozone X11 and Ozone. See more details in // non-Ozone X11 and Ozone. See more details in
// EnableTestConfigForPlatformWindows. The reason why this must be here is // EnableTestConfigForPlatformWindows. The reason why this must be here is
...@@ -227,9 +227,8 @@ void XWindow::Init(const Configuration& config) { ...@@ -227,9 +227,8 @@ void XWindow::Init(const Configuration& config) {
// PlatformWindow, and non-Ozone X11 uses it, we have to add this workaround // PlatformWindow, and non-Ozone X11 uses it, we have to add this workaround
// here. Otherwise, tests for non-Ozone X11 fail. // here. Otherwise, tests for non-Ozone X11 fail.
// TODO(msisov): figure out usage of this for non-Ozone X11. // TODO(msisov): figure out usage of this for non-Ozone X11.
if (UseTestConfigForPlatformWindows()) if (features::IsUsingOzonePlatform() && UseTestConfigForPlatformWindows())
req.override_redirect = x11::Bool32(true); req.override_redirect = x11::Bool32(true);
#endif
override_redirect_ = req.override_redirect.has_value(); override_redirect_ = req.override_redirect.has_value();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drop_target_event.h" #include "ui/base/dragdrop/drop_target_event.h"
#include "ui/base/layout.h" #include "ui/base/layout.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/ozone_platform.h"
#include "ui/platform_window/platform_window_delegate.h" #include "ui/platform_window/platform_window_delegate.h"
...@@ -45,14 +46,13 @@ constexpr uint32_t kMinAlpha = 32; ...@@ -45,14 +46,13 @@ constexpr uint32_t kMinAlpha = 32;
bool DragImageIsNeeded() { bool DragImageIsNeeded() {
#if defined(USE_OZONE) #if defined(USE_OZONE)
return !ui::OzonePlatform::GetInstance() if (features::IsUsingOzonePlatform()) {
->GetPlatformProperties() return !ui::OzonePlatform::GetInstance()
.platform_shows_drag_image; ->GetPlatformProperties()
#elif defined(USE_X11) .platform_shows_drag_image;
return true; }
#else
#error "This file must not be compiled out of Ozone or X11."
#endif #endif
return true;
} }
// Returns true if |image| has any visible regions (defined as having a pixel // Returns true if |image| has any visible regions (defined as having a pixel
......
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