[webkit-changes] cvs commit: WebKit/WebView.subproj
WebControllerSets.h WebControllerSets.m WebView.m WebViewInternal.h
Maciej
mjs at opensource.apple.com
Thu Dec 8 10:33:58 PST 2005
mjs 05/12/08 10:33:57
Modified: . ChangeLog
WebCoreSupport.subproj WebBridge.m WebViewFactory.m
WebView.subproj WebControllerSets.h WebControllerSets.m
WebView.m WebViewInternal.h
Log:
Reviewed by John.
- some small changes towards frame tree refactoring
Renamed WebViewSets to WebFrameNamespaces, and put the method for
performing a selector on all extant WebViews to WebView itself,
with a separate set tracking live WebViews. This should allow
moving the storage of this info down to WebCore more easily.
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge closeWindowSoon]):
(-[WebBridge runModal]):
* WebCoreSupport.subproj/WebViewFactory.m:
(-[WebViewFactory refreshPlugins:]):
* WebView.subproj/WebControllerSets.h:
* WebView.subproj/WebControllerSets.m:
(+[WebFrameNamespaces addWebView:toFrameNamespace:]):
(webView::if):
(+[WebFrameNamespaces webViewsInFrameNamespace:]):
* WebView.subproj/WebView.m:
(+[WebView _makeAllWebViewsPerformSelector:]):
(-[WebView _removeFromAllWebViewsSet]):
(-[WebView _addToAllWebViewsSet]):
(-[WebView _close]):
(-[WebView _findFrameNamed:sourceFrame:]):
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView setGroupName:]):
* WebView.subproj/WebViewInternal.h:
Revision Changes Path
1.3389 +31 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3388
retrieving revision 1.3389
diff -u -r1.3388 -r1.3389
--- ChangeLog 8 Dec 2005 08:40:29 -0000 1.3388
+++ ChangeLog 8 Dec 2005 18:33:46 -0000 1.3389
@@ -1,3 +1,34 @@
+2005-12-08 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by John.
+
+ - some small changes towards frame tree refactoring
+
+ Renamed WebViewSets to WebFrameNamespaces, and put the method for
+ performing a selector on all extant WebViews to WebView itself,
+ with a separate set tracking live WebViews. This should allow
+ moving the storage of this info down to WebCore more easily.
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge closeWindowSoon]):
+ (-[WebBridge runModal]):
+ * WebCoreSupport.subproj/WebViewFactory.m:
+ (-[WebViewFactory refreshPlugins:]):
+ * WebView.subproj/WebControllerSets.h:
+ * WebView.subproj/WebControllerSets.m:
+ (+[WebFrameNamespaces addWebView:toFrameNamespace:]):
+ (webView::if):
+ (+[WebFrameNamespaces webViewsInFrameNamespace:]):
+ * WebView.subproj/WebView.m:
+ (+[WebView _makeAllWebViewsPerformSelector:]):
+ (-[WebView _removeFromAllWebViewsSet]):
+ (-[WebView _addToAllWebViewsSet]):
+ (-[WebView _close]):
+ (-[WebView _findFrameNamed:sourceFrame:]):
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView setGroupName:]):
+ * WebView.subproj/WebViewInternal.h:
+
2005-12-08 Darin Adler <darin at apple.com>
Reviewed by Eric.
1.375 +2 -2 WebKit/WebCoreSupport.subproj/WebBridge.m
Index: WebBridge.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
retrieving revision 1.374
retrieving revision 1.375
diff -u -r1.374 -r1.375
--- WebBridge.m 19 Nov 2005 01:27:04 -0000 1.374
+++ WebBridge.m 8 Dec 2005 18:33:55 -0000 1.375
@@ -362,7 +362,7 @@
// This approach is an inherent limitation of not making a close execute immediately
// after a call to window.close.
- [WebViewSets removeWebView:parentWebView fromSetNamed:[parentWebView groupName]];
+ [WebFrameNamespaces removeWebView:parentWebView fromFrameNamespace:[parentWebView groupName]];
[parentWebView stopLoading:self];
@@ -1718,7 +1718,7 @@
NSMutableArray *deferredWebViews = [NSMutableArray array];
NSString *setName = [webView groupName];
if (setName) {
- NSEnumerator *enumerator = [WebViewSets webViewsInSetNamed:setName];
+ NSEnumerator *enumerator = [WebFrameNamespaces webViewsInFrameNamespace:setName];
WebView *otherWebView;
while ((otherWebView = [enumerator nextObject]) != nil) {
if (otherWebView != webView && ![otherWebView defersCallbacks]) {
1.38 +2 -2 WebKit/WebCoreSupport.subproj/WebViewFactory.m
Index: WebViewFactory.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebViewFactory.m,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- WebViewFactory.m 16 Aug 2005 19:03:31 -0000 1.37
+++ WebViewFactory.m 8 Dec 2005 18:33:55 -0000 1.38
@@ -30,7 +30,7 @@
#import <WebKit/WebAssertions.h>
#import <WebKit/WebBridge.h>
-#import <WebKit/WebControllerSets.h>
+#import <WebKit/WebViewInternal.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebLocalizableStrings.h>
#import <WebKit/WebNSUserDefaultsExtras.h>
@@ -74,7 +74,7 @@
{
[[WebPluginDatabase installedPlugins] refresh];
if (reloadPages) {
- [WebViewSets makeWebViewsPerformSelector:@selector(_reloadForPluginChanges)];
+ [WebView _makeAllWebViewsPerformSelector:@selector(_reloadForPluginChanges)];
}
}
1.7 +4 -8 WebKit/WebView.subproj/WebControllerSets.h
Index: WebControllerSets.h
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebControllerSets.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WebControllerSets.h 5 Jun 2005 17:54:45 -0000 1.6
+++ WebControllerSets.h 8 Dec 2005 18:33:56 -0000 1.7
@@ -30,12 +30,8 @@
@class WebView;
- at interface WebViewSets : NSObject
-+ (void)addWebView:(WebView *)webView toSetNamed:(NSString *)name;
-+ (void)removeWebView:(WebView *)webView fromSetNamed:(NSString *)name;
-+ (NSEnumerator *)webViewsInSetNamed:(NSString *)name;
-+ (void)makeWebViewsPerformSelector:(SEL)selector;
+ at interface WebFrameNamespaces : NSObject
++ (void)addWebView:(WebView *)webView toFrameNamespace:(NSString *)name;
++ (void)removeWebView:(WebView *)webView fromFrameNamespace:(NSString *)name;
++ (NSEnumerator *)webViewsInFrameNamespace:(NSString *)name;
@end
-
-
-
1.6 +21 -34 WebKit/WebView.subproj/WebControllerSets.m
Index: WebControllerSets.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebControllerSets.m,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebControllerSets.m 5 Jun 2005 17:54:46 -0000 1.5
+++ WebControllerSets.m 8 Dec 2005 18:33:56 -0000 1.6
@@ -37,65 +37,52 @@
CFHash
};
- at implementation WebViewSets
+ at implementation WebFrameNamespaces
-NSMutableDictionary *sets = nil;
+NSMutableDictionary *namespaces = nil;
-+(void)addWebView:(WebView *)webView toSetNamed: (NSString *)name
++(void)addWebView:(WebView *)webView toFrameNamespace:(NSString *)name
{
- if (sets == nil) {
- sets = [[NSMutableDictionary alloc] init];
+ if (namespaces == nil) {
+ namespaces = [[NSMutableDictionary alloc] init];
}
- CFMutableSetRef set = (CFMutableSetRef)[sets objectForKey:name];
+ CFMutableSetRef namespace = (CFMutableSetRef)[namespaces objectForKey:name];
- if (set == NULL) {
- set = CFSetCreateMutable(NULL, 0, &NonRetainingSetCallbacks);
- [sets setObject:(id)set forKey:name];
- CFRelease(set);
+ if (namespace == NULL) {
+ namespace = CFSetCreateMutable(NULL, 0, &NonRetainingSetCallbacks);
+ [namespaces setObject:(id)namespace forKey:name];
+ CFRelease(namespace);
}
- CFSetSetValue(set, webView);
+ CFSetSetValue(namespace, webView);
}
-+(void)removeWebView:(WebView *)webView fromSetNamed: (NSString *)name
++(void)removeWebView:(WebView *)webView fromFrameNamespace:(NSString *)name
{
- CFMutableSetRef set = (CFMutableSetRef)[sets objectForKey:name];
+ CFMutableSetRef namespace = (CFMutableSetRef)[namespaces objectForKey:name];
- if (set == NULL) {
+ if (namespace == NULL) {
return;
}
- CFSetRemoveValue(set, webView);
+ CFSetRemoveValue(namespace, webView);
- if (CFSetGetCount(set) == 0) {
- [sets removeObjectForKey:name];
+ if (CFSetGetCount(namespace) == 0) {
+ [namespaces removeObjectForKey:name];
}
}
-
-+(NSEnumerator *)webViewsInSetNamed:(NSString *)name;
++(NSEnumerator *)webViewsInFrameNamespace:(NSString *)name;
{
- CFMutableSetRef set = (CFMutableSetRef)[sets objectForKey:name];
+ CFMutableSetRef namespace = (CFMutableSetRef)[namespaces objectForKey:name];
- if (set == NULL) {
+ if (namespace == NULL) {
return [[[NSEnumerator alloc] init] autorelease];
}
- return [(NSSet *)set objectEnumerator];
-}
-
-+ (void)makeWebViewsPerformSelector:(SEL)selector
-{
- NSEnumerator *setEnumerator = [sets objectEnumerator];
- NSMutableSet *set;
- while ((set = [setEnumerator nextObject]) != nil) {
- [set makeObjectsPerformSelector:selector];
- }
+ return [(NSSet *)namespace objectEnumerator];
}
@end
-
-
-
1.314 +44 -3 WebKit/WebView.subproj/WebView.m
Index: WebView.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebView.m,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -r1.313 -r1.314
--- WebView.m 19 Nov 2005 02:08:06 -0000 1.313
+++ WebView.m 8 Dec 2005 18:33:56 -0000 1.314
@@ -88,6 +88,8 @@
#import <WebCore/WebCoreSettings.h>
#import <WebCore/WebCoreView.h>
+#import <CoreFoundation/CFSet.h>
+
#import <Foundation/NSURLConnection.h>
#import <objc/objc-runtime.h>
@@ -319,6 +321,43 @@
@end
+ at implementation WebView (AllWebViews)
+
+static CFSetCallBacks NonRetainingSetCallbacks = {
+ 0,
+ NULL,
+ NULL,
+ CFCopyDescription,
+ CFEqual,
+ CFHash
+};
+
+static CFMutableSetRef allWebViewsSet;
+
++ (void)_makeAllWebViewsPerformSelector:(SEL)selector
+{
+ if (!allWebViewsSet)
+ return;
+
+ [(NSMutableSet *)allWebViewsSet makeObjectsPerformSelector:selector];
+}
+
+- (void)_removeFromAllWebViewsSet
+{
+ if (allWebViewsSet)
+ CFSetRemoveValue(allWebViewsSet, self);
+}
+
+- (void)_addToAllWebViewsSet
+{
+ if (!allWebViewsSet)
+ allWebViewsSet = CFSetCreateMutable(NULL, 0, &NonRetainingSetCallbacks);
+
+ CFSetSetValue(allWebViewsSet, self);
+}
+
+ at end
+
@implementation WebView (WebPrivate)
#ifdef DEBUG_WIDGET_DRAWING
@@ -419,8 +458,9 @@
- (void)_close
{
+ [self _removeFromAllWebViewsSet];
if (_private->setName != nil) {
- [WebViewSets removeWebView:self fromSetNamed:_private->setName];
+ [WebFrameNamespaces removeWebView:self fromFrameNamespace:_private->setName];
[_private->setName release];
_private->setName = nil;
}
@@ -606,7 +646,7 @@
// Try other WebViews in the same set
if (_private->setName != nil) {
- NSEnumerator *enumerator = [WebViewSets webViewsInSetNamed:_private->setName];
+ NSEnumerator *enumerator = [WebFrameNamespaces webViewsInFrameNamespace:_private->setName];
WebView *webView;
while ((webView = [enumerator nextObject]) != nil && frame == nil) {
frame = [webView _findFrameInThisWindowNamed:name sourceFrame:source];
@@ -1541,6 +1581,7 @@
[wv release];
_private->mainFrame = [[WebFrame alloc] initWithName: frameName webFrameView: wv webView: self];
+ [self _addToAllWebViewsSet];
[self setGroupName:groupName];
// If there's already a next key view (e.g., from a nib), wire it up to our
@@ -2250,7 +2291,7 @@
if (groupName != _private->setName){
[_private->setName release];
_private->setName = [groupName copy];
- [WebViewSets addWebView:self toSetNamed:_private->setName];
+ [WebFrameNamespaces addWebView:self toFrameNamespace:_private->setName];
}
}
1.24 +6 -0 WebKit/WebView.subproj/WebViewInternal.h
Index: WebViewInternal.h
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebViewInternal.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- WebViewInternal.h 13 Oct 2005 01:08:26 -0000 1.23
+++ WebViewInternal.h 8 Dec 2005 18:33:56 -0000 1.24
@@ -132,3 +132,9 @@
// WebDocumentSelection protocol implementors should call this in becomeFirstResponder
- (void)_selectedFrameDidChange;
@end
+
+ at interface WebView (AllWebViews)
++ (void)_makeAllWebViewsPerformSelector:(SEL)selector;
+- (void)_removeFromAllWebViewsSet;
+- (void)_addToAllWebViewsSet;
+ at end
More information about the webkit-changes
mailing list