Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove the VisibilityNotify event handler Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index c6fc3d741df0f5d11ad26d27bbfb428768bbcb81..adae5b4538c7a2e6bdf9989d6e17cbcfcbd67101 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1752,8 +1752,21 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
previous_bounds_in_pixels_ = bounds_in_pixels_;
bounds_in_pixels_ = bounds_in_pixels;
- if (origin_changed)
+ if (origin_changed) {
OnHostMoved(bounds_in_pixels_.origin());
+ // Allows to trigger visibilityChange events while swithcing between
+ // workspaces.
+ ::Screen* screen = DefaultScreenOfDisplay(xdisplay_);
+ int screen_width = WidthOfScreen(screen);
+ int screen_height = HeightOfScreen(screen);
+
+ if (translated_x_in_pixels < 0 || translated_x_in_pixels > screen_width
+ || translated_y_in_pixels < 0 ||
+ translated_y_in_pixels > screen_height)
+ content_window_->SetPageVisibility(false);
+ else
+ content_window_->SetPageVisibility(true);
+ }
if (size_changed) {
delayed_resize_task_.Reset(base::Bind(

Powered by Google App Engine
This is Rietveld 408576698