summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 00:24:48 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 00:24:48 +0000
commit53a8bf975a88a6461e771c1c5bc1dec9037985c2 (patch)
tree552a2598941aa0690bf4c0fe42e9e68fc2226f0e
parentf38235957dc10552c3fee5b79972715fa32e6db1 (diff)
downloadchromium_src-53a8bf975a88a6461e771c1c5bc1dec9037985c2.zip
chromium_src-53a8bf975a88a6461e771c1c5bc1dec9037985c2.tar.gz
chromium_src-53a8bf975a88a6461e771c1c5bc1dec9037985c2.tar.bz2
Reenable PanelViewTest.CheckTitleOnlyHeight and PanelViewTest.CheckMinimizedHeight
The panel's minimum size depends on whether the panel is minimized. This CL ensures that when a panel is minimized, the X window's minimum size is first updated, then the X window's bounds are updated (to be smaller than the non-minimized panel minimum size allows) BUG=382301 TEST=PanelViewTest.* R=erg TBR=dimich (For reenabling tests in panel_view_browsertest.cc) Review URL: https://codereview.chromium.org/363483002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283945 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/panels/panel_view_browsertest.cc4
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc2
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.h2
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host.h2
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc2
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host_win.h2
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc73
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h12
-rw-r--r--ui/views/widget/native_widget_aura.cc2
-rw-r--r--ui/views/widget/native_widget_aura.h2
-rw-r--r--ui/views/widget/native_widget_private.h2
11 files changed, 65 insertions, 40 deletions
diff --git a/chrome/browser/ui/views/panels/panel_view_browsertest.cc b/chrome/browser/ui/views/panels/panel_view_browsertest.cc
index 598ab58..9e6dba6 100644
--- a/chrome/browser/ui/views/panels/panel_view_browsertest.cc
+++ b/chrome/browser/ui/views/panels/panel_view_browsertest.cc
@@ -135,9 +135,6 @@ IN_PROC_BROWSER_TEST_F(PanelViewTest, PanelLayout) {
EXPECT_LT(minimize_button->x() + minimize_button->width(), close_button->x());
}
-// TODO(pkotwicz): Enable on Linux crbug.com/382301
-#if !defined(OS_LINUX)
-
IN_PROC_BROWSER_TEST_F(PanelViewTest, CheckTitleOnlyHeight) {
gfx::Rect bounds(0, 0, 200, 50);
Panel* panel = CreatePanelWithBounds("PanelTest", bounds);
@@ -163,4 +160,3 @@ IN_PROC_BROWSER_TEST_F(PanelViewTest, CheckMinimizedHeight) {
panel->Close();
}
-#endif
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 60458c7..305193d 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -927,7 +927,7 @@ ui::NativeTheme* DesktopNativeWidgetAura::GetNativeTheme() const {
return DesktopWindowTreeHost::GetNativeTheme(content_window_);
}
-void DesktopNativeWidgetAura::OnRootViewLayout() const {
+void DesktopNativeWidgetAura::OnRootViewLayout() {
if (content_window_)
desktop_window_tree_host_->OnRootViewLayout();
}
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index f265814..77db652 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -177,7 +177,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void EndMoveLoop() OVERRIDE;
virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE;
virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE;
- virtual void OnRootViewLayout() const OVERRIDE;
+ virtual void OnRootViewLayout() OVERRIDE;
virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE;
// Overridden from aura::WindowDelegate:
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host.h b/ui/views/widget/desktop_aura/desktop_window_tree_host.h
index 26925b67..ad6fdbf 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host.h
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host.h
@@ -143,7 +143,7 @@ class VIEWS_EXPORT DesktopWindowTreeHost {
virtual void FlashFrame(bool flash_frame) = 0;
- virtual void OnRootViewLayout() const = 0;
+ virtual void OnRootViewLayout() = 0;
// Called when the DesktopNativeWidgetAura's aura::Window is focused and
// blurred.
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index c879792..11717d3 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -413,7 +413,7 @@ void DesktopWindowTreeHostWin::FlashFrame(bool flash_frame) {
message_handler_->FlashFrame(flash_frame);
}
-void DesktopWindowTreeHostWin::OnRootViewLayout() const {
+void DesktopWindowTreeHostWin::OnRootViewLayout() {
}
void DesktopWindowTreeHostWin::OnNativeWidgetFocus() {
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index aa70b37..ac10b7a 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -99,7 +99,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
const gfx::ImageSkia& app_icon) OVERRIDE;
virtual void InitModalType(ui::ModalType modal_type) OVERRIDE;
virtual void FlashFrame(bool flash_frame) OVERRIDE;
- virtual void OnRootViewLayout() const OVERRIDE;
+ virtual void OnRootViewLayout() OVERRIDE;
virtual void OnNativeWidgetFocus() OVERRIDE;
virtual void OnNativeWidgetBlur() OVERRIDE;
virtual bool IsAnimatingClosed() const OVERRIDE;
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 005f346..939defd 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
@@ -788,33 +788,8 @@ void DesktopWindowTreeHostX11::FlashFrame(bool flash_frame) {
urgency_hint_set_ = flash_frame;
}
-void DesktopWindowTreeHostX11::OnRootViewLayout() const {
- if (!window_mapped_)
- return;
-
- XSizeHints hints;
- long supplied_return;
- XGetWMNormalHints(xdisplay_, xwindow_, &hints, &supplied_return);
-
- gfx::Size minimum = native_widget_delegate_->GetMinimumSize();
- if (minimum.IsEmpty()) {
- hints.flags &= ~PMinSize;
- } else {
- hints.flags |= PMinSize;
- hints.min_width = minimum.width();
- hints.min_height = minimum.height();
- }
-
- gfx::Size maximum = native_widget_delegate_->GetMaximumSize();
- if (maximum.IsEmpty()) {
- hints.flags &= ~PMaxSize;
- } else {
- hints.flags |= PMaxSize;
- hints.max_width = maximum.width();
- hints.max_height = maximum.height();
- }
-
- XSetWMNormalHints(xdisplay_, xwindow_, &hints);
+void DesktopWindowTreeHostX11::OnRootViewLayout() {
+ UpdateMinAndMaxSize();
}
void DesktopWindowTreeHostX11::OnNativeWidgetFocus() {
@@ -869,6 +844,15 @@ void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) {
DCHECK_GT(bounds.width(), 0);
DCHECK_GT(bounds.height(), 0);
+ if (bounds.width() < min_size_.width() ||
+ bounds.height() < min_size_.height() ||
+ (!max_size_.IsEmpty() &&
+ (bounds.width() > max_size_.width() ||
+ bounds.height() > max_size_.height()))) {
+ // Update the minimum and maximum sizes in case they have changed.
+ UpdateMinAndMaxSize();
+ }
+
changes.width = bounds.width();
changes.height = bounds.height();
value_mask |= CWHeight | CWWidth;
@@ -1242,6 +1226,41 @@ void DesktopWindowTreeHostX11::OnFrameExtentsUpdated() {
}
}
+void DesktopWindowTreeHostX11::UpdateMinAndMaxSize() {
+ if (!window_mapped_)
+ return;
+
+ gfx::Size minimum = native_widget_delegate_->GetMinimumSize();
+ gfx::Size maximum = native_widget_delegate_->GetMaximumSize();
+ if (min_size_ == minimum && max_size_ == maximum)
+ return;
+
+ min_size_ = minimum;
+ max_size_ = maximum;
+
+ XSizeHints hints;
+ long supplied_return;
+ XGetWMNormalHints(xdisplay_, xwindow_, &hints, &supplied_return);
+
+ if (minimum.IsEmpty()) {
+ hints.flags &= ~PMinSize;
+ } else {
+ hints.flags |= PMinSize;
+ hints.min_width = min_size_.width();
+ hints.min_height = min_size_.height();
+ }
+
+ if (maximum.IsEmpty()) {
+ hints.flags &= ~PMaxSize;
+ } else {
+ hints.flags |= PMaxSize;
+ hints.max_width = max_size_.width();
+ hints.max_height = max_size_.height();
+ }
+
+ XSetWMNormalHints(xdisplay_, xwindow_, &hints);
+}
+
void DesktopWindowTreeHostX11::UpdateWMUserTime(
const ui::PlatformEvent& event) {
if (!IsActive())
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
index 8a8766f..642e890 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
@@ -18,6 +18,7 @@
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/size.h"
#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/views/views_export.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
@@ -141,7 +142,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
const gfx::ImageSkia& app_icon) OVERRIDE;
virtual void InitModalType(ui::ModalType modal_type) OVERRIDE;
virtual void FlashFrame(bool flash_frame) OVERRIDE;
- virtual void OnRootViewLayout() const OVERRIDE;
+ virtual void OnRootViewLayout() OVERRIDE;
virtual void OnNativeWidgetFocus() OVERRIDE;
virtual void OnNativeWidgetBlur() OVERRIDE;
virtual bool IsAnimatingClosed() const OVERRIDE;
@@ -179,6 +180,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// Called when |xwindow_|'s _NET_FRAME_EXTENTS property is updated.
void OnFrameExtentsUpdated();
+ // Updates |xwindow_|'s minimum and maximum size.
+ void UpdateMinAndMaxSize();
+
// Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active.
void UpdateWMUserTime(const ui::PlatformEvent& event);
@@ -263,6 +267,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// The bounds of our window before we were maximized.
gfx::Rect restored_bounds_;
+ // |xwindow_|'s minimum size.
+ gfx::Size min_size_;
+
+ // |xwindow_|'s maximum size.
+ gfx::Size max_size_;
+
// The window manager state bits.
std::set< ::Atom> window_properties_;
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index f551687..5a7f21f 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -688,7 +688,7 @@ ui::NativeTheme* NativeWidgetAura::GetNativeTheme() const {
#endif
}
-void NativeWidgetAura::OnRootViewLayout() const {
+void NativeWidgetAura::OnRootViewLayout() {
}
void NativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) {
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h
index 3b1e58a..fed2066 100644
--- a/ui/views/widget/native_widget_aura.h
+++ b/ui/views/widget/native_widget_aura.h
@@ -131,7 +131,7 @@ class VIEWS_EXPORT NativeWidgetAura
virtual void EndMoveLoop() OVERRIDE;
virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE;
virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE;
- virtual void OnRootViewLayout() const OVERRIDE;
+ virtual void OnRootViewLayout() OVERRIDE;
virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE;
// Overridden from views::InputMethodDelegate:
diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h
index d7a4d92..51594d6 100644
--- a/ui/views/widget/native_widget_private.h
+++ b/ui/views/widget/native_widget_private.h
@@ -223,7 +223,7 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget {
virtual void EndMoveLoop() = 0;
virtual void SetVisibilityChangedAnimationsEnabled(bool value) = 0;
virtual ui::NativeTheme* GetNativeTheme() const = 0;
- virtual void OnRootViewLayout() const = 0;
+ virtual void OnRootViewLayout() = 0;
// Repost an unhandled event to the native widget for default OS processing.
virtual void RepostNativeEvent(gfx::NativeEvent native_event) = 0;