Changeset 17236 in webkit
- Timestamp:
- Oct 23, 2006 8:18:28 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r17234 r17236 1 2006-10-23 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Bradee. 4 5 Shrunk BrowserExtension in preparation for its imminent death, moving page- 6 level operations to Page and frame-level operations to Frame. 7 8 Removed bizarre Mac(this) syntax inside virtual FrameMac member functions, 9 because 'this' is guaranteed by the compiler to be a FrameMac*. 10 11 * bindings/js/kjs_window.cpp: Added NULL checks for m_frame in places 12 where it can be NULL. 13 * bindings/js/kjs_window.cpp: 14 (KJS::canShowModalDialog): 15 (KJS::canShowModalDialogNow): 16 (KJS::showModalDialog): 17 (KJS::History::getValueProperty): 18 (KJS::HistoryFunc::callAsFunction): 19 * bridge/BrowserExtension.h: 20 (WebCore::BrowserExtension::~BrowserExtension): 21 * bridge/mac/BrowserExtensionMac.h: 22 * bridge/mac/BrowserExtensionMac.mm: 23 (WebCore::BrowserExtensionMac::createNewWindow): 24 * bridge/mac/FrameMac.h: 25 * bridge/mac/FrameMac.mm: 26 (WebCore::FrameMac::frameDetached): 27 (WebCore::FrameMac::unfocusWindow): 28 (WebCore::FrameMac::bridgeForWidget): 29 (WebCore::FrameMac::documentViewForNode): 30 (WebCore::FrameMac::passSubframeEventToSubframe): 31 (WebCore::Frame::setNeedsReapplyStyles): 32 (WebCore::FrameMac::customHighlightLineRect): 33 (WebCore::FrameMac::paintCustomHighlight): 34 (WebCore::FrameMac::getHistoryLength): 35 (WebCore::FrameMac::goBackOrForward): 36 (WebCore::FrameMac::historyURL): 37 * bridge/mac/PageMac.mm: 38 (WebCore::Page::canRunModal): 39 (WebCore::Page::canRunModalNow): 40 (WebCore::Page::runModal): 41 * bridge/mac/WebCoreFrameBridge.h: 42 * bridge/mac/WebCorePageBridge.h: 43 * bridge/win/BrowserExtensionWin.h: 44 * page/Frame.cpp: 45 (WebCore::Frame::scheduleHistoryNavigation): 46 (WebCore::Frame::redirectionTimerFired): 47 * page/Frame.h: 48 * page/Page.h: 49 1 50 2006-10-23 Justin Garcia <justin.garcia@apple.com> 2 51 -
trunk/WebCore/bindings/js/kjs_window.cpp
r17173 r17236 597 597 static bool canShowModalDialog(const Window *window) 598 598 { 599 Frame *frame = window->frame(); 600 return frame && static_cast<BrowserExtension *>(frame->browserExtension())->canRunModal(); 599 if (Frame* frame = window->frame()) 600 return frame->page()->canRunModal(); 601 return false; 601 602 } 602 603 603 604 static bool canShowModalDialogNow(const Window *window) 604 605 { 605 Frame *frame = window->frame(); 606 return frame && static_cast<BrowserExtension *>(frame->browserExtension())->canRunModalNow(); 606 if (Frame* frame = window->frame()) 607 return frame->page()->canRunModalNow(); 608 return false; 607 609 } 608 610 … … 670 672 JSValue* returnValue = 0; 671 673 dialogWindow->setReturnValueSlot(&returnValue); 672 static_cast<BrowserExtension *>(dialogFrame->browserExtension())->runModal();674 dialogFrame->page()->runModal(); 673 675 dialogWindow->setReturnValueSlot(0); 674 676 … … 2456 2458 { 2457 2459 ASSERT(token == Length); 2458 BrowserExtension *ext = m_frame->browserExtension(); 2459 if (!ext) 2460 return jsNumber(0); 2461 2462 return jsNumber(ext->getHistoryLength()); 2460 return m_frame ? jsNumber(m_frame->getHistoryLength()) : jsNumber(0); 2463 2461 } 2464 2462 … … 2489 2487 } 2490 2488 2491 history->m_frame->scheduleHistoryNavigation(steps); 2489 if (Frame* frame = history->m_frame) 2490 frame->scheduleHistoryNavigation(steps); 2492 2491 return jsUndefined(); 2493 2492 } -
trunk/WebCore/bridge/BrowserExtension.h
r17102 r17236 37 37 public: 38 38 virtual ~BrowserExtension() { } 39 40 39 virtual void createNewWindow(const FrameLoadRequest&, const WindowFeatures&, Frame*& newFrame) = 0; 41 42 virtual int getHistoryLength() = 0;43 virtual void goBackOrForward(int distance) = 0;44 virtual KURL historyURL(int distance) = 0;45 46 virtual bool canRunModal() = 0;47 virtual bool canRunModalNow() = 0;48 virtual void runModal() = 0;49 50 40 protected: 51 41 BrowserExtension() {} -
trunk/WebCore/bridge/mac/BrowserExtensionMac.h
r17102 r17236 34 34 public: 35 35 BrowserExtensionMac(Frame*); 36 37 36 virtual void createNewWindow(const FrameLoadRequest&, const WindowFeatures&, Frame*& newFrame); 38 39 virtual int getHistoryLength();40 virtual void goBackOrForward(int distance);41 virtual KURL historyURL(int distance);42 43 virtual bool canRunModal();44 virtual bool canRunModalNow();45 virtual void runModal();46 47 37 private: 48 38 FrameMac* m_frame; -
trunk/WebCore/bridge/mac/BrowserExtensionMac.mm
r17144 r17236 90 90 WebCorePageBridge *pageBridge; 91 91 if (windowFeatures.dialog) 92 pageBridge = [m_frame-> bridge() createModalDialogWithURL:url.getNSURL()];92 pageBridge = [m_frame->page()->bridge() createModalDialogWithURL:url.getNSURL() referrer:m_frame->referrer()]; 93 93 else 94 94 pageBridge = [m_frame->bridge() createWindowWithURL:url.getNSURL()]; … … 128 128 } 129 129 130 int BrowserExtensionMac::getHistoryLength()131 {132 return [m_frame->bridge() historyLength];133 130 } 134 135 void BrowserExtensionMac::goBackOrForward(int distance)136 {137 BEGIN_BLOCK_OBJC_EXCEPTIONS;138 [m_frame->bridge() goBackOrForward:distance];139 END_BLOCK_OBJC_EXCEPTIONS;140 }141 142 KURL BrowserExtensionMac::historyURL(int distance)143 {144 BEGIN_BLOCK_OBJC_EXCEPTIONS;145 return KURL([m_frame->bridge() historyURL:distance]);146 END_BLOCK_OBJC_EXCEPTIONS;147 return KURL();148 }149 150 bool BrowserExtensionMac::canRunModal()151 {152 BEGIN_BLOCK_OBJC_EXCEPTIONS;153 return [m_frame->bridge() canRunModal];154 END_BLOCK_OBJC_EXCEPTIONS;155 return false;156 }157 158 bool BrowserExtensionMac::canRunModalNow()159 {160 BEGIN_BLOCK_OBJC_EXCEPTIONS;161 return [m_frame->bridge() canRunModalNow];162 END_BLOCK_OBJC_EXCEPTIONS;163 return false;164 }165 166 void BrowserExtensionMac::runModal()167 {168 BEGIN_BLOCK_OBJC_EXCEPTIONS;169 [m_frame->bridge() runModal];170 END_BLOCK_OBJC_EXCEPTIONS;171 }172 173 } -
trunk/WebCore/bridge/mac/FrameMac.h
r17226 r17236 304 304 virtual Range* markedTextRange() const { return m_markedTextRange.get(); } 305 305 306 virtual bool canGoBackOrForward(int distance) const;307 308 306 virtual void didFirstLayout(); 309 307 … … 329 327 NSEvent* currentEvent() { return _currentEvent; } 330 328 virtual KURL originalRequestURL() const; 331 329 330 virtual bool canGoBackOrForward(int distance) const; 331 virtual void goBackOrForward(int distance); 332 virtual int getHistoryLength(); 333 virtual KURL historyURL(int distance); 334 332 335 protected: 333 336 virtual void startRedirectionTimer(); -
trunk/WebCore/bridge/mac/FrameMac.mm
r17226 r17236 376 376 377 377 BEGIN_BLOCK_OBJC_EXCEPTIONS; 378 [ Mac(this)->bridge()frameDetached];378 [_bridge frameDetached]; 379 379 END_BLOCK_OBJC_EXCEPTIONS; 380 380 } … … 627 627 FrameMac* parentFrame = static_cast<FrameMac*>(tree()->parent()); 628 628 NSView* parentView = parentFrame->d->m_view->getDocumentView(); 629 [parentFrame-> bridge()makeFirstResponder:parentView];629 [parentFrame->_bridge makeFirstResponder:parentView]; 630 630 } 631 631 } … … 1182 1182 FrameMac *frame = Mac(frameForWidget(widget)); 1183 1183 ASSERT(frame); 1184 return frame-> bridge();1184 return frame->_bridge; 1185 1185 } 1186 1186 1187 1187 NSView *FrameMac::documentViewForNode(Node *node) 1188 1188 { 1189 WebCoreFrameBridge *bridge = Mac(frameForNode(node))-> bridge();1189 WebCoreFrameBridge *bridge = Mac(frameForNode(node))->_bridge; 1190 1190 return [bridge documentView]; 1191 1191 } … … 1860 1860 case NSMouseMoved: { 1861 1861 ASSERT(subframePart); 1862 [Mac(subframePart)-> bridge()mouseMoved:_currentEvent];1862 [Mac(subframePart)->_bridge mouseMoved:_currentEvent]; 1863 1863 return true; 1864 1864 } … … 3513 3513 void Frame::setNeedsReapplyStyles() 3514 3514 { 3515 [Mac(this)-> bridge()setNeedsReapplyStyles];3515 [Mac(this)->_bridge setNeedsReapplyStyles]; 3516 3516 } 3517 3517 3518 3518 FloatRect FrameMac::customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect) 3519 3519 { 3520 return [ bridge()customHighlightRect:type forLine:lineRect];3520 return [_bridge customHighlightRect:type forLine:lineRect]; 3521 3521 } 3522 3522 3523 3523 void FrameMac::paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line) 3524 3524 { 3525 [ bridge()paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text entireLine:line];3525 [_bridge paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text entireLine:line]; 3526 3526 } 3527 3527 … … 3536 3536 } 3537 3537 3538 } 3538 int FrameMac::getHistoryLength() 3539 { 3540 return [_bridge historyLength]; 3541 } 3542 3543 void FrameMac::goBackOrForward(int distance) 3544 { 3545 BEGIN_BLOCK_OBJC_EXCEPTIONS; 3546 [_bridge goBackOrForward:distance]; 3547 END_BLOCK_OBJC_EXCEPTIONS; 3548 } 3549 3550 KURL FrameMac::historyURL(int distance) 3551 { 3552 BEGIN_BLOCK_OBJC_EXCEPTIONS; 3553 return KURL([_bridge historyURL:distance]); 3554 END_BLOCK_OBJC_EXCEPTIONS; 3555 return KURL(); 3556 } 3557 3558 } // namespace WebCore -
trunk/WebCore/bridge/mac/PageMac.mm
r16237 r17236 22 22 #import "Page.h" 23 23 24 #import "BlockExceptions.h" 24 25 #import "Frame.h" 25 26 #import "FloatRect.h" … … 51 52 } 52 53 54 bool Page::canRunModal() 55 { 56 BEGIN_BLOCK_OBJC_EXCEPTIONS; 57 return [bridge() canRunModal]; 58 END_BLOCK_OBJC_EXCEPTIONS; 59 return false; 53 60 } 61 62 bool Page::canRunModalNow() 63 { 64 BEGIN_BLOCK_OBJC_EXCEPTIONS; 65 return [bridge() canRunModalNow]; 66 END_BLOCK_OBJC_EXCEPTIONS; 67 return false; 68 } 69 70 void Page::runModal() 71 { 72 BEGIN_BLOCK_OBJC_EXCEPTIONS; 73 [bridge() runModal]; 74 END_BLOCK_OBJC_EXCEPTIONS; 75 } 76 77 } // namespace WebCore -
trunk/WebCore/bridge/mac/WebCoreFrameBridge.h
r17179 r17236 558 558 - (void)showWindow; 559 559 560 - (BOOL)canRunModal;561 - (BOOL)canRunModalNow;562 - (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL;563 - (void)runModal;564 565 560 - (NSString *)userAgentForURL:(NSURL *)URL; 566 561 -
trunk/WebCore/bridge/mac/WebCorePageBridge.h
r15438 r17236 69 69 - (NSRect)windowFrame; 70 70 71 - (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL referrer:(NSString *)referrer; 72 73 - (BOOL)canRunModal; 74 - (BOOL)canRunModalNow; 75 - (void)runModal; 71 76 @end 72 77 -
trunk/WebCore/bridge/win/BrowserExtensionWin.h
r17116 r17236 35 35 public: 36 36 BrowserExtensionWin(FrameWin*); 37 38 37 virtual void createNewWindow(const FrameLoadRequest&, const WindowFeatures&, Frame*& newFrame); 39 40 virtual int getHistoryLength();41 virtual void goBackOrForward(int distance);42 virtual KURL historyURL(int distance);43 44 virtual bool canRunModal();45 virtual bool canRunModalNow();46 virtual void runModal();47 48 38 private: 49 39 FrameWin* m_frame; -
trunk/WebCore/page/Frame.cpp
r17234 r17236 1065 1065 // fragment part, we don't need to schedule the navigation. 1066 1066 if (d->m_extension) { 1067 KURL u = d->m_extension->historyURL(steps);1067 KURL u = historyURL(steps); 1068 1068 1069 1069 if (equalIgnoringRef(d->m_url, u)) { 1070 d->m_extension->goBackOrForward(steps);1070 goBackOrForward(steps); 1071 1071 return; 1072 1072 } … … 1125 1125 else { 1126 1126 if (d->m_extension) { 1127 d->m_extension->goBackOrForward(d->m_scheduledHistoryNavigationSteps);1127 goBackOrForward(d->m_scheduledHistoryNavigationSteps); 1128 1128 } 1129 1129 } -
trunk/WebCore/page/Frame.h
r17234 r17236 198 198 */ 199 199 void scheduleHistoryNavigation(int steps); 200 201 virtual bool canGoBackOrForward(int distance) const = 0; 202 virtual void goBackOrForward(int distance) = 0; 203 virtual int getHistoryLength() = 0; 204 virtual KURL historyURL(int distance) = 0; 200 205 201 206 /** … … 584 589 virtual void saveDocumentState() = 0; 585 590 virtual void restoreDocumentState() = 0; 586 virtual bool canGoBackOrForward(int distance) const = 0;587 591 virtual void openURLRequest(const FrameLoadRequest&) = 0; 588 592 virtual void submitForm(const FrameLoadRequest&) = 0; -
trunk/WebCore/page/Page.h
r16515 r17236 72 72 SelectionController* dragCaretController() const; 73 73 74 bool canRunModal(); 75 bool canRunModalNow(); 76 void runModal(); 77 74 78 #if PLATFORM(MAC) 75 79 Page(WebCorePageBridge*); -
trunk/WebKit/ChangeLog
r17233 r17236 1 2006-10-23 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Bradee. 4 5 Moved some page-level operations from WebFrameBridge to WebPageBridge. 6 7 * WebCoreSupport/WebFrameBridge.m: 8 * WebCoreSupport/WebPageBridge.m: 9 (-[WebPageBridge createModalDialogWithURL:referrer:]): 10 (-[WebPageBridge canRunModal]): 11 (-[WebPageBridge canRunModalNow]): 12 (-[WebPageBridge runModal]): 13 * WebKit.xcodeproj/project.pbxproj: Made WebPageBridge.m ObjC++ to support 14 WebCore #includes. 15 1 16 2006-10-23 John Sullivan <sullivan@apple.com> 2 17 -
trunk/WebKit/WebCoreSupport/WebPageBridge.m
r15089 r17236 29 29 #import "WebPageBridge.h" 30 30 31 #import "WebDefaultUIDelegate.h" 31 32 #import "WebFrameBridge.h" 32 33 #import "WebFrameView.h" 34 #import "WebNSURLExtras.h" 35 #import "WebNSURLRequestExtras.h" 36 #import "WebUIDelegate.h" 33 37 #import "WebView.h" 34 38 #import "WebViewInternal.h" 35 39 #import <JavaScriptCore/Assertions.h> 36 #import "WebUIDelegate.h" 40 #import <WebCore/WebCoreFrameNamespaces.h> 41 #import <WebCore/WebLoader.h> 42 43 using namespace WebCore; 37 44 38 45 @implementation WebPageBridge … … 72 79 } 73 80 81 - (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL referrer:(NSString *)referrer 82 { 83 ASSERT(_webView != nil); 84 85 NSMutableURLRequest *request = nil; 86 87 if (URL != nil && ![URL _web_isEmpty]) { 88 request = [NSMutableURLRequest requestWithURL:URL]; 89 [request _web_setHTTPReferrer:referrer]; 90 } 91 92 id UIDelegate = [_webView UIDelegate]; 93 94 WebView *newWebView = nil; 95 if ([UIDelegate respondsToSelector:@selector(webView:createWebViewModalDialogWithRequest:)]) 96 newWebView = [UIDelegate webView:_webView createWebViewModalDialogWithRequest:request]; 97 else if ([UIDelegate respondsToSelector:@selector(webView:createWebViewWithRequest:)]) 98 newWebView = [UIDelegate webView:_webView createWebViewWithRequest:request]; 99 else 100 newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:_webView createWebViewWithRequest:request]; 101 102 return [newWebView _pageBridge]; 103 } 104 105 - (BOOL)canRunModal 106 { 107 return [[_webView UIDelegate] respondsToSelector:@selector(webViewRunModal:)]; 108 } 109 110 - (BOOL)canRunModalNow 111 { 112 return [self canRunModal] && !WebResourceLoader::inConnectionCallback(); 113 } 114 115 - (void)runModal 116 { 117 if (![self canRunModal]) 118 return; 119 120 if ([_webView defersCallbacks]) { 121 LOG_ERROR("tried to run modal in a view when it was deferring callbacks -- should never happen"); 122 return; 123 } 124 125 // Defer callbacks in all the other views in this group, so we don't try to run JavaScript 126 // in a way that could interact with this view. 127 NSMutableArray *deferredWebViews = [NSMutableArray array]; 128 NSString *groupName = [_webView groupName]; 129 if (groupName) { 130 NSEnumerator *enumerator = [WebCoreFrameNamespaces framesInNamespace:groupName]; 131 WebView *otherWebView; 132 while ((otherWebView = [[enumerator nextObject] webView]) != nil) { 133 if (otherWebView != _webView && ![otherWebView defersCallbacks]) { 134 [otherWebView setDefersCallbacks:YES]; 135 [deferredWebViews addObject:otherWebView]; 136 } 137 } 138 } 139 140 // Go run the modal event loop. 141 [[_webView UIDelegate] webViewRunModal:_webView]; 142 143 // Restore the callbacks for any views that we deferred them for. 144 unsigned count = [deferredWebViews count]; 145 unsigned i; 146 for (i = 0; i < count; ++i) { 147 WebView *otherWebView = [deferredWebViews objectAtIndex:i]; 148 [otherWebView setDefersCallbacks:NO]; 149 } 150 } 151 74 152 @end -
trunk/WebKit/WebKit.xcodeproj/project.pbxproj
r17231 r17236 377 377 65A7D44A0568AB2600E70EF6 /* WebUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebUIDelegatePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 378 378 65C7F42A0979DE640022E453 /* WebPageBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPageBridge.h; sourceTree = "<group>"; }; 379 65C7F42B0979DE640022E453 /* WebPageBridge.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebPageBridge.m; sourceTree = "<group>"; };379 65C7F42B0979DE640022E453 /* WebPageBridge.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebPageBridge.m; sourceTree = "<group>"; }; 380 380 65DA2608052CC18700A97B31 /* WebHistory.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebHistory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 381 381 65E0F88208500917007E5CB9 /* WebNSURLRequestExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSURLRequestExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 1217 1217 isa = PBXProject; 1218 1218 buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */; 1219 compatibilityVersion = "Xcode 2.4";1220 1219 hasScannedForEncodings = 1; 1221 1220 knownRegions = ( … … 1232 1231 projectDirPath = ""; 1233 1232 projectRoot = ""; 1234 shouldCheckCompatibility = 1;1235 1233 targets = ( 1236 1234 9398100A0824BF01008DF038 /* WebKit */,
Note: See TracChangeset
for help on using the changeset viewer.