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

Side by Side Diff: Source/core/page/Chrome.cpp

Issue 1135633004: Revert of Make createWindow (mostly) work with OOPIF (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/core/frame/Screen.cpp ('k') | Source/core/page/CreateWindow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
42 #include "platform/geometry/IntRect.h" 41 #include "platform/geometry/IntRect.h"
43 #include "platform/network/NetworkHints.h" 42 #include "platform/network/NetworkHints.h"
44 #include "public/platform/WebScreenInfo.h" 43 #include "public/platform/WebScreenInfo.h"
45 #include "wtf/PassRefPtr.h" 44 #include "wtf/PassRefPtr.h"
46 #include "wtf/Vector.h" 45 #include "wtf/Vector.h"
47 #include <algorithm>
48 46
49 namespace blink { 47 namespace blink {
50 48
51 using namespace HTMLNames; 49 using namespace HTMLNames;
52 50
53 Chrome::Chrome(Page* page, ChromeClient* client) 51 Chrome::Chrome(Page* page, ChromeClient* client)
54 : m_page(page) 52 : m_page(page)
55 , m_client(client) 53 , m_client(client)
56 { 54 {
57 ASSERT(m_client); 55 ASSERT(m_client);
(...skipping 21 matching lines...) Expand all
79 WebScreenInfo Chrome::screenInfo() const 77 WebScreenInfo Chrome::screenInfo() const
80 { 78 {
81 return m_client->screenInfo(); 79 return m_client->screenInfo();
82 } 80 }
83 81
84 void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const 82 void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const
85 { 83 {
86 m_client->contentsSizeChanged(frame, size); 84 m_client->contentsSizeChanged(frame, size);
87 } 85 }
88 86
89 void Chrome::setWindowRect(const IntRect& pendingRect) const 87 void Chrome::setWindowRect(const IntRect& rect) const
90 { 88 {
91 IntRect screen = screenAvailableRect(*this); 89 m_client->setWindowRect(rect);
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);
106 } 90 }
107 91
108 IntRect Chrome::windowRect() const 92 IntRect Chrome::windowRect() const
109 { 93 {
110 return m_client->windowRect(); 94 return m_client->windowRect();
111 } 95 }
112 96
113 IntRect Chrome::pageRect() const 97 IntRect Chrome::pageRect() const
114 { 98 {
115 return m_client->pageRect(); 99 return m_client->pageRect();
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 { 394 {
411 m_client->registerViewportLayers(); 395 m_client->registerViewportLayers();
412 } 396 }
413 397
414 void Chrome::willBeDestroyed() 398 void Chrome::willBeDestroyed()
415 { 399 {
416 m_client->chromeDestroyed(); 400 m_client->chromeDestroyed();
417 } 401 }
418 402
419 } // namespace blink 403 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/Screen.cpp ('k') | Source/core/page/CreateWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698