Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1427)

Unified Diff: Source/core/page/Chrome.cpp

Issue 1109213002: Make createWindow (mostly) work with OOPIF (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix style, use FrameView::root Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698