Chromium Code Reviews| Index: Source/core/page/Chrome.cpp |
| diff --git a/Source/core/page/Chrome.cpp b/Source/core/page/Chrome.cpp |
| index 0afcd943cfb59c0bb09c964afaf45b1682fc9435..5c0aa8cec269d197a427c2cc7d4ef5ae230306f2 100644 |
| --- a/Source/core/page/Chrome.cpp |
| +++ b/Source/core/page/Chrome.cpp |
| @@ -38,11 +38,15 @@ |
| #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> |
| + |
| +using namespace std; |
|
dcheng
2015/04/29 21:37:46
This is generally discourage in Chrome, and we pro
Nate Chapin
2015/05/01 20:30:52
Done.
|
| namespace blink { |
| @@ -84,9 +88,24 @@ void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const |
| m_client->contentsSizeChanged(frame, size); |
| } |
| -void Chrome::setWindowRect(const IntRect& rect) const |
| +void Chrome::setWindowRect(Widget* widget, const IntRect& pendingRect) const |
| { |
| - m_client->setWindowRect(rect); |
| + IntRect screen = screenAvailableRect(widget); |
| + 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(min(max(minimumSize.width(), window.width()), screen.width())); |
| + if (window.height()) |
| + window.setHeight(min(max(minimumSize.height(), window.height()), screen.height())); |
| + |
| + // Constrain the window position within the valid screen area. |
| + window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width()))); |
| + window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height()))); |
| + |
| + |
| + m_client->setWindowRect(window); |
| } |
| IntRect Chrome::windowRect() const |