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

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

Issue 879913003: Use IntRect instead of FloatRect for window positions and sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added FIXME comments Created 5 years, 10 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
« no previous file with comments | « Source/core/page/ChromeClient.h ('k') | Source/core/page/DragController.cpp » ('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, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 if (request.frameName() != "_blank") 94 if (request.frameName() != "_blank")
95 frame.tree().setName(request.frameName()); 95 frame.tree().setName(request.frameName());
96 96
97 host->chrome().setWindowFeatures(features); 97 host->chrome().setWindowFeatures(features);
98 98
99 // 'x' and 'y' specify the location of the window, while 'width' and 'height ' 99 // 'x' and 'y' specify the location of the window, while 'width' and 'height '
100 // specify the size of the viewport. We can only resize the window, so adjus t 100 // specify the size of the viewport. We can only resize the window, so adjus t
101 // for the difference between the window size and the viewport size. 101 // for the difference between the window size and the viewport size.
102 102
103 FloatRect windowRect = host->chrome().windowRect(); 103 IntRect windowRect = host->chrome().windowRect();
104 FloatSize viewportSize = host->chrome().pageRect().size(); 104 IntSize viewportSize = host->chrome().pageRect().size();
105 105
106 if (features.xSet) 106 if (features.xSet)
107 windowRect.setX(features.x); 107 windowRect.setX(features.x);
108 if (features.ySet) 108 if (features.ySet)
109 windowRect.setY(features.y); 109 windowRect.setY(features.y);
110 if (features.widthSet) 110 if (features.widthSet)
111 windowRect.setWidth(features.width + (windowRect.width() - viewportSize. width())); 111 windowRect.setWidth(features.width + (windowRect.width() - viewportSize. width()));
112 if (features.heightSet) 112 if (features.heightSet)
113 windowRect.setHeight(features.height + (windowRect.height() - viewportSi ze.height())); 113 windowRect.setHeight(features.height + (windowRect.height() - viewportSi ze.height()));
114 114
115 // Ensure non-NaN values, minimum size as well as being within valid screen area. 115 // Ensure minimum size as well as being within valid screen area.
116 FloatRect newWindowRect = LocalDOMWindow::adjustWindowRect(frame, windowRect ); 116 IntRect newWindowRect = LocalDOMWindow::adjustWindowRect(frame, windowRect);
117 117
118 host->chrome().setWindowRect(newWindowRect); 118 host->chrome().setWindowRect(newWindowRect);
119 host->chrome().show(policy); 119 host->chrome().show(policy);
120 120
121 created = true; 121 created = true;
122 return &frame; 122 return &frame;
123 } 123 }
124 124
125 LocalFrame* createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures& windowFeatures, 125 LocalFrame* createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures& windowFeatures,
126 LocalDOMWindow& callingWindow, LocalFrame& firstFrame, LocalFrame& openerFra me, LocalDOMWindow::PrepareDialogFunction function, void* functionContext) 126 LocalDOMWindow& callingWindow, LocalFrame& firstFrame, LocalFrame& openerFra me, LocalDOMWindow::PrepareDialogFunction function, void* functionContext)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (shouldSendReferrer == MaybeSendReferrer) { 191 if (shouldSendReferrer == MaybeSendReferrer) {
192 newFrame->loader().setOpener(&openerFrame); 192 newFrame->loader().setOpener(&openerFrame);
193 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy()); 193 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy());
194 } 194 }
195 FrameLoadRequest newRequest(0, request.resourceRequest()); 195 FrameLoadRequest newRequest(0, request.resourceRequest());
196 newRequest.setFormState(request.formState()); 196 newRequest.setFormState(request.formState());
197 newFrame->loader().load(newRequest); 197 newFrame->loader().load(newRequest);
198 } 198 }
199 199
200 } // namespace blink 200 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/ChromeClient.h ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698