2016-01-19 21:09:01 +01:00
|
|
|
// Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/cefclient/browser/window_test_runner.h"
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
namespace client {
|
|
|
|
namespace window_test {
|
|
|
|
|
|
|
|
// static
|
|
|
|
void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) {
|
|
|
|
window.x += display.x;
|
|
|
|
window.y += display.y;
|
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (window.x < display.x) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.x = display.x;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
|
|
|
if (window.y < display.y) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.y = display.y;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
|
|
|
if (window.width < 100) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.width = 100;
|
2023-01-02 23:59:03 +01:00
|
|
|
} else if (window.width >= display.width) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.width = display.width;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
|
|
|
if (window.height < 100) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.height = 100;
|
2023-01-02 23:59:03 +01:00
|
|
|
} else if (window.height >= display.height) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.height = display.height;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
|
|
|
if (window.x + window.width >= display.x + display.width) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.x = display.x + display.width - window.width;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
|
|
|
if (window.y + window.height >= display.y + display.height) {
|
2016-01-19 21:09:01 +01:00
|
|
|
window.y = display.y + display.height - window.height;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-01-19 21:09:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace window_test
|
|
|
|
} // namespace client
|