OLD | NEW |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (features.xSet) | 98 if (features.xSet) |
99 windowRect.setX(features.x); | 99 windowRect.setX(features.x); |
100 if (features.ySet) | 100 if (features.ySet) |
101 windowRect.setY(features.y); | 101 windowRect.setY(features.y); |
102 if (features.widthSet) | 102 if (features.widthSet) |
103 windowRect.setWidth(features.width + (windowRect.width() - viewportSize.
width())); | 103 windowRect.setWidth(features.width + (windowRect.width() - viewportSize.
width())); |
104 if (features.heightSet) | 104 if (features.heightSet) |
105 windowRect.setHeight(features.height + (windowRect.height() - viewportSi
ze.height())); | 105 windowRect.setHeight(features.height + (windowRect.height() - viewportSi
ze.height())); |
106 | 106 |
107 // Ensure non-NaN values, minimum size as well as being within valid screen
area. | 107 // Ensure non-NaN values, minimum size as well as being within valid screen
area. |
108 FloatRect newWindowRect = DOMWindow::adjustWindowRect(frame, windowRect); | 108 FloatRect newWindowRect = LocalDOMWindow::adjustWindowRect(frame, windowRect
); |
109 | 109 |
110 host->chrome().setWindowRect(newWindowRect); | 110 host->chrome().setWindowRect(newWindowRect); |
111 host->chrome().show(policy); | 111 host->chrome().show(policy); |
112 | 112 |
113 created = true; | 113 created = true; |
114 return &frame; | 114 return &frame; |
115 } | 115 } |
116 | 116 |
117 LocalFrame* createWindow(const String& urlString, const AtomicString& frameName,
const WindowFeatures& windowFeatures, | 117 LocalFrame* createWindow(const String& urlString, const AtomicString& frameName,
const WindowFeatures& windowFeatures, |
118 DOMWindow& callingWindow, LocalFrame& firstFrame, LocalFrame& openerFrame, D
OMWindow::PrepareDialogFunction function, void* functionContext) | 118 LocalDOMWindow& callingWindow, LocalFrame& firstFrame, LocalFrame& openerFra
me, LocalDOMWindow::PrepareDialogFunction function, void* functionContext) |
119 { | 119 { |
120 LocalFrame* activeFrame = callingWindow.frame(); | 120 LocalFrame* activeFrame = callingWindow.frame(); |
121 ASSERT(activeFrame); | 121 ASSERT(activeFrame); |
122 | 122 |
123 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame.document()->completeURL(urlString); | 123 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame.document()->completeURL(urlString); |
124 if (!completedURL.isEmpty() && !completedURL.isValid()) { | 124 if (!completedURL.isEmpty() && !completedURL.isValid()) { |
125 // Don't expose client code to invalid URLs. | 125 // Don't expose client code to invalid URLs. |
126 callingWindow.printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); | 126 callingWindow.printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); |
127 return 0; | 127 return 0; |
128 } | 128 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 void createWindowForRequest(const FrameLoadRequest& request, LocalFrame& openerF
rame, NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) | 164 void createWindowForRequest(const FrameLoadRequest& request, LocalFrame& openerF
rame, NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) |
165 { | 165 { |
166 if (openerFrame.document()->pageDismissalEventBeingDispatched() != Document:
:NoDismissal) | 166 if (openerFrame.document()->pageDismissalEventBeingDispatched() != Document:
:NoDismissal) |
167 return; | 167 return; |
168 | 168 |
169 if (openerFrame.document() && openerFrame.document()->isSandboxed(SandboxPop
ups)) | 169 if (openerFrame.document() && openerFrame.document()->isSandboxed(SandboxPop
ups)) |
170 return; | 170 return; |
171 | 171 |
172 if (!DOMWindow::allowPopUp(openerFrame)) | 172 if (!LocalDOMWindow::allowPopUp(openerFrame)) |
173 return; | 173 return; |
174 | 174 |
175 if (policy == NavigationPolicyCurrentTab) | 175 if (policy == NavigationPolicyCurrentTab) |
176 policy = NavigationPolicyNewForegroundTab; | 176 policy = NavigationPolicyNewForegroundTab; |
177 | 177 |
178 WindowFeatures features; | 178 WindowFeatures features; |
179 bool created; | 179 bool created; |
180 LocalFrame* newFrame = createWindow(openerFrame, openerFrame, request, featu
res, policy, shouldSendReferrer, created); | 180 LocalFrame* newFrame = createWindow(openerFrame, openerFrame, request, featu
res, policy, shouldSendReferrer, created); |
181 if (!newFrame) | 181 if (!newFrame) |
182 return; | 182 return; |
183 if (shouldSendReferrer == MaybeSendReferrer) { | 183 if (shouldSendReferrer == MaybeSendReferrer) { |
184 newFrame->loader().setOpener(&openerFrame); | 184 newFrame->loader().setOpener(&openerFrame); |
185 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer
Policy()); | 185 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer
Policy()); |
186 } | 186 } |
187 FrameLoadRequest newRequest(0, request.resourceRequest()); | 187 FrameLoadRequest newRequest(0, request.resourceRequest()); |
188 newRequest.setFormState(request.formState()); | 188 newRequest.setFormState(request.formState()); |
189 newFrame->loader().load(newRequest); | 189 newFrame->loader().load(newRequest); |
190 } | 190 } |
191 | 191 |
192 } // namespace WebCore | 192 } // namespace WebCore |
OLD | NEW |