summaryrefslogtreecommitdiff
path: root/chromium/ui/aura
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-09-01 11:08:40 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-01 12:16:21 +0000
commit03c549e0392f92c02536d3f86d5e1d8dfa3435ac (patch)
treefe49d170a929b34ba82cd10db1a0bd8e3760fa4b /chromium/ui/aura
parent5d013f5804a0d91fcf6c626b2d6fb6eca5c845b0 (diff)
downloadqtwebengine-chromium-03c549e0392f92c02536d3f86d5e1d8dfa3435ac.tar.gz
BASELINE: Update Chromium to 91.0.4472.160
Change-Id: I0def1f08a2412aeed79a9ab95dd50eb5c3f65f31 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/aura')
-rw-r--r--chromium/ui/aura/BUILD.gn6
-rw-r--r--chromium/ui/aura/client/aura_constants.cc4
-rw-r--r--chromium/ui/aura/client/aura_constants.h3
-rw-r--r--chromium/ui/aura/client/cursor_client.h3
-rw-r--r--chromium/ui/aura/client/drag_drop_client_observer.h16
-rw-r--r--chromium/ui/aura/env.cc9
-rw-r--r--chromium/ui/aura/env_observer.h5
-rw-r--r--chromium/ui/aura/native_window_occlusion_tracker_win.cc29
-rw-r--r--chromium/ui/aura/native_window_occlusion_tracker_win.h3
-rw-r--r--chromium/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc32
-rw-r--r--chromium/ui/aura/screen_ozone.h3
-rw-r--r--chromium/ui/aura/test/ui_controls_ozone.cc10
-rw-r--r--chromium/ui/aura/window.cc6
-rw-r--r--chromium/ui/aura/window.h5
-rw-r--r--chromium/ui/aura/window_observer.h3
-rw-r--r--chromium/ui/aura/window_tree_host_platform.cc4
-rw-r--r--chromium/ui/aura/window_tree_host_platform.h2
17 files changed, 104 insertions, 39 deletions
diff --git a/chromium/ui/aura/BUILD.gn b/chromium/ui/aura/BUILD.gn
index 22d0ec9dd4d..f638d50067f 100644
--- a/chromium/ui/aura/BUILD.gn
+++ b/chromium/ui/aura/BUILD.gn
@@ -134,6 +134,7 @@ component("aura") {
public_deps = [
"//ui/base/cursor:cursor_base",
+ "//ui/base/dragdrop:types",
"//ui/base/dragdrop/mojom:mojom_headers",
"//ui/base/ime",
"//ui/compositor",
@@ -374,6 +375,11 @@ test("aura_unittests") {
deps += [ "//ui/ozone" ]
}
+ if (is_fuchsia) {
+ additional_manifest_fragments =
+ [ "//build/config/fuchsia/test/present_view_capabilities.test-cmx" ]
+ }
+
data_deps = [ "//third_party/mesa_headers" ]
}
diff --git a/chromium/ui/aura/client/aura_constants.cc b/chromium/ui/aura/client/aura_constants.cc
index ac740522a77..e1d88b353f8 100644
--- a/chromium/ui/aura/client/aura_constants.cc
+++ b/chromium/ui/aura/client/aura_constants.cc
@@ -10,7 +10,7 @@
DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, bool)
DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, base::TimeDelta)
DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, base::UnguessableToken*)
-DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, base::string16*)
+DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, std::u16string*)
DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, ui::ModalType)
DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, ui::ZOrderLevel)
DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, gfx::ImageSkia*)
@@ -70,7 +70,7 @@ DEFINE_UI_CLASS_PROPERTY_KEY(ui::WindowShowState,
kShowStateKey,
ui::SHOW_STATE_DEFAULT)
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSkipImeProcessing, false)
-DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(base::string16, kTitleKey, nullptr)
+DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::u16string, kTitleKey, nullptr)
DEFINE_UI_CLASS_PROPERTY_KEY(int, kTopViewInset, 0)
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kVisibleOnAllWorkspacesKey, false)
DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(gfx::ImageSkia, kWindowIconKey, nullptr)
diff --git a/chromium/ui/aura/client/aura_constants.h b/chromium/ui/aura/client/aura_constants.h
index ac15d1b3519..c81a0263bee 100644
--- a/chromium/ui/aura/client/aura_constants.h
+++ b/chromium/ui/aura/client/aura_constants.h
@@ -8,7 +8,6 @@
#include <string>
#include <vector>
-#include "base/strings/string16.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/aura_export.h"
#include "ui/aura/window.h"
@@ -140,7 +139,7 @@ AURA_EXPORT extern const WindowProperty<ui::WindowShowState>* const
AURA_EXPORT extern const WindowProperty<bool>* const kSkipImeProcessing;
// A property key to store the title of the window; sometimes shown to users.
-AURA_EXPORT extern const WindowProperty<base::string16*>* const kTitleKey;
+AURA_EXPORT extern const WindowProperty<std::u16string*>* const kTitleKey;
// The inset of the topmost view in the client view from the top of the
// non-client view. The topmost view depends on the window type. The topmost
diff --git a/chromium/ui/aura/client/cursor_client.h b/chromium/ui/aura/client/cursor_client.h
index 076ec1ab8bb..a39aeff5870 100644
--- a/chromium/ui/aura/client/cursor_client.h
+++ b/chromium/ui/aura/client/cursor_client.h
@@ -5,7 +5,8 @@
#ifndef UI_AURA_CLIENT_CURSOR_CLIENT_H_
#define UI_AURA_CLIENT_CURSOR_CLIENT_H_
-#include "base/strings/string16.h"
+#include <string>
+
#include "ui/aura/aura_export.h"
#include "ui/base/cursor/cursor.h"
#include "ui/gfx/native_widget_types.h"
diff --git a/chromium/ui/aura/client/drag_drop_client_observer.h b/chromium/ui/aura/client/drag_drop_client_observer.h
index f668f77cb86..1f353d794ae 100644
--- a/chromium/ui/aura/client/drag_drop_client_observer.h
+++ b/chromium/ui/aura/client/drag_drop_client_observer.h
@@ -8,16 +8,25 @@
#include "build/chromeos_buildflags.h"
#include "ui/aura/aura_export.h"
+namespace ui {
+class DropTargetEvent;
+} // namespace ui
+
namespace aura {
namespace client {
class AURA_EXPORT DragDropClientObserver {
public:
+ virtual ~DragDropClientObserver() = default;
+
// Called when dragging started.
- virtual void OnDragStarted() = 0;
+ virtual void OnDragStarted() {}
+
+ // Called when dragging is updated.
+ virtual void OnDragUpdated(const ui::DropTargetEvent& event) {}
// Called when dragging ended.
- virtual void OnDragEnded() = 0;
+ virtual void OnDragEnded() {}
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Called when the set of currently selected drag operation changes during the
@@ -26,9 +35,6 @@ class AURA_EXPORT DragDropClientObserver {
// the operation returned from StartDragAndDrop.
virtual void OnDragActionsChanged(int actions) {}
#endif
-
- protected:
- virtual ~DragDropClientObserver() = default;
};
} // namespace client
diff --git a/chromium/ui/aura/env.cc b/chromium/ui/aura/env.cc
index 1aa181ecd8d..043a669ebea 100644
--- a/chromium/ui/aura/env.cc
+++ b/chromium/ui/aura/env.cc
@@ -165,20 +165,11 @@ WindowOcclusionTracker* Env::GetWindowOcclusionTracker() {
}
void Env::PauseWindowOcclusionTracking() {
- const bool was_paused = GetWindowOcclusionTracker();
GetWindowOcclusionTracker()->Pause();
- if (!was_paused) {
- for (EnvObserver& observer : observers_)
- observer.OnWindowOcclusionTrackingPaused();
- }
}
void Env::UnpauseWindowOcclusionTracking() {
GetWindowOcclusionTracker()->Unpause();
- if (!GetWindowOcclusionTracker()->IsPaused()) {
- for (EnvObserver& observer : observers_)
- observer.OnWindowOcclusionTrackingResumed();
- }
}
void Env::AddEventObserver(ui::EventObserver* observer,
diff --git a/chromium/ui/aura/env_observer.h b/chromium/ui/aura/env_observer.h
index e9a3e7870aa..5d571fd6952 100644
--- a/chromium/ui/aura/env_observer.h
+++ b/chromium/ui/aura/env_observer.h
@@ -26,11 +26,6 @@ class AURA_EXPORT EnvObserver {
// Called right before Env is destroyed.
virtual void OnWillDestroyEnv() {}
- // Called when occlusion tracker pauses/resumes. This is only called in
- // Mode::LOCAL.
- virtual void OnWindowOcclusionTrackingPaused() {}
- virtual void OnWindowOcclusionTrackingResumed() {}
-
protected:
virtual ~EnvObserver() {}
};
diff --git a/chromium/ui/aura/native_window_occlusion_tracker_win.cc b/chromium/ui/aura/native_window_occlusion_tracker_win.cc
index ac50a5b093f..57f85d3699f 100644
--- a/chromium/ui/aura/native_window_occlusion_tracker_win.cc
+++ b/chromium/ui/aura/native_window_occlusion_tracker_win.cc
@@ -22,7 +22,9 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/windows_version.h"
+#include "ui/aura/window_occlusion_tracker.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/base/ui_base_features.h"
#include "ui/gfx/win/hwnd_util.h"
namespace aura {
@@ -243,6 +245,9 @@ void NativeWindowOcclusionTrackerWin::UpdateOcclusionState(
const base::flat_map<HWND, Window::OcclusionState>&
root_window_hwnds_occlusion_state,
bool show_all_windows) {
+ // Pause occlusion until we've updated all root windows, to avoid O(n^3)
+ // calls to recompute occlusion in WindowOcclusionTracker.
+ WindowOcclusionTracker::ScopedPause pause_occlusion_tracking;
num_visible_root_windows_ = 0;
for (const auto& root_window_pair : root_window_hwnds_occlusion_state) {
auto it = hwnd_root_window_map_.find(root_window_pair.first);
@@ -287,14 +292,28 @@ void NativeWindowOcclusionTrackerWin::OnSessionChange(
}
void NativeWindowOcclusionTrackerWin::OnDisplayStateChanged(bool display_on) {
+ static bool screen_power_listener_enabled = base::FeatureList::IsEnabled(
+ features::kScreenPowerListenerForNativeWinOcclusion);
+ if (!screen_power_listener_enabled)
+ return;
+
if (display_on == display_on_)
return;
display_on_ = display_on;
- // Display changing to on will cause a foreground window change,
- // which will trigger an occlusion calculation on its own.
- if (!display_on_)
+ if (display_on_) {
+ // Notify the window occlusion calculator of the display turning on
+ // which will schedule an occlusion calculation. This must be run
+ // on the WindowOcclusionCalculator thread.
+ update_occlusion_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &WindowOcclusionCalculator::HandleVisibilityChanged,
+ base::Unretained(WindowOcclusionCalculator::GetInstance()),
+ /*visible=*/true));
+ } else {
MarkNonIconicWindowsOccluded();
+ }
}
void NativeWindowOcclusionTrackerWin::MarkNonIconicWindowsOccluded() {
@@ -700,8 +719,8 @@ void NativeWindowOcclusionTrackerWin::WindowOcclusionCalculator::
FROM_HERE, base::BindOnce(update_occlusion_state_callback_,
root_window_hwnds_occlusion_state_,
showing_thumbnails_));
- return;
}
+ return;
} else if (event == EVENT_OBJECT_HIDE) {
// Avoid getting the hwnd's class name, and recomputing occlusion, if not
// needed.
@@ -714,6 +733,8 @@ void NativeWindowOcclusionTrackerWin::WindowOcclusionCalculator::
// Let occlusion calculation fix occlusion state, even though hwnd might
// be a popup window.
calculate_occlusion = true;
+ } else {
+ return;
}
}
// Don't continually calculate occlusion while a window is moving (unless it's
diff --git a/chromium/ui/aura/native_window_occlusion_tracker_win.h b/chromium/ui/aura/native_window_occlusion_tracker_win.h
index 4934e8b3175..b1a44a9989b 100644
--- a/chromium/ui/aura/native_window_occlusion_tracker_win.h
+++ b/chromium/ui/aura/native_window_occlusion_tracker_win.h
@@ -63,7 +63,8 @@ class AURA_EXPORT NativeWindowOcclusionTrackerWin
private:
friend class NativeWindowOcclusionTrackerTest;
-
+ FRIEND_TEST_ALL_PREFIXES(NativeWindowOcclusionTrackerTest,
+ DisplayOnOffHandling);
// This class computes the occlusion state of the tracked windows.
// It runs on a separate thread, and notifies the main thread of
// the occlusion state of the tracked windows.
diff --git a/chromium/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc b/chromium/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc
index 197f1961555..f86003a2970 100644
--- a/chromium/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc
+++ b/chromium/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc
@@ -400,4 +400,36 @@ TEST_F(NativeWindowOcclusionTrackerTest, LockScreenDifferentSession) {
host()->RemoveObserver(&observer);
}
+// Test that display off & on power state notification causes visible windows to
+// become occluded, then visible.
+TEST_F(NativeWindowOcclusionTrackerTest, DisplayOnOffHandling) {
+ base::RunLoop run_loop;
+
+ MockWindowTreeHostObserver observer(run_loop.QuitClosure());
+ CreateTrackedAuraWindowWithBounds(&observer, gfx::Rect(0, 0, 100, 100));
+ observer.set_expectation(Window::OcclusionState::VISIBLE);
+ run_loop.Run();
+ EXPECT_FALSE(observer.is_expecting_call());
+
+ NativeWindowOcclusionTrackerWin* occlusion_tracker =
+ NativeWindowOcclusionTrackerWin::GetOrCreateInstance();
+
+ observer.set_expectation(Window::OcclusionState::OCCLUDED);
+ base::RunLoop run_loop2;
+ observer.set_quit_closure(run_loop2.QuitClosure());
+
+ // Turning display off and on isn't feasible, so send a notification.
+ occlusion_tracker->OnDisplayStateChanged(/*display_on=*/false);
+ run_loop2.Run();
+ EXPECT_FALSE(observer.is_expecting_call());
+
+ observer.set_expectation(Window::OcclusionState::VISIBLE);
+ base::RunLoop run_loop3;
+ observer.set_quit_closure(run_loop3.QuitClosure());
+ occlusion_tracker->OnDisplayStateChanged(/*display_on=*/true);
+ run_loop3.Run();
+ EXPECT_FALSE(observer.is_expecting_call());
+ host()->RemoveObserver(&observer);
+}
+
} // namespace aura
diff --git a/chromium/ui/aura/screen_ozone.h b/chromium/ui/aura/screen_ozone.h
index f92c14f5667..b989f378a23 100644
--- a/chromium/ui/aura/screen_ozone.h
+++ b/chromium/ui/aura/screen_ozone.h
@@ -54,6 +54,9 @@ class AURA_EXPORT ScreenOzone : public display::Screen {
virtual gfx::NativeWindow GetNativeWindowFromAcceleratedWidget(
gfx::AcceleratedWidget widget) const;
+ protected:
+ ui::PlatformScreen* platform_screen() { return platform_screen_.get(); }
+
private:
gfx::AcceleratedWidget GetAcceleratedWidgetForWindow(
aura::Window* window) const;
diff --git a/chromium/ui/aura/test/ui_controls_ozone.cc b/chromium/ui/aura/test/ui_controls_ozone.cc
index 2572a3c2f14..965b6abfa88 100644
--- a/chromium/ui/aura/test/ui_controls_ozone.cc
+++ b/chromium/ui/aura/test/ui_controls_ozone.cc
@@ -6,6 +6,7 @@
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "ui/events/event_utils.h"
namespace aura {
namespace test {
@@ -275,6 +276,15 @@ void UIControlsOzone::PostKeyEventTask(ui::EventType type,
flags |= ui::EF_FINAL;
ui::KeyEvent key_event(type, key_code, flags);
+ if (type == ui::ET_KEY_PRESSED) {
+ // Set a property as if this is a key event not consumed by IME.
+ // Ozone/X11+GTK IME works so already. Ozone/wayland IME relies on this
+ // flag to work properly.
+ key_event.SetProperties({{
+ ui::kPropertyKeyboardImeFlag,
+ std::vector<uint8_t>{ui::kPropertyKeyboardImeIgnoredFlag},
+ }});
+ }
SendEventToSink(&key_event, display_id, std::move(closure), optional_host);
}
diff --git a/chromium/ui/aura/window.cc b/chromium/ui/aura/window.cc
index 283092e62f2..303a0290b53 100644
--- a/chromium/ui/aura/window.cc
+++ b/chromium/ui/aura/window.cc
@@ -217,12 +217,12 @@ void Window::SetName(const std::string& name) {
UpdateLayerName();
}
-const base::string16& Window::GetTitle() const {
- base::string16* title = GetProperty(client::kTitleKey);
+const std::u16string& Window::GetTitle() const {
+ std::u16string* title = GetProperty(client::kTitleKey);
return title ? *title : base::EmptyString16();
}
-void Window::SetTitle(const base::string16& title) {
+void Window::SetTitle(const std::u16string& title) {
if (title == GetTitle())
return;
SetProperty(client::kTitleKey, title);
diff --git a/chromium/ui/aura/window.h b/chromium/ui/aura/window.h
index b422c18d087..d3034469851 100644
--- a/chromium/ui/aura/window.h
+++ b/chromium/ui/aura/window.h
@@ -20,7 +20,6 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/optional.h"
-#include "base/strings/string16.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/viz/common/surfaces/frame_sink_id.h"
@@ -173,8 +172,8 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
const std::string& GetName() const;
void SetName(const std::string& name);
- const base::string16& GetTitle() const;
- void SetTitle(const base::string16& title);
+ const std::u16string& GetTitle() const;
+ void SetTitle(const std::u16string& title);
bool transparent() const { return transparent_; }
diff --git a/chromium/ui/aura/window_observer.h b/chromium/ui/aura/window_observer.h
index 4c34dbe7a12..c2ce7a6d141 100644
--- a/chromium/ui/aura/window_observer.h
+++ b/chromium/ui/aura/window_observer.h
@@ -5,8 +5,9 @@
#ifndef UI_AURA_WINDOW_OBSERVER_H_
#define UI_AURA_WINDOW_OBSERVER_H_
+#include <string>
+
#include "base/observer_list_types.h"
-#include "base/strings/string16.h"
#include "ui/aura/aura_export.h"
#include "ui/compositor/property_change_reason.h"
diff --git a/chromium/ui/aura/window_tree_host_platform.cc b/chromium/ui/aura/window_tree_host_platform.cc
index 7589542026f..6025626d122 100644
--- a/chromium/ui/aura/window_tree_host_platform.cc
+++ b/chromium/ui/aura/window_tree_host_platform.cc
@@ -202,7 +202,7 @@ void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) {
NOTIMPLEMENTED();
}
-void WindowTreeHostPlatform::OnBoundsChanged(const gfx::Rect& new_bounds) {
+void WindowTreeHostPlatform::OnBoundsChanged(const BoundsChange& change) {
// It's possible this function may be called recursively. Only notify
// observers on initial entry. This way observers can safely assume that
// OnHostDidProcessBoundsChange() is called when all bounds changes have
@@ -215,7 +215,7 @@ void WindowTreeHostPlatform::OnBoundsChanged(const gfx::Rect& new_bounds) {
float new_scale = ui::GetScaleFactorForNativeView(window());
gfx::Rect old_bounds = bounds_in_pixels_;
auto weak_ref = GetWeakPtr();
- bounds_in_pixels_ = new_bounds;
+ bounds_in_pixels_ = change.bounds;
if (bounds_in_pixels_.origin() != old_bounds.origin()) {
OnHostMovedInPixels(bounds_in_pixels_.origin());
// Changing the bounds may destroy this.
diff --git a/chromium/ui/aura/window_tree_host_platform.h b/chromium/ui/aura/window_tree_host_platform.h
index 27d7d78a34a..60d5129bdb9 100644
--- a/chromium/ui/aura/window_tree_host_platform.h
+++ b/chromium/ui/aura/window_tree_host_platform.h
@@ -66,7 +66,7 @@ class AURA_EXPORT WindowTreeHostPlatform : public WindowTreeHost,
void SetPlatformWindow(std::unique_ptr<ui::PlatformWindow> window);
// ui::PlatformWindowDelegate:
- void OnBoundsChanged(const gfx::Rect& new_bounds) override;
+ void OnBoundsChanged(const BoundsChange& change) override;
void OnDamageRect(const gfx::Rect& damaged_region) override;
void DispatchEvent(ui::Event* event) override;
void OnCloseRequest() override;