Changeset 65164 in webkit
- Timestamp:
- Aug 11, 2010 10:40:23 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65156 r65164 1 2010-08-11 Chris Jerdonek <cjerdonek@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Refactored FrameLoader::createWindow() out of the FrameLoader class 6 since FrameLoader should not be responsible for creating windows. 7 8 https://bugs.webkit.org/show_bug.cgi?id=39156 9 10 No new functionality, so no new tests. 11 12 * bindings/generic/BindingDOMWindow.h: 13 (WebCore::::createWindow): 14 - Updated the call to FrameLoader's createWindow(). 15 * bindings/js/JSDOMWindowCustom.cpp: 16 (WebCore::createWindow): 17 - Updated the call to FrameLoader's createWindow(). 18 * loader/FrameLoader.cpp: 19 (WebCore::createWindowFromFrameLoader): 20 - Made FrameLoader::createWindow() non-member, non-friend and changed it 21 to accept Frame* parameters instead of FrameLoader*. 22 * loader/FrameLoader.h: 23 - Updated the header file to reflect the above change to FrameLoader.cpp. 24 1 25 2010-08-11 Ilya Tikhonovsky <loislo@chromium.org> 2 26 -
trunk/WebCore/bindings/generic/BindingDOMWindow.h
r64991 r65164 109 109 110 110 bool created; 111 // We pass in the opener frame here so it can be used for looking up the 112 // frame name, in case the active frame is different from the opener frame, 113 // and the name references a frame relative to the opener frame, for example 114 // "_self" or "_parent". 115 Frame* newFrame = callingFrame->loader()->createWindow(openerFrame->loader(), frameRequest, windowFeatures, created); 111 // We pass the opener frame for the lookupFrame in case the active frame is different from 112 // the opener frame, and the name references a frame relative to the opener frame. 113 Frame* newFrame = WebCore::createWindow(callingFrame, openerFrame, frameRequest, windowFeatures, created); 116 114 if (!newFrame) 117 115 return 0; -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r65082 r65164 725 725 726 726 bool created; 727 // We pass in the opener frame here so it can be used for looking up the frame name, in case the active frame 728 // is different from the opener frame, and the name references a frame relative to the opener frame, for example 729 // "_self" or "_parent". 730 Frame* newFrame = lexicalFrame->loader()->createWindow(openerFrame->loader(), frameRequest, windowFeatures, created); 727 // We pass the opener frame for the lookupFrame in case the active frame is different from 728 // the opener frame, and the name references a frame relative to the opener frame. 729 Frame* newFrame = createWindow(lexicalFrame, openerFrame, frameRequest, windowFeatures, created); 731 730 if (!newFrame) 732 731 return 0; -
trunk/WebCore/loader/FrameLoader.cpp
r65082 r65164 259 259 } 260 260 261 Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest& request, const WindowFeatures& features, bool& created)262 {263 ASSERT(!features.dialog || request.frameName().isEmpty());264 265 if (!request.frameName().isEmpty() && request.frameName() != "_blank") {266 Frame* frame = frameLoaderForFrameLookup->frame()->tree()->find(request.frameName());267 if (frame && shouldAllowNavigation(frame)) {268 if (!request.resourceRequest().url().isEmpty())269 frame->loader()->loadFrameRequest(request, false, false, 0, 0, SendReferrer);270 if (Page* page = frame->page())271 page->chrome()->focus();272 created = false;273 return frame;274 }275 }276 277 // Sandboxed frames cannot open new auxiliary browsing contexts.278 if (isDocumentSandboxed(m_frame, SandboxNavigation))279 return 0;280 281 // FIXME: Setting the referrer should be the caller's responsibility.282 FrameLoadRequest requestWithReferrer = request;283 requestWithReferrer.resourceRequest().setHTTPReferrer(m_outgoingReferrer);284 addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), outgoingOrigin());285 286 Page* oldPage = m_frame->page();287 if (!oldPage)288 return 0;289 290 Page* page = oldPage->chrome()->createWindow(m_frame, requestWithReferrer, features);291 if (!page)292 return 0;293 294 Frame* frame = page->mainFrame();295 if (request.frameName() != "_blank")296 frame->tree()->setName(request.frameName());297 298 page->chrome()->setToolbarsVisible(features.toolBarVisible || features.locationBarVisible);299 page->chrome()->setStatusbarVisible(features.statusBarVisible);300 page->chrome()->setScrollbarsVisible(features.scrollbarsVisible);301 page->chrome()->setMenubarVisible(features.menuBarVisible);302 page->chrome()->setResizable(features.resizable);303 304 // 'x' and 'y' specify the location of the window, while 'width' and 'height'305 // specify the size of the page. We can only resize the window, so306 // adjust for the difference between the window size and the page size.307 308 FloatRect windowRect = page->chrome()->windowRect();309 FloatSize pageSize = page->chrome()->pageRect().size();310 if (features.xSet)311 windowRect.setX(features.x);312 if (features.ySet)313 windowRect.setY(features.y);314 if (features.widthSet)315 windowRect.setWidth(features.width + (windowRect.width() - pageSize.width()));316 if (features.heightSet)317 windowRect.setHeight(features.height + (windowRect.height() - pageSize.height()));318 page->chrome()->setWindowRect(windowRect);319 320 page->chrome()->show();321 322 created = true;323 return frame;324 }325 326 261 bool FrameLoader::canHandleRequest(const ResourceRequest& request) 327 262 { … … 3509 3444 } 3510 3445 3446 Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest& request, const WindowFeatures& features, bool& created) 3447 { 3448 ASSERT(!features.dialog || request.frameName().isEmpty()); 3449 3450 if (!request.frameName().isEmpty() && request.frameName() != "_blank") { 3451 Frame* frame = lookupFrame->tree()->find(request.frameName()); 3452 if (frame && openerFrame->loader()->shouldAllowNavigation(frame)) { 3453 if (!request.resourceRequest().url().isEmpty()) 3454 frame->loader()->loadFrameRequest(request, false, false, 0, 0, SendReferrer); 3455 if (Page* page = frame->page()) 3456 page->chrome()->focus(); 3457 created = false; 3458 return frame; 3459 } 3460 } 3461 3462 // Sandboxed frames cannot open new auxiliary browsing contexts. 3463 if (isDocumentSandboxed(openerFrame, SandboxNavigation)) 3464 return 0; 3465 3466 // FIXME: Setting the referrer should be the caller's responsibility. 3467 FrameLoadRequest requestWithReferrer = request; 3468 requestWithReferrer.resourceRequest().setHTTPReferrer(openerFrame->loader()->outgoingReferrer()); 3469 FrameLoader::addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), openerFrame->loader()->outgoingOrigin()); 3470 3471 Page* oldPage = openerFrame->page(); 3472 if (!oldPage) 3473 return 0; 3474 3475 Page* page = oldPage->chrome()->createWindow(openerFrame, requestWithReferrer, features); 3476 if (!page) 3477 return 0; 3478 3479 Frame* frame = page->mainFrame(); 3480 if (request.frameName() != "_blank") 3481 frame->tree()->setName(request.frameName()); 3482 3483 page->chrome()->setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); 3484 page->chrome()->setStatusbarVisible(features.statusBarVisible); 3485 page->chrome()->setScrollbarsVisible(features.scrollbarsVisible); 3486 page->chrome()->setMenubarVisible(features.menuBarVisible); 3487 page->chrome()->setResizable(features.resizable); 3488 3489 // 'x' and 'y' specify the location of the window, while 'width' and 'height' 3490 // specify the size of the page. We can only resize the window, so 3491 // adjust for the difference between the window size and the page size. 3492 3493 FloatRect windowRect = page->chrome()->windowRect(); 3494 FloatSize pageSize = page->chrome()->pageRect().size(); 3495 if (features.xSet) 3496 windowRect.setX(features.x); 3497 if (features.ySet) 3498 windowRect.setY(features.y); 3499 if (features.widthSet) 3500 windowRect.setWidth(features.width + (windowRect.width() - pageSize.width())); 3501 if (features.heightSet) 3502 windowRect.setHeight(features.height + (windowRect.height() - pageSize.height())); 3503 page->chrome()->setWindowRect(windowRect); 3504 3505 page->chrome()->show(); 3506 3507 created = true; 3508 return frame; 3509 } 3510 3511 3511 } // namespace WebCore -
trunk/WebCore/loader/FrameLoader.h
r63689 r65164 121 121 static void reportLocalLoadFailed(Frame*, const String& url); 122 122 123 // Called by createWindow in JSDOMWindowBase.cpp, e.g. to fulfill a modal dialog creation124 // FIXME: Move this method outside of the FrameLoader class.125 Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest&, const WindowFeatures&, bool& created);126 127 123 unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data); 128 124 … … 502 498 }; 503 499 500 // This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for 501 // modal dialog creation. The lookupFrame is for looking up the frame name in case 502 // the frame name references a frame different from the openerFrame, e.g. when it is 503 // "_self" or "_parent". 504 // 505 // FIXME: Consider making this function part of an appropriate class (not FrameLoader) 506 // and moving it to a more appropriate location. 507 Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest&, const WindowFeatures&, bool& created); 508 504 509 } // namespace WebCore 505 510
Note: See TracChangeset
for help on using the changeset viewer.