views: Linux: Support CefWindowDelegate::CanResize restriction
This commit is contained in:
parent
7f6c18af09
commit
64e6971099
|
@ -436,6 +436,30 @@ bool CefWindowView::ShouldDescendIntoChildForEventHandling(
|
||||||
!draggable_region_->contains(location.x(), location.y());
|
!draggable_region_->contains(location.x(), location.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefWindowView::MaybeGetMinimumSize(gfx::Size* size) const {
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
// Resize is disabled on Linux by returning the preferred size as the min/max
|
||||||
|
// size.
|
||||||
|
if (!CanResize()) {
|
||||||
|
*size = CalculatePreferredSize();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefWindowView::MaybeGetMaximumSize(gfx::Size* size) const {
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
// Resize is disabled on Linux by returning the preferred size as the min/max
|
||||||
|
// size.
|
||||||
|
if (!CanResize()) {
|
||||||
|
*size = CalculatePreferredSize();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CefWindowView::ViewHierarchyChanged(
|
void CefWindowView::ViewHierarchyChanged(
|
||||||
const views::View::ViewHierarchyChangedDetails& details) {
|
const views::View::ViewHierarchyChangedDetails& details) {
|
||||||
if (details.child == this) {
|
if (details.child == this) {
|
||||||
|
|
|
@ -68,6 +68,8 @@ class CefWindowView
|
||||||
bool ShouldDescendIntoChildForEventHandling(
|
bool ShouldDescendIntoChildForEventHandling(
|
||||||
gfx::NativeView child,
|
gfx::NativeView child,
|
||||||
const gfx::Point& location) override;
|
const gfx::Point& location) override;
|
||||||
|
bool MaybeGetMinimumSize(gfx::Size* size) const override;
|
||||||
|
bool MaybeGetMaximumSize(gfx::Size* size) const override;
|
||||||
|
|
||||||
// views::View methods:
|
// views::View methods:
|
||||||
void ViewHierarchyChanged(
|
void ViewHierarchyChanged(
|
||||||
|
|
|
@ -79,6 +79,8 @@ patches = [
|
||||||
# and WS_SYSMENU styles. Otherwise Windows 10 enforces a minimum window
|
# and WS_SYSMENU styles. Otherwise Windows 10 enforces a minimum window
|
||||||
# width of ~116 units that cannot be overridden.
|
# width of ~116 units that cannot be overridden.
|
||||||
# Linux: Allow creation of activatable menu windows.
|
# Linux: Allow creation of activatable menu windows.
|
||||||
|
# Linux: Support CefWindowDelegate::CanResize restriction by specifying
|
||||||
|
# min/max Widget size values.
|
||||||
# https://bitbucket.org/chromiumembedded/cef/issues/1947
|
# https://bitbucket.org/chromiumembedded/cef/issues/1947
|
||||||
#
|
#
|
||||||
# Support configuration of RWHVGuest device scale factor.
|
# Support configuration of RWHVGuest device scale factor.
|
||||||
|
|
|
@ -335,7 +335,7 @@ index cb18967..0c143d2 100644
|
||||||
base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_;
|
base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_;
|
||||||
|
|
||||||
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
||||||
index 32a50e8..06d39f0 100644
|
index 32a50e8..43191a9 100644
|
||||||
--- ui/views/widget/widget.cc
|
--- ui/views/widget/widget.cc
|
||||||
+++ ui/views/widget/widget.cc
|
+++ ui/views/widget/widget.cc
|
||||||
@@ -130,6 +130,7 @@ Widget::InitParams::InitParams(Type type)
|
@@ -130,6 +130,7 @@ Widget::InitParams::InitParams(Type type)
|
||||||
|
@ -369,6 +369,23 @@ index 32a50e8..06d39f0 100644
|
||||||
}
|
}
|
||||||
// This must come after SetContentsView() or it might not be able to find
|
// This must come after SetContentsView() or it might not be able to find
|
||||||
// the correct NativeTheme (on Linux). See http://crbug.com/384492
|
// the correct NativeTheme (on Linux). See http://crbug.com/384492
|
||||||
|
@@ -1098,10 +1104,16 @@ void Widget::OnNativeWidgetDestroyed() {
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size Widget::GetMinimumSize() const {
|
||||||
|
+ gfx::Size size;
|
||||||
|
+ if (widget_delegate_->MaybeGetMinimumSize(&size))
|
||||||
|
+ return size;
|
||||||
|
return non_client_view_ ? non_client_view_->GetMinimumSize() : gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size Widget::GetMaximumSize() const {
|
||||||
|
+ gfx::Size size;
|
||||||
|
+ if (widget_delegate_->MaybeGetMaximumSize(&size))
|
||||||
|
+ return size;
|
||||||
|
return non_client_view_ ? non_client_view_->GetMaximumSize() : gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
||||||
index 63fcb9d..7237ae6 100644
|
index 63fcb9d..7237ae6 100644
|
||||||
--- ui/views/widget/widget.h
|
--- ui/views/widget/widget.h
|
||||||
|
@ -381,6 +398,21 @@ index 63fcb9d..7237ae6 100644
|
||||||
// Specifies the initial bounds of the Widget. Default is empty, which means
|
// Specifies the initial bounds of the Widget. Default is empty, which means
|
||||||
// the NativeWidget may specify a default size. If the parent is specified,
|
// the NativeWidget may specify a default size. If the parent is specified,
|
||||||
// |bounds| is in the parent's coordinate system. If the parent is not
|
// |bounds| is in the parent's coordinate system. If the parent is not
|
||||||
|
diff --git ui/views/widget/widget_delegate.h ui/views/widget/widget_delegate.h
|
||||||
|
index bd4d8a7..998cfa0 100644
|
||||||
|
--- ui/views/widget/widget_delegate.h
|
||||||
|
+++ ui/views/widget/widget_delegate.h
|
||||||
|
@@ -187,6 +187,10 @@ class VIEWS_EXPORT WidgetDelegate {
|
||||||
|
// be cycled through with keyboard focus.
|
||||||
|
virtual void GetAccessiblePanes(std::vector<View*>* panes) {}
|
||||||
|
|
||||||
|
+ // CEF supports override of min/max size values.
|
||||||
|
+ virtual bool MaybeGetMinimumSize(gfx::Size* size) const { return false; }
|
||||||
|
+ virtual bool MaybeGetMaximumSize(gfx::Size* size) const { return false; }
|
||||||
|
+
|
||||||
|
protected:
|
||||||
|
virtual ~WidgetDelegate() {}
|
||||||
|
|
||||||
diff --git ui/views/widget/widget_hwnd_utils.cc ui/views/widget/widget_hwnd_utils.cc
|
diff --git ui/views/widget/widget_hwnd_utils.cc ui/views/widget/widget_hwnd_utils.cc
|
||||||
index 163e4b5..58f594db 100644
|
index 163e4b5..58f594db 100644
|
||||||
--- ui/views/widget/widget_hwnd_utils.cc
|
--- ui/views/widget/widget_hwnd_utils.cc
|
||||||
|
|
Loading…
Reference in New Issue