• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #include "tests/cefclient/browser/window_test_runner.h"
6 
7 namespace client {
8 namespace window_test {
9 
10 // static
ModifyBounds(const CefRect & display,CefRect & window)11 void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) {
12   window.x += display.x;
13   window.y += display.y;
14 
15   if (window.x < display.x)
16     window.x = display.x;
17   if (window.y < display.y)
18     window.y = display.y;
19   if (window.width < 100)
20     window.width = 100;
21   else if (window.width >= display.width)
22     window.width = display.width;
23   if (window.height < 100)
24     window.height = 100;
25   else if (window.height >= display.height)
26     window.height = display.height;
27   if (window.x + window.width >= display.x + display.width)
28     window.x = display.x + display.width - window.width;
29   if (window.y + window.height >= display.y + display.height)
30     window.y = display.y + display.height - window.height;
31 }
32 
33 }  // namespace window_test
34 }  // namespace client
35