Reviewed by Darin
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Oct 2006 17:58:21 +0000 (17:58 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Oct 2006 17:58:21 +0000 (17:58 +0000)
        - 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

WebKit/ChangeLog
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebView.m

index 365d5ba6ed534f7f90816bad36f1ad6fda32902f..9b449e4b726a0e7b4d80bd6da8bbae85be991457 100644 (file)
@@ -1,3 +1,20 @@
+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.
index 3352fe6e63b4c96444f3d00ed7aaf1d2801feb9e..15032ba565a149fd04116261ea588ac9978e8b1f 100644 (file)
@@ -2510,10 +2510,6 @@ static WebHTMLView *lastHitView = nil;
 {
     [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;
     }
index eefe33a3919417f413609b4fbfe076eef4510523..9f2bb05d4feef31cac5c901f1d59728930eb0ee5 100644 (file)
@@ -1935,13 +1935,20 @@ NS_ENDHANDLER
 
 - (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);
     }
 }