Fixed: <rdar://problem/3946285> Seed: Safari crashed by selecting all at internet...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Feb 2005 00:04:34 +0000 (00:04 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Feb 2005 00:04:34 +0000 (00:04 +0000)
        Reviewed by john.

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView _hitViewForEvent:]): new, factored hit test hack to this method
        (-[WebHTMLView _updateMouseoverWithEvent:): call _hitViewForEvent:
        (-[WebHTMLView acceptsFirstMouse:]): call _setMouseDownEvent: and _isSelectionEvent: on the hit HTMLView or else when it's asked to drag it will assert
        (-[WebHTMLView shouldDelayWindowOrderingForEvent:]): ditto

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8489 268f45cc-cd09-0410-ab3c-d52691b4dbfc

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

index 7d050a4aec3ff38b5e448b9513b3139afe330829..6e9ae32b092c559bbdb9b0e267475f585102e204 100644 (file)
@@ -1,3 +1,15 @@
+2005-01-31  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/3946285> Seed: Safari crashed by selecting all at internet-moebel.com
+
+        Reviewed by john.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _hitViewForEvent:]): new, factored hit test hack to this method
+        (-[WebHTMLView _updateMouseoverWithEvent:): call _hitViewForEvent:
+        (-[WebHTMLView acceptsFirstMouse:]): call _setMouseDownEvent: and _isSelectionEvent: on the hit HTMLView or else when it's asked to drag it will assert
+        (-[WebHTMLView shouldDelayWindowOrderingForEvent:]): ditto
+
 2005-01-31  David Harrison  <harrison@apple.com>
 
         Reviewed by Darin.
@@ -8,7 +20,7 @@
         (-[WebHTMLView maintainsInactiveSelection]):
         Keep the selection when the new first respomder is our own scrollview, in both editable and non-editaqble content.
 
-2005-01-31  Jens Alfke  <set EMAIL_ADDRESS environment variable>
+2005-01-31  Jens Alfke  <jens@apple.com>
 
         Reviewed by John.
 
index 3cb43387fb59174343854eeccef3af85d52b9909..050ff5758145e969df4cf39d399d90e67de25f7e 100644 (file)
@@ -167,6 +167,7 @@ void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
        isTypingAction:(BOOL)isTypingAction;
 - (void)_deleteSelection;
 - (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard;
+- (NSView *)_hitViewForEvent:(NSEvent *)event;
 @end
 
 @interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick.
@@ -511,6 +512,16 @@ void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
     return [[self _webView] smartInsertDeleteEnabled] && [[pasteboard types] containsObject:WebSmartPastePboardType];
 }
 
+- (NSView *)_hitViewForEvent:(NSEvent *)event
+{
+    // Usually, we hack AK's hitTest method to catch all events at the topmost WebHTMLView.  
+    // Callers of this method, however, want to query the deepest view instead.
+    forceRealHitTest = YES;
+    NSView *hitView = [[[self window] contentView] hitTest:[event locationInWindow]];
+    forceRealHitTest = NO;    
+    return hitView;
+}
+
 @end
 
 @implementation WebHTMLView (WebPrivate)
@@ -843,9 +854,7 @@ static WebHTMLView *lastHitView = nil;
 {
     WebHTMLView *view = nil;
     if ([event window] == [self window]) {
-        forceRealHitTest = YES;
-        NSView *hitView = [[[self window] contentView] hitTest:[event locationInWindow]];
-        forceRealHitTest = NO;
+        NSView *hitView = [self _hitViewForEvent:event];
         while (hitView) {
             if ([hitView isKindOfClass:[WebHTMLView class]]) {
                 view = (WebHTMLView *)hitView;
@@ -2360,21 +2369,16 @@ static WebHTMLView *lastHitView = nil;
 
 - (BOOL)acceptsFirstMouse:(NSEvent *)event
 {
-    [self _setMouseDownEvent:event];
+    NSView *hitView = [self _hitViewForEvent:event];
+    WebHTMLView *hitHTMLView = [hitView isKindOfClass:[self class]] ? (WebHTMLView *)hitView : nil;
+    [hitHTMLView _setMouseDownEvent:event];
     
     if ([[self _webView] _dashboardBehavior:WebDashboardBehaviorAlwaysAcceptsFirstMouse])
         return YES;
-        
-    // We hack AK's hitTest method to catch all events at the topmost WebHTMLView.  However, for
-    // the purposes of this method we want to really query the deepest view, so we forward to it.
-    forceRealHitTest = YES;
-    NSView *hitView = [[[self window] contentView] hitTest:[event locationInWindow]];
-    forceRealHitTest = NO;
     
-    if ([hitView isKindOfClass:[self class]]) {
-        WebHTMLView *hitHTMLView = (WebHTMLView *)hitView;
+    if (hitHTMLView != nil) {
         [[hitHTMLView _bridge] setActivationEventNumber:[event eventNumber]];
-        return [self _isSelectionEvent:event] ? [[hitHTMLView _bridge] eventMayStartDrag:event] : NO;
+        return [hitHTMLView _isSelectionEvent:event] ? [[hitHTMLView _bridge] eventMayStartDrag:event] : NO;
     } else {
         return [hitView acceptsFirstMouse:event];
     }
@@ -2382,17 +2386,11 @@ static WebHTMLView *lastHitView = nil;
 
 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)event
 {
-    [self _setMouseDownEvent:event];
-
-    // We hack AK's hitTest method to catch all events at the topmost WebHTMLView.  However, for
-    // the purposes of this method we want to really query the deepest view, so we forward to it.
-    forceRealHitTest = YES;
-    NSView *hitView = [[[self window] contentView] hitTest:[event locationInWindow]];
-    forceRealHitTest = NO;
-    
-    if ([hitView isKindOfClass:[self class]]) {
-        WebHTMLView *hitHTMLView = (WebHTMLView *)hitView;
-        return [self _isSelectionEvent:event] ? [[hitHTMLView _bridge] eventMayStartDrag:event] : NO;
+    NSView *hitView = [self _hitViewForEvent:event];
+    WebHTMLView *hitHTMLView = [hitView isKindOfClass:[self class]] ? (WebHTMLView *)hitView : nil;
+    if (hitHTMLView != nil) {
+        [hitHTMLView _setMouseDownEvent:event];
+        return [hitHTMLView _isSelectionEvent:event] ? [[hitHTMLView _bridge] eventMayStartDrag:event] : NO;
     } else {
         return [hitView shouldDelayWindowOrderingForEvent:event];
     }