- fixed <rdar://problem/
4794935> setAcceptsMouseMovedEvents: is called for every layout,
taking ~1% on the PLT test
* WebView/WebHTMLView.m:
(-[NSArray layoutToMinimumPageWidth:maximumPageWidth:adjustingViewSize:]):
Don't call setAcceptsMouseMovedEvents: and WKSetNSWindowShouldPostEventNotifications() here
because this is called too often.
* WebView/WebView.m:
(-[WebView viewWillMoveToWindow:]):
Do call them here, because this is guaranteed to be called at least once for each window
containing a webview, but isn't called too often. Also restructured this method a little.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17162
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-10-20 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Darin
+
+ - fixed <rdar://problem/4794935> setAcceptsMouseMovedEvents: is called for every layout,
+ taking ~1% on the PLT test
+
+ * WebView/WebHTMLView.m:
+ (-[NSArray layoutToMinimumPageWidth:maximumPageWidth:adjustingViewSize:]):
+ Don't call setAcceptsMouseMovedEvents: and WKSetNSWindowShouldPostEventNotifications() here
+ because this is called too often.
+
+ * WebView/WebView.m:
+ (-[WebView viewWillMoveToWindow:]):
+ Do call them here, because this is guaranteed to be called at least once for each window
+ containing a webview, but isn't called too often. Also restructured this method a little.
+
2006-10-19 Timothy Hatcher <timothy@apple.com>
Reviewed by Anders.
{
[self reapplyStyles];
- // Ensure that we will receive mouse move events. Is this the best place to put this?
- [[self window] setAcceptsMouseMovedEvents: YES];
- WKSetNSWindowShouldPostEventNotifications([self window], YES);
-
if (!_private->needsLayout) {
return;
}
- (void)viewWillMoveToWindow:(NSWindow *)window
{
- // Don't do anything if we aren't initialized. This happens
- // when decoding a WebView.
- if (_private) {
- if ([self window])
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:[self window]];
- if (window)
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillClose:) name:NSWindowWillCloseNotification object:window];
+ // Don't do anything if we aren't initialized. This happens when decoding a WebView.
+ if (!_private)
+ return;
+
+ if ([self window])
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:[self window]];
+
+ if (window) {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillClose:) name:NSWindowWillCloseNotification object:window];
+
+ // Ensure that we will receive the events that WebHTMLView (at least) needs. It's expensive enough
+ // that we don't want to call it over and over.
+ [window setAcceptsMouseMovedEvents:YES];
+ WKSetNSWindowShouldPostEventNotifications(window, YES);
}
}