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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 20 matching lines...) Expand all
31 #include "core/inspector/InspectorInstrumentation.h" 31 #include "core/inspector/InspectorInstrumentation.h"
32 #include "core/layout/HitTestResult.h" 32 #include "core/layout/HitTestResult.h"
33 #include "core/page/ChromeClient.h" 33 #include "core/page/ChromeClient.h"
34 #include "core/page/FrameTree.h" 34 #include "core/page/FrameTree.h"
35 #include "core/page/Page.h" 35 #include "core/page/Page.h"
36 #include "core/page/PopupOpeningObserver.h" 36 #include "core/page/PopupOpeningObserver.h"
37 #include "core/page/ScopedPageLoadDeferrer.h" 37 #include "core/page/ScopedPageLoadDeferrer.h"
38 #include "core/page/WindowFeatures.h" 38 #include "core/page/WindowFeatures.h"
39 #include "platform/FileChooser.h" 39 #include "platform/FileChooser.h"
40 #include "platform/Logging.h" 40 #include "platform/Logging.h"
41 #include "platform/PlatformScreen.h"
41 #include "platform/geometry/IntRect.h" 42 #include "platform/geometry/IntRect.h"
42 #include "platform/network/NetworkHints.h" 43 #include "platform/network/NetworkHints.h"
43 #include "public/platform/WebScreenInfo.h" 44 #include "public/platform/WebScreenInfo.h"
44 #include "wtf/PassRefPtr.h" 45 #include "wtf/PassRefPtr.h"
45 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
47 #include <algorithm>
46 48
47 namespace blink { 49 namespace blink {
48 50
49 using namespace HTMLNames; 51 using namespace HTMLNames;
50 52
51 Chrome::Chrome(Page* page, ChromeClient* client) 53 Chrome::Chrome(Page* page, ChromeClient* client)
52 : m_page(page) 54 : m_page(page)
53 , m_client(client) 55 , m_client(client)
54 { 56 {
55 ASSERT(m_client); 57 ASSERT(m_client);
(...skipping 21 matching lines...) Expand all
77 WebScreenInfo Chrome::screenInfo() const 79 WebScreenInfo Chrome::screenInfo() const
78 { 80 {
79 return m_client->screenInfo(); 81 return m_client->screenInfo();
80 } 82 }
81 83
82 void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const 84 void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const
83 { 85 {
84 m_client->contentsSizeChanged(frame, size); 86 m_client->contentsSizeChanged(frame, size);
85 } 87 }
86 88
87 void Chrome::setWindowRect(const IntRect& rect) const 89 void Chrome::setWindowRect(const IntRect& pendingRect) const
88 { 90 {
89 m_client->setWindowRect(rect); 91 IntRect screen = screenAvailableRect(*this);
92 IntRect window = pendingRect;
93
94 IntSize minimumSize = m_client->minimumWindowSize();
95 // Let size 0 pass through, since that indicates default size, not minimum s ize.
96 if (window.width())
97 window.setWidth(std::min(std::max(minimumSize.width(), window.width()), screen.width()));
98 if (window.height())
99 window.setHeight(std::min(std::max(minimumSize.height(), window.height() ), screen.height()));
100
101 // Constrain the window position within the valid screen area.
102 window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window .width())));
103 window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window .height())));
104
105 m_client->setWindowRect(window);
90 } 106 }
91 107
92 IntRect Chrome::windowRect() const 108 IntRect Chrome::windowRect() const
93 { 109 {
94 return m_client->windowRect(); 110 return m_client->windowRect();
95 } 111 }
96 112
97 IntRect Chrome::pageRect() const 113 IntRect Chrome::pageRect() const
98 { 114 {
99 return m_client->pageRect(); 115 return m_client->pageRect();
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 { 410 {
395 m_client->registerViewportLayers(); 411 m_client->registerViewportLayers();
396 } 412 }
397 413
398 void Chrome::willBeDestroyed() 414 void Chrome::willBeDestroyed()
399 { 415 {
400 m_client->chromeDestroyed(); 416 m_client->chromeDestroyed();
401 } 417 }
402 418
403 } // namespace blink 419 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698