| Index: Source/core/page/Chrome.cpp
|
| diff --git a/Source/core/page/Chrome.cpp b/Source/core/page/Chrome.cpp
|
| index a6f9cb7bae589cec26f3fc30fdbbacef8d153205..6de53ed3692ce411581bfe28662dc384baa22fbd 100644
|
| --- a/Source/core/page/Chrome.cpp
|
| +++ b/Source/core/page/Chrome.cpp
|
| @@ -38,11 +38,13 @@
|
| #include "core/page/WindowFeatures.h"
|
| #include "platform/FileChooser.h"
|
| #include "platform/Logging.h"
|
| +#include "platform/PlatformScreen.h"
|
| #include "platform/geometry/IntRect.h"
|
| #include "platform/network/NetworkHints.h"
|
| #include "public/platform/WebScreenInfo.h"
|
| #include "wtf/PassRefPtr.h"
|
| #include "wtf/Vector.h"
|
| +#include <algorithm>
|
|
|
| namespace blink {
|
|
|
| @@ -84,9 +86,23 @@ void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const
|
| m_client->contentsSizeChanged(frame, size);
|
| }
|
|
|
| -void Chrome::setWindowRect(const IntRect& rect) const
|
| +void Chrome::setWindowRect(const IntRect& pendingRect) const
|
| {
|
| - m_client->setWindowRect(rect);
|
| + IntRect screen = screenAvailableRect(*this);
|
| + IntRect window = pendingRect;
|
| +
|
| + IntSize minimumSize = m_client->minimumWindowSize();
|
| + // Let size 0 pass through, since that indicates default size, not minimum size.
|
| + if (window.width())
|
| + window.setWidth(std::min(std::max(minimumSize.width(), window.width()), screen.width()));
|
| + if (window.height())
|
| + window.setHeight(std::min(std::max(minimumSize.height(), window.height()), screen.height()));
|
| +
|
| + // Constrain the window position within the valid screen area.
|
| + window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window.width())));
|
| + window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window.height())));
|
| +
|
| + m_client->setWindowRect(window);
|
| }
|
|
|
| IntRect Chrome::windowRect() const
|
|
|