[webkit-changes] cvs commit: WebKit ChangeLog
Vicki
vicki at opensource.apple.com
Thu Dec 1 13:59:23 PST 2005
vicki 05/12/01 13:59:23
Modified: WebView.subproj WebHTMLView.m
. ChangeLog
Log:
Reviewed by Vicki.
- fix <rdar://problem/4349721> Regression: Hovering over menu item doesn't highlight menu item or
mousing up on menu item in applet does not open URL in new window at smartmoney.com
Since Java depends on doing a hit test inside it's mouse moved handling, let hit testing on Java
applets go through the standard NSView code path. Since this should only happen for Java, add a global
so that we can Use our own WebHTMLView hit testing when calling from _updateMouseoverWithEvent.
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView _hitViewForEvent:]): rename forceRealHitTest to forceNSViewHitTest
(-[WebHTMLView _updateMouseoverWithEvent:]): set global variable to force a WebHTMLView-style hit test from here
(-[WebHTMLView hitTest:]): perform the appropriate hit test based on global variables
Revision Changes Path
1.482 +36 -8 WebKit/WebView.subproj/WebHTMLView.m
Index: WebHTMLView.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLView.m,v
retrieving revision 1.481
retrieving revision 1.482
diff -u -r1.481 -r1.482
--- WebHTMLView.m 30 Nov 2005 02:07:49 -0000 1.481
+++ WebHTMLView.m 1 Dec 2005 21:59:14 -0000 1.482
@@ -157,7 +157,11 @@
forwardDeleteKeyAction
} WebDeletionAction;
-static BOOL forceRealHitTest = NO;
+// if YES, do the standard NSView hit test (which can't give the right result when HTML overlaps a view)
+static BOOL forceNSViewHitTest = NO;
+
+// if YES, do the "top WebHTMLView" it test (which we'd like to do all the time but can't because of Java requirements [see bug 4349721])
+static BOOL forceWebHTMLViewHitTest = NO;
// Used to avoid linking with ApplicationServices framework for _DCMDictionaryServiceWindowShow
void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
@@ -570,9 +574,9 @@
{
// 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;
+ forceNSViewHitTest = YES;
NSView *hitView = [[[self window] contentView] hitTest:[event locationInWindow]];
- forceRealHitTest = NO;
+ forceNSViewHitTest = NO;
return hitView;
}
@@ -855,15 +859,37 @@
- (NSView *)hitTest:(NSPoint)point
{
- // WebHTMLView objects handle all left mouse clicks for objects inside them.
- // That does not include left mouse clicks with the control key held down.
+ // WebHTMLView objects handle all events for objects inside them.
+ // To get those events, we prevent hit testing from AppKit.
+
+ // But there are three exceptions to this:
+ // 1) For right mouse clicks and control clicks we don't yet have an implementation
+ // that works for nested views, so we let the hit testing go through the
+ // standard NSView code path (needs to be fixed, see bug 4361618).
+ // 2) Java depends on doing a hit test inside it's mouse moved handling,
+ // so we let the hit testing go through the standard NSView code path
+ // when the current event is a mouse move (except when we are calling
+ // from _updateMouseoverWithEvent, so we have to use a global,
+ // forceWebHTMLViewHitTest, for that)
+ // 3) The acceptsFirstMouse: and shouldDelayWindowOrderingForEvent: methods
+ // both need to figure out which view to check with inside the WebHTMLView.
+ // They use a global to change the behavior of hitTest: so they can get the
+ // right view. The global is forceNSViewHitTest and the method they use to
+ // do the hit testing is _hitViewForEvent:. (But this does not work correctly
+ // when there is HTML overlapping the view, see bug 4361626)
+
BOOL captureHitsOnSubviews;
- if (forceRealHitTest) {
+ if (forceNSViewHitTest)
captureHitsOnSubviews = NO;
- } else {
+ else if (forceWebHTMLViewHitTest)
+ captureHitsOnSubviews = YES;
+ else {
NSEvent *event = [[self window] currentEvent];
- captureHitsOnSubviews = !([event type] == NSRightMouseDown || ([event type] == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask) != 0));
+ captureHitsOnSubviews = !([event type] == NSMouseMoved
+ || [event type] == NSRightMouseDown
+ || ([event type] == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask) != 0));
}
+
if (!captureHitsOnSubviews)
return [super hitTest:point];
if ([[self superview] mouse:point inRect:[self frame]])
@@ -989,7 +1015,9 @@
- (void)_updateMouseoverWithEvent:(NSEvent *)event
{
WebHTMLView *view = nil;
+ forceWebHTMLViewHitTest = YES;
NSView *hitView = [[[event window] contentView] hitTest:[event locationInWindow]];
+ forceWebHTMLViewHitTest = NO;
if ([hitView isKindOfClass:[WebHTMLView class]])
view = (WebHTMLView *)hitView;
1.3379 +16 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3378
retrieving revision 1.3379
diff -u -r1.3378 -r1.3379
--- ChangeLog 30 Nov 2005 02:07:41 -0000 1.3378
+++ ChangeLog 1 Dec 2005 21:59:16 -0000 1.3379
@@ -1,3 +1,19 @@
+2005-12-01 Darin Adler <darin at apple.com>
+
+ Reviewed by Vicki.
+
+ - fix <rdar://problem/4349721> Regression: Hovering over menu item doesn't highlight menu item or
+ mousing up on menu item in applet does not open URL in new window at smartmoney.com
+
+ Since Java depends on doing a hit test inside it's mouse moved handling, let hit testing on Java
+ applets go through the standard NSView code path. Since this should only happen for Java, add a global
+ so that we can Use our own WebHTMLView hit testing when calling from _updateMouseoverWithEvent.
+
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView _hitViewForEvent:]): rename forceRealHitTest to forceNSViewHitTest
+ (-[WebHTMLView _updateMouseoverWithEvent:]): set global variable to force a WebHTMLView-style hit test from here
+ (-[WebHTMLView hitTest:]): perform the appropriate hit test based on global variables
+
2005-11-29 Andrew Wellington <proton at wiretapped.net>
Reviewed by darin. Committed by eseidel.
More information about the webkit-changes
mailing list