Commit 97f6a33f authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Fix Widget::SetBoundsConstrained

Proposal: https://docs.google.com/document/d/1KrKEWSK64es3W3LYKQUpvwMzUJqTz8owFGXuJQqeXzs/edit?usp=sharing

Bug: 806936
Change-Id: Id086f9835a710cf2165f4ba8bd07904229301b67
Reviewed-on: https://chromium-review.googlesource.com/946554
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551337}
parent bbcd9915
......@@ -11,6 +11,7 @@ include_rules = [
"+ui/accessibility",
"+ui/aura",
"+ui/base",
"+ui/display",
"+ui/events",
"+ui/chromeos/events",
"+ui/chromeos/search_box",
......
......@@ -29,6 +29,8 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/chromeos/search_box/search_box_view_base.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
......@@ -108,7 +110,9 @@ views::Widget* KeyboardShortcutView::Show(gfx::NativeWindow context) {
constexpr gfx::Size kKSVWindowSize(800, 512);
gfx::Rect window_bounds(kKSVWindowSize);
if (context) {
window_bounds = context->GetRootWindow()->GetBoundsInScreen();
window_bounds = display::Screen::GetScreen()
->GetDisplayNearestWindow(context->GetRootWindow())
.work_area();
window_bounds.ClampToCenteredSize(kKSVWindowSize);
}
views::Widget::CreateWindowWithContextAndBounds(new KeyboardShortcutView(),
......
......@@ -12,6 +12,8 @@
#include "ash/test/ash_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/widget/widget.h"
......@@ -79,7 +81,9 @@ TEST_F(KeyboardShortcutViewTest, CenterWindowInScreen) {
EXPECT_TRUE(widget);
gfx::Rect root_window_bounds =
widget->GetNativeWindow()->GetRootWindow()->GetBoundsInScreen();
display::Screen::GetScreen()
->GetDisplayNearestWindow(widget->GetNativeWindow()->GetRootWindow())
.work_area();
gfx::Rect shortcuts_window_bounds =
widget->GetNativeWindow()->GetBoundsInScreen();
EXPECT_EQ(root_window_bounds.CenterPoint().x(),
......
......@@ -14,6 +14,7 @@
#include "ui/compositor/dip_util.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/wm/core/window_properties.h"
#include "ui/wm/core/window_util.h"
namespace ash {
......@@ -108,7 +109,7 @@ void ScreenPositionController::ConvertHostPointToScreen(
void ScreenPositionController::SetBounds(aura::Window* window,
const gfx::Rect& bounds,
const display::Display& display) {
if (!window->parent()->GetProperty(kUsesScreenCoordinatesKey)) {
if (!window->parent()->GetProperty(::wm::kUsesScreenCoordinatesKey)) {
window->SetBounds(bounds);
return;
}
......
This diff is collapsed.
......@@ -103,6 +103,11 @@ class RootWindowControllerTest : public AshTestBase {
views::Widget* CreateTestWidget(const gfx::Rect& bounds) {
views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
NULL, CurrentContext(), bounds);
// The initial bounds will be constrained to the screen work area or the
// parent. See Widget::InitialBounds() & Widget::SetBoundsConstrained().
// Explicitly setting the bounds here will allow the view to be positioned
// such that it can extend outside the screen work area.
widget->SetBounds(bounds);
widget->Show();
return widget;
}
......@@ -110,6 +115,8 @@ class RootWindowControllerTest : public AshTestBase {
views::Widget* CreateModalWidget(const gfx::Rect& bounds) {
views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
new TestDelegate(true), CurrentContext(), bounds);
// See the above comment.
widget->SetBounds(bounds);
widget->Show();
return widget;
}
......@@ -118,6 +125,8 @@ class RootWindowControllerTest : public AshTestBase {
aura::Window* parent) {
views::Widget* widget = views::Widget::CreateWindowWithParentAndBounds(
new TestDelegate(true), parent, bounds);
// See the above comment.
widget->SetBounds(bounds);
widget->Show();
return widget;
}
......
......@@ -207,6 +207,8 @@ TEST_F(ShelfWidgetTest, ShelfEdgeOverlappingWindowHitTestMouse) {
kWindowWidth, kWindowHeight);
// Widget is now owned by the parent window.
widget->Init(params);
// Explicitly set the bounds which will allow the widget to overlap the shelf.
widget->SetBounds(params.bounds);
widget->Show();
gfx::Rect widget_bounds = widget->GetWindowBoundsInScreen();
EXPECT_TRUE(widget_bounds.Intersects(shelf_bounds));
......
......@@ -18,8 +18,6 @@ DEFINE_UI_CLASS_PROPERTY_KEY(bool, kRenderTitleAreaProperty, false);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSnapChildrenToPixelBoundary, false);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kUsesScreenCoordinatesKey, false);
DEFINE_UI_CLASS_PROPERTY_KEY(WidgetCreationType,
kWidgetCreationTypeKey,
WidgetCreationType::INTERNAL);
......
......@@ -51,9 +51,6 @@ ASH_EXPORT extern const aura::WindowProperty<bool>* const
// boundary.
extern const aura::WindowProperty<bool>* const kSnapChildrenToPixelBoundary;
// Property to tell if the container uses the screen coordinates.
extern const aura::WindowProperty<bool>* const kUsesScreenCoordinatesKey;
ASH_EXPORT extern const aura::WindowProperty<WidgetCreationType>* const
kWidgetCreationTypeKey;
......
......@@ -418,6 +418,7 @@ jumbo_component("views") {
"views_touch_selection_controller_factory_mac.cc",
"widget/drop_helper.cc",
"widget/native_widget_mac.mm",
"widget/native_widget_private.cc",
"widget/root_view.cc",
"widget/root_view_targeter.cc",
"widget/tooltip_manager.cc",
......
......@@ -704,6 +704,12 @@ void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
bounds_in_pixels);
}
void DesktopNativeWidgetAura::SetBoundsConstrained(const gfx::Rect& bounds) {
if (!content_window_)
return;
SetBounds(NativeWidgetPrivate::ConstrainBoundsToDisplayWorkArea(bounds));
}
void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) {
if (content_window_)
desktop_window_tree_host_->SetSize(size);
......
......@@ -137,6 +137,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
gfx::Rect GetRestoredBounds() const override;
std::string GetWorkspace() const override;
void SetBounds(const gfx::Rect& bounds) override;
void SetBoundsConstrained(const gfx::Rect& bounds) override;
void SetSize(const gfx::Size& size) override;
void StackAbove(gfx::NativeView native_view) override;
void StackAtTop() override;
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/views/test/native_widget_factory.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/test/widget_test.h"
......@@ -29,7 +31,7 @@ TEST_F(DesktopScreenPositionClientTest, PositionDialog) {
Widget* dialog = DialogDelegate::CreateDialogWidget(
dialog_delegate_view, NULL, parent_widget.GetNativeView());
dialog->SetBounds(gfx::Rect(11, 12, 200, 200));
EXPECT_EQ("11,12", dialog->GetWindowBoundsInScreen().origin().ToString());
EXPECT_EQ(gfx::Point(11, 12), dialog->GetWindowBoundsInScreen().origin());
}
// Verifies that setting the bounds of a control parented to something other
......@@ -39,6 +41,8 @@ TEST_F(DesktopScreenPositionClientTest, PositionControlWithNonRootParent) {
Widget widget2;
Widget widget3;
gfx::Point origin = gfx::Point(16, 16);
gfx::Rect work_area =
display::Screen::GetScreen()->GetDisplayNearestPoint(origin).work_area();
// Use a custom frame type. By default we will choose a native frame when
// aero glass is enabled, and this complicates the logic surrounding origin
......@@ -52,7 +56,9 @@ TEST_F(DesktopScreenPositionClientTest, PositionControlWithNonRootParent) {
// parented to the second, also not positioned at (0,0).
Widget::InitParams params1 =
CreateParams(Widget::InitParams::TYPE_WINDOW);
params1.bounds = gfx::Rect(origin, gfx::Size(700, 600));
params1.bounds = gfx::Rect(
origin + work_area.OffsetFromOrigin(),
gfx::Size(700, work_area.height() - origin.y() - work_area.y()));
params1.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params1.native_widget =
test::CreatePlatformDesktopNativeWidgetImpl(params1, &widget1, nullptr);
......@@ -60,7 +66,7 @@ TEST_F(DesktopScreenPositionClientTest, PositionControlWithNonRootParent) {
Widget::InitParams params2 =
CreateParams(Widget::InitParams::TYPE_WINDOW);
params2.bounds = gfx::Rect(origin, gfx::Size(600, 500));
params2.bounds = gfx::Rect(origin, gfx::Size(600, work_area.height() - 100));
params2.parent = widget1.GetNativeView();
params2.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params2.child = true;
......@@ -71,14 +77,94 @@ TEST_F(DesktopScreenPositionClientTest, PositionControlWithNonRootParent) {
params3.parent = widget2.GetNativeView();
params3.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params3.child = true;
params3.bounds = gfx::Rect(origin, gfx::Size(500, 400));
params3.bounds = gfx::Rect(origin, gfx::Size(500, work_area.height() - 200));
widget3.Init(params3);
// The origin of the 3rd window should be the sum of all parent origins.
gfx::Point expected_origin(origin.x() * 3, origin.y() * 3);
gfx::Rect expected_bounds(expected_origin, gfx::Size(500, 400));
gfx::Point expected_origin(origin.x() * 3 + work_area.x(),
origin.y() * 3 + work_area.y());
gfx::Rect expected_bounds(expected_origin,
gfx::Size(500, work_area.height() - 200));
gfx::Rect actual_bounds(widget3.GetWindowBoundsInScreen());
EXPECT_EQ(expected_bounds.ToString(), actual_bounds.ToString());
EXPECT_EQ(expected_bounds, actual_bounds);
}
// Verifies that the initial bounds of the widget is fully on the screen.
TEST_F(DesktopScreenPositionClientTest, InitialBoundsConstrainedToDesktop) {
Widget widget;
// Use the primary display for this test.
gfx::Rect work_area =
display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
// Make the origin start at 75% of the width and height.
gfx::Point origin =
gfx::Point(work_area.width() * 3 / 4, work_area.height() * 3 / 4);
// Use a custom frame type. See above for further explanation.
widget.set_frame_type(Widget::FRAME_TYPE_FORCE_CUSTOM);
// Create a window that is intentionally positioned so that it is off screen.
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
params.bounds = gfx::Rect(
origin, gfx::Size(work_area.width() / 2, work_area.height() / 2));
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.native_widget =
test::CreatePlatformDesktopNativeWidgetImpl(params, &widget, nullptr);
widget.Init(params);
// The bounds of the window should be fully on the primary display.
gfx::Point expected_origin(work_area.right() - work_area.width() / 2,
work_area.bottom() - work_area.height() / 2);
gfx::Rect expected_bounds(expected_origin, gfx::Size(work_area.width() / 2,
work_area.height() / 2));
gfx::Rect actual_bounds(widget.GetWindowBoundsInScreen());
EXPECT_EQ(expected_bounds, actual_bounds);
}
// Verifies that the initial bounds of the widget is fully within the bounds of
// the parent.
TEST_F(DesktopScreenPositionClientTest, InitialBoundsConstrainedToParent) {
Widget widget1;
Widget widget2;
// Use the primary display for this test.
gfx::Rect work_area =
display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
gfx::Point origin = gfx::Point(work_area.x() + work_area.width() / 4,
work_area.y() + work_area.height() / 4);
// Use a custom frame type. See above for further explanation
widget1.set_frame_type(Widget::FRAME_TYPE_FORCE_CUSTOM);
widget2.set_frame_type(Widget::FRAME_TYPE_FORCE_CUSTOM);
// Create 2 windows. A root window, and an arbitrary window parented to the
// root and positioned such that it extends beyond the bounds of the root.
Widget::InitParams params1 = CreateParams(Widget::InitParams::TYPE_WINDOW);
params1.bounds = gfx::Rect(
origin, gfx::Size(work_area.width() / 2, work_area.height() / 2));
params1.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params1.native_widget =
test::CreatePlatformDesktopNativeWidgetImpl(params1, &widget1, nullptr);
widget1.Init(params1);
gfx::Rect widget_bounds(widget1.GetWindowBoundsInScreen());
Widget::InitParams params2 = CreateParams(Widget::InitParams::TYPE_WINDOW);
params2.bounds =
gfx::Rect(widget_bounds.width() * 3 / 4, widget_bounds.height() * 3 / 4,
widget_bounds.width() / 2, widget_bounds.height() / 2);
params2.parent = widget1.GetNativeView();
params2.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params2.child = true;
widget2.Init(params2);
// The bounds of the child window should be fully in the parent.
gfx::Point expected_origin(
widget_bounds.right() - widget_bounds.width() / 2,
widget_bounds.bottom() - widget_bounds.height() / 2);
gfx::Rect expected_bounds(
expected_origin,
gfx::Size(widget_bounds.width() / 2, widget_bounds.height() / 2));
gfx::Rect actual_bounds(widget2.GetWindowBoundsInScreen());
EXPECT_EQ(expected_bounds, actual_bounds);
}
} // namespace views
......@@ -47,9 +47,11 @@
#include "ui/views/widget/widget_aura_utils.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/views/widget/window_reorderer.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/core/shadow_types.h"
#include "ui/wm/core/transient_window_manager.h"
#include "ui/wm/core/window_animations.h"
#include "ui/wm/core/window_properties.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_client.h"
#include "ui/wm/public/window_move_client.h"
......@@ -187,7 +189,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
wm::AddTransientChild(parent, window_);
if (!context)
context = parent;
parent = NULL;
parent = nullptr;
// Generally transient bubbles are showing state associated to the parent
// window. Make sure the transient bubble is only visible if the parent is
......@@ -483,6 +485,22 @@ void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
window_->SetBounds(bounds);
}
void NativeWidgetAura::SetBoundsConstrained(const gfx::Rect& bounds) {
if (!window_)
return;
gfx::Rect new_bounds(bounds);
if (window_->parent()) {
if (window_->parent()->GetProperty(wm::kUsesScreenCoordinatesKey)) {
new_bounds =
NativeWidgetPrivate::ConstrainBoundsToDisplayWorkArea(new_bounds);
} else {
new_bounds.AdjustToFit(gfx::Rect(window_->parent()->bounds().size()));
}
}
SetBounds(new_bounds);
}
void NativeWidgetAura::SetSize(const gfx::Size& size) {
if (window_)
window_->SetBounds(gfx::Rect(window_->bounds().origin(), size));
......
......@@ -96,6 +96,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate,
gfx::Rect GetRestoredBounds() const override;
std::string GetWorkspace() const override;
void SetBounds(const gfx::Rect& bounds) override;
void SetBoundsConstrained(const gfx::Rect& bounds) override;
void SetSize(const gfx::Size& size) override;
void StackAbove(gfx::NativeView native_view) override;
void StackAtTop() override;
......
......@@ -81,6 +81,7 @@ class VIEWS_EXPORT NativeWidgetMac : public internal::NativeWidgetPrivate {
gfx::Rect GetRestoredBounds() const override;
std::string GetWorkspace() const override;
void SetBounds(const gfx::Rect& bounds) override;
void SetBoundsConstrained(const gfx::Rect& bounds) override;
void SetSize(const gfx::Size& size) override;
void StackAbove(gfx::NativeView native_view) override;
void StackAtTop() override;
......
......@@ -18,6 +18,8 @@
#import "ui/base/cocoa/constrained_window/constrained_window_animation.h"
#import "ui/base/cocoa/window_size_constants.h"
#include "ui/base/ui_base_switches.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/font_list.h"
#import "ui/gfx/mac/coordinate_conversion.h"
#import "ui/gfx/mac/nswindow_frame_controls.h"
......@@ -195,7 +197,7 @@ gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const {
Widget* NativeWidgetMac::GetTopLevelWidget() {
NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView());
return native_widget ? native_widget->GetWidget() : NULL;
return native_widget ? native_widget->GetWidget() : nullptr;
}
const ui::Compositor* NativeWidgetMac::GetCompositor() const {
......@@ -252,7 +254,7 @@ bool NativeWidgetMac::HasCapture() const {
}
ui::InputMethod* NativeWidgetMac::GetInputMethod() {
return bridge_ ? bridge_->GetInputMethod() : NULL;
return bridge_ ? bridge_->GetInputMethod() : nullptr;
}
void NativeWidgetMac::CenterWindow(const gfx::Size& size) {
......@@ -332,6 +334,24 @@ void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) {
bridge_->SetBounds(bounds);
}
void NativeWidgetMac::SetBoundsConstrained(const gfx::Rect& bounds) {
if (!bridge_)
return;
gfx::Rect new_bounds(bounds);
NativeWidgetPrivate* ancestor =
bridge_ && bridge_->parent()
? GetNativeWidgetForNativeWindow(bridge_->parent()->GetNSWindow())
: nullptr;
if (!ancestor) {
new_bounds = ConstrainBoundsToDisplayWorkArea(new_bounds);
} else {
new_bounds.AdjustToFit(
gfx::Rect(ancestor->GetWindowBoundsInScreen().size()));
}
SetBounds(new_bounds);
}
void NativeWidgetMac::SetSize(const gfx::Size& size) {
// Ensure the top-left corner stays in-place (rather than the bottom-left,
// which -[NSWindow setContentSize:] would do).
......@@ -376,7 +396,7 @@ void NativeWidgetMac::Close() {
}
// Clear the view early to suppress repaints.
bridge_->SetRootView(NULL);
bridge_->SetRootView(nullptr);
// Widget::Close() ensures [Non]ClientView::CanClose() returns true, so there
// is no need to call the NSWindow or its delegate's -windowShouldClose:
......@@ -702,7 +722,7 @@ NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow(
base::mac::ObjCCastStrict<ViewsNSWindowDelegate>(window_delegate);
return [delegate nativeWidgetMac];
}
return NULL; // Not created by NativeWidgetMac.
return nullptr; // Not created by NativeWidgetMac.
}
// static
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/widget/native_widget_private.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
namespace views {
namespace internal {
// static
gfx::Rect NativeWidgetPrivate::ConstrainBoundsToDisplayWorkArea(
const gfx::Rect& bounds) {
gfx::Rect new_bounds(bounds);
gfx::Rect work_area =
display::Screen::GetScreen()->GetDisplayMatching(bounds).work_area();
if (!work_area.IsEmpty())
new_bounds.AdjustToFit(work_area);
return new_bounds;
}
} // namespace internal
} // namespace views
......@@ -77,6 +77,10 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget {
// capture set, or if |native_view| has no root.
static gfx::NativeView GetGlobalCapture(gfx::NativeView native_view);
// Adjusts the given bounds to fit onto the display implied by the position
// of the given bounds.
static gfx::Rect ConstrainBoundsToDisplayWorkArea(const gfx::Rect& bounds);
// Initializes the NativeWidget.
virtual void InitNativeWidget(const Widget::InitParams& params) = 0;
......@@ -173,6 +177,7 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget {
virtual gfx::Rect GetRestoredBounds() const = 0;
virtual std::string GetWorkspace() const = 0;
virtual void SetBounds(const gfx::Rect& bounds) = 0;
virtual void SetBoundsConstrained(const gfx::Rect& bounds) = 0;
virtual void SetSize(const gfx::Size& size) = 0;
virtual void StackAbove(gfx::NativeView native_view) = 0;
virtual void StackAtTop() = 0;
......
......@@ -525,19 +525,7 @@ void Widget::CenterWindow(const gfx::Size& size) {
}
void Widget::SetBoundsConstrained(const gfx::Rect& bounds) {
gfx::Rect work_area = display::Screen::GetScreen()
->GetDisplayNearestPoint(bounds.origin())
.work_area();
if (work_area.IsEmpty()) {
SetBounds(bounds);
} else {
// TODO(https://crbug.com/806936): The following code doesn't actually do
// what the comment describing this function says it should.
// Inset the work area slightly.
work_area.Inset(10, 10, 10, 10);
work_area.AdjustToFit(bounds);
SetBounds(work_area);
}
native_widget_->SetBoundsConstrained(bounds);
}
void Widget::SetVisibilityChangedAnimationsEnabled(bool value) {
......@@ -1510,7 +1498,7 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) {
if (bounds.origin().IsOrigin()) {
// No initial bounds supplied, so size the window to its content and
// center over its parent.
native_widget_->CenterWindow(non_client_view_->GetPreferredSize());
CenterWindow(non_client_view_->GetPreferredSize());
} else {
// Use the preferred size and the supplied origin.
gfx::Rect preferred_bounds(bounds);
......
......@@ -449,9 +449,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Sizes the window to the specified size and centerizes it.
void CenterWindow(const gfx::Size& size);
// Like SetBounds(), but ensures the Widget is fully visible on screen,
// resizing and/or repositioning as necessary. This is only useful for
// non-child widgets.
// Like SetBounds(), but ensures the Widget is fully visible on screen or
// parent widget, resizing and/or repositioning as necessary.
void SetBoundsConstrained(const gfx::Rect& bounds);
// Sets whether animations that occur when visibility is changed are enabled.
......
......@@ -49,6 +49,8 @@ jumbo_component("wm") {
"core/window_animations.h",
"core/window_modality_controller.cc",
"core/window_modality_controller.h",
"core/window_properties.cc",
"core/window_properties.h",
"core/window_util.cc",
"core/window_util.h",
"core/wm_core_export.h",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/wm/core/window_properties.h"
namespace wm {
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kUsesScreenCoordinatesKey, false);
} // namespace wm
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_WM_CORE_WINDOW_PROPERTIES_H_
#define UI_WM_CORE_WINDOW_PROPERTIES_H_
#include "ui/base/class_property.h"
#include "ui/wm/core/wm_core_export.h"
namespace wm {
// Property to tell if the container uses screen coordinates for the child
// windows.
WM_CORE_EXPORT extern const ui::ClassProperty<bool>* const
kUsesScreenCoordinatesKey;
} // namespace wm
#endif // UI_WM_CORE_WINDOW_PROPERTIES_H_
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