[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
weinig at apple.com
weinig at apple.com
Thu Dec 3 13:19:41 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 4630d9930b27d8e1a9b6965f4f0a64ce634d39ae
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 26 22:37:08 2009 +0000
Move some WebView event handling code into its own file, WebViewEventHandling.mm
Reviewed by Anders Carlsson.
WebKit:
* WebKit.xcodeproj/project.pbxproj:
WebKit/mac:
* WebView/WebView.mm:
(-[WebView _close]):
(-[WebView _selectedOrMainFrame]):
* WebView/WebViewEventHandling.mm: Added.
(-[WebView _closingEventHandling]):
(-[WebView _setMouseDownEvent:]):
(-[WebView mouseDown:]):
(-[WebView mouseUp:]):
(+[WebView _updateMouseoverWithEvent:]):
(-[WebView _updateMouseoverWithFakeEvent]):
(_updateMouseoverWithEvent:fakeEvent::if):
(-[WebView _stopAutoscrollTimer]):
(-[WebView _setToolTip:]):
* WebView/WebViewInternal.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50106 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 607a039..cc2bbff 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,11 @@
+2009-10-26 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Move some WebView event handling code into its own file, WebViewEventHandling.mm
+
+ * WebKit.xcodeproj/project.pbxproj:
+
2009-10-19 John Gregg <johnnyg at google.com>
Reviewed by Dimitri Glazkov.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index db25bf9..a5a2e39 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -330,6 +330,7 @@
BC2E464E0FD8A96800A9D9DE /* WebViewData.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */; };
BC542C420FD7766F00D8AB5D /* WebDelegateImplementationCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */; };
BC542C430FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC542C410FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm */; };
+ BC97E7E210963D260010D361 /* WebViewEventHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC97E7E110963D260010D361 /* WebViewEventHandling.mm */; };
C0167BF80D7F5DD00028696E /* WebScriptDebugger.h in Headers */ = {isa = PBXBuildFile; fileRef = C0167BF60D7F5DD00028696E /* WebScriptDebugger.h */; };
C0167BF90D7F5DD00028696E /* WebScriptDebugger.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0167BF70D7F5DD00028696E /* WebScriptDebugger.mm */; };
DD7CDEE70A23BA9E00069928 /* WebTypesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = DD7CDEE60A23BA9E00069928 /* WebTypesInternal.h */; };
@@ -604,6 +605,7 @@
BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewData.mm; sourceTree = "<group>"; };
BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDelegateImplementationCaching.h; sourceTree = "<group>"; };
BC542C410FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDelegateImplementationCaching.mm; sourceTree = "<group>"; };
+ BC97E7E110963D260010D361 /* WebViewEventHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewEventHandling.mm; sourceTree = "<group>"; };
BE4FBECB0653DF47005EDE15 /* WebEditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebEditingDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE6DC39904C62C4E004D0EF6 /* WebNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSURLExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE6DC39A04C62C4E004D0EF6 /* WebNSURLExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSURLExtras.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -1144,6 +1146,7 @@
BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */,
930D02BB06275F640076701E /* WebViewInternal.h */,
51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */,
+ BC97E7E110963D260010D361 /* WebViewEventHandling.mm */,
0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */,
0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */,
);
@@ -1849,6 +1852,7 @@
0FD3B0F51076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm in Sources */,
0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */,
0A2D87FE107AF52B00CDDEE3 /* WebPluginHalterClient.mm in Sources */,
+ BC97E7E210963D260010D361 /* WebViewEventHandling.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index ef49f18..1dab737 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,24 @@
+2009-10-26 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Move some WebView event handling code into its own file, WebViewEventHandling.mm
+
+ * WebView/WebView.mm:
+ (-[WebView _close]):
+ (-[WebView _selectedOrMainFrame]):
+ * WebView/WebViewEventHandling.mm: Added.
+ (-[WebView _closingEventHandling]):
+ (-[WebView _setMouseDownEvent:]):
+ (-[WebView mouseDown:]):
+ (-[WebView mouseUp:]):
+ (+[WebView _updateMouseoverWithEvent:]):
+ (-[WebView _updateMouseoverWithFakeEvent]):
+ (_updateMouseoverWithEvent:fakeEvent::if):
+ (-[WebView _stopAutoscrollTimer]):
+ (-[WebView _setToolTip:]):
+ * WebView/WebViewInternal.h:
+
2009-10-26 Simon Fraser <simon.fraser at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 942d8b5..3a8b2d0 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -160,12 +160,6 @@
#import <WebKit/WebDashboardRegion.h>
#endif
- at class NSTextInputContext;
-
- at interface NSResponder (WebNSResponderDetails)
-- (NSTextInputContext *)inputContext;
- at end
-
@interface NSSpellChecker (WebNSSpellCheckerDetails)
- (void)_preflightChosenSpellServer;
@end
@@ -332,19 +326,10 @@ macro(yankAndSelect) \
static BOOL s_didSetCacheModel;
static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer;
-static WebView *lastMouseoverView;
-
#ifndef NDEBUG
static const char webViewIsOpen[] = "At least one WebView is still open.";
#endif
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
- at interface NSObject (NSTextInputContextDetails)
-- (BOOL)wantsToHandleMouseEvents;
-- (BOOL)handleMouseEvent:(NSEvent *)event;
- at end
-#endif
-
@interface NSObject (WebValidateWithoutDelegate)
- (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item;
@end
@@ -359,7 +344,6 @@ static const char webViewIsOpen[] = "At least one WebView is still open.";
@end
@interface WebView (WebFileInternal)
-- (WebFrame *)_selectedOrMainFrame;
- (BOOL)_isLoading;
- (WebFrameView *)_frameViewAtWindowPoint:(NSPoint)point;
- (WebFrame *)_focusedFrame;
@@ -987,8 +971,7 @@ static bool fastDocumentTeardownEnabled()
if (!_private || _private->closed)
return;
- if (lastMouseoverView == self)
- lastMouseoverView = nil;
+ [self _closingEventHandling];
#ifndef NDEBUG
WTF::RefCountedLeakCounter::cancelMessageSuppression(webViewIsOpen);
@@ -3637,87 +3620,6 @@ static WebFrame *incrementFrame(WebFrame *frame, BOOL forward, BOOL wrapFlag)
return [previousView previousValidKeyView];
}
-- (void)mouseDown:(NSEvent *)event
-{
- // FIXME (Viewless): This method should be shared with WebHTMLView, which needs to
- // do the same work in the usesDocumentViews case. We don't want to maintain two
- // duplicate copies of this method.
-
- if (_private->usesDocumentViews) {
- [super mouseDown:event];
- return;
- }
-
- // There's a chance that responding to this event will run a nested event loop, and
- // fetching a new event might release the old one. Retaining and then autoreleasing
- // the current event prevents that from causing a problem inside WebKit or AppKit code.
- [[event retain] autorelease];
-
- RetainPtr<WebView> protector = self;
- if ([[self inputContext] wantsToHandleMouseEvents] && [[self inputContext] handleMouseEvent:event])
- return;
-
- _private->handlingMouseDownEvent = YES;
-
- // Record the mouse down position so we can determine drag hysteresis.
- [self _setMouseDownEvent:event];
-
- NSInputManager *currentInputManager = [NSInputManager currentInputManager];
- if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
- goto done;
-
- [_private->completionController endRevertingChange:NO moveLeft:NO];
-
- // If the web page handles the context menu event and menuForEvent: returns nil, we'll get control click events here.
- // We don't want to pass them along to KHTML a second time.
- if (!([event modifierFlags] & NSControlKeyMask)) {
- _private->ignoringMouseDraggedEvents = NO;
-
- // Don't do any mouseover while the mouse is down.
- [self _cancelUpdateMouseoverTimer];
-
- // Let WebCore get a chance to deal with the event. This will call back to us
- // to start the autoscroll timer if appropriate.
- if (Frame* frame = [self _mainCoreFrame])
- frame->eventHandler()->mouseDown(event);
- }
-
-done:
- _private->handlingMouseDownEvent = NO;
-}
-
-- (void)mouseUp:(NSEvent *)event
-{
- // FIXME (Viewless): This method should be shared with WebHTMLView, which needs to
- // do the same work in the usesDocumentViews case. We don't want to maintain two
- // duplicate copies of this method.
-
- if (_private->usesDocumentViews) {
- [super mouseUp:event];
- return;
- }
-
- // There's a chance that responding to this event will run a nested event loop, and
- // fetching a new event might release the old one. Retaining and then autoreleasing
- // the current event prevents that from causing a problem inside WebKit or AppKit code.
- [[event retain] autorelease];
-
- [self _setMouseDownEvent:nil];
-
- NSInputManager *currentInputManager = [NSInputManager currentInputManager];
- if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
- return;
-
- [self retain];
-
- [self _stopAutoscrollTimer];
- if (Frame* frame = [self _mainCoreFrame])
- frame->eventHandler()->mouseUp(event);
- [self _updateMouseoverWithFakeEvent];
-
- [self release];
-}
-
@end
@implementation WebView (WebIBActions)
@@ -5209,14 +5111,6 @@ static WebFrameView *containingFrameView(NSView *view)
return nil;
}
-- (WebFrame *)_selectedOrMainFrame
-{
- WebFrame *result = [self selectedFrame];
- if (result == nil)
- result = [self mainFrame];
- return result;
-}
-
- (BOOL)_isLoading
{
WebFrame *mainFrame = [self mainFrame];
@@ -5487,102 +5381,6 @@ static WebFrameView *containingFrameView(NSView *view)
_private->insertionPasteboard = pasteboard;
}
-- (void)_setMouseDownEvent:(NSEvent *)event
-{
- ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown);
-
- if (event == _private->mouseDownEvent)
- return;
-
- [event retain];
- [_private->mouseDownEvent release];
- _private->mouseDownEvent = event;
-}
-
-- (void)_cancelUpdateMouseoverTimer
-{
- if (_private->updateMouseoverTimer) {
- CFRunLoopTimerInvalidate(_private->updateMouseoverTimer);
- CFRelease(_private->updateMouseoverTimer);
- _private->updateMouseoverTimer = NULL;
- }
-}
-
-- (void)_stopAutoscrollTimer
-{
- NSTimer *timer = _private->autoscrollTimer;
- _private->autoscrollTimer = nil;
- [_private->autoscrollTriggerEvent release];
- _private->autoscrollTriggerEvent = nil;
- [timer invalidate];
- [timer release];
-}
-
-+ (void)_updateMouseoverWithEvent:(NSEvent *)event
-{
- WebView *oldView = lastMouseoverView;
-
- lastMouseoverView = nil;
-
- NSView *contentView = [[event window] contentView];
- NSPoint locationForHitTest = [[contentView superview] convertPoint:[event locationInWindow] fromView:nil];
- for (NSView *hitView = [contentView hitTest:locationForHitTest]; hitView; hitView = [hitView superview]) {
- if ([hitView isKindOfClass:[WebView class]]) {
- lastMouseoverView = static_cast<WebView *>(hitView);
- break;
- }
- }
-
- if (lastMouseoverView && lastMouseoverView->_private->hoverFeedbackSuspended)
- lastMouseoverView = nil;
-
- if (lastMouseoverView != oldView) {
- if (Frame* oldCoreFrame = [oldView _mainCoreFrame]) {
- NSEvent *oldViewEvent = [NSEvent mouseEventWithType:NSMouseMoved
- location:NSMakePoint(-1, -1)
- modifierFlags:[[NSApp currentEvent] modifierFlags]
- timestamp:[NSDate timeIntervalSinceReferenceDate]
- windowNumber:[[oldView window] windowNumber]
- context:[[NSApp currentEvent] context]
- eventNumber:0 clickCount:0 pressure:0];
- oldCoreFrame->eventHandler()->mouseMoved(oldViewEvent);
- }
- }
-
- if (!lastMouseoverView)
- return;
-
- if (Frame* coreFrame = core([lastMouseoverView mainFrame]))
- coreFrame->eventHandler()->mouseMoved(event);
-}
-
-- (void)_updateMouseoverWithFakeEvent
-{
- [self _cancelUpdateMouseoverTimer];
-
- NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
- location:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
- modifierFlags:[[NSApp currentEvent] modifierFlags]
- timestamp:[NSDate timeIntervalSinceReferenceDate]
- windowNumber:[[self window] windowNumber]
- context:[[NSApp currentEvent] context]
- eventNumber:0 clickCount:0 pressure:0];
-
- [[self class] _updateMouseoverWithEvent:fakeEvent];
-}
-
-- (void)_setToolTip:(NSString *)toolTip
-{
- if (_private->usesDocumentViews) {
- id documentView = [[[self _selectedOrMainFrame] frameView] documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]])
- [documentView _setToolTip:toolTip];
- return;
- }
-
- // FIXME (Viewless): Code to handle tooltips needs to move into WebView.
-}
-
- (void)_selectionChanged
{
if (_private->usesDocumentViews) {
@@ -5600,6 +5398,14 @@ static WebFrameView *containingFrameView(NSView *view)
return (_private && _private->page) ? _private->page->mainFrame() : 0;
}
+- (WebFrame *)_selectedOrMainFrame
+{
+ WebFrame *result = [self selectedFrame];
+ if (result == nil)
+ result = [self mainFrame];
+ return result;
+}
+
#if USE(ACCELERATED_COMPOSITING)
- (BOOL)_needsOneShotDrawingSynchronization
diff --git a/WebKit/mac/WebView/WebViewEventHandling.mm b/WebKit/mac/WebView/WebViewEventHandling.mm
new file mode 100644
index 0000000..a185667
--- /dev/null
+++ b/WebKit/mac/WebView/WebViewEventHandling.mm
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 David Smith (catfish.man at gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebViewInternal.h"
+
+#import "WebFrameInternal.h"
+#import "WebHTMLView.h"
+#import "WebTextCompletionController.h"
+#import "WebViewData.h"
+#import <WebCore/Frame.h>
+
+using namespace WebCore;
+
+ at class NSTextInputContext;
+
+ at interface NSResponder (WebNSResponderDetails)
+- (NSTextInputContext *)inputContext;
+ at end
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ at interface NSObject (NSTextInputContextDetails)
+- (BOOL)wantsToHandleMouseEvents;
+- (BOOL)handleMouseEvent:(NSEvent *)event;
+ at end
+#endif
+
+ at implementation WebView (WebViewEventHandling)
+
+static WebView *lastMouseoverView;
+
+- (void)_closingEventHandling
+{
+ if (lastMouseoverView == self)
+ lastMouseoverView = nil;
+}
+
+- (void)_setMouseDownEvent:(NSEvent *)event
+{
+ ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown);
+
+ if (event == _private->mouseDownEvent)
+ return;
+
+ [event retain];
+ [_private->mouseDownEvent release];
+ _private->mouseDownEvent = event;
+}
+
+- (void)mouseDown:(NSEvent *)event
+{
+ // FIXME (Viewless): This method should be shared with WebHTMLView, which needs to
+ // do the same work in the usesDocumentViews case. We don't want to maintain two
+ // duplicate copies of this method.
+
+ if (_private->usesDocumentViews) {
+ [super mouseDown:event];
+ return;
+ }
+
+ // There's a chance that responding to this event will run a nested event loop, and
+ // fetching a new event might release the old one. Retaining and then autoreleasing
+ // the current event prevents that from causing a problem inside WebKit or AppKit code.
+ [[event retain] autorelease];
+
+ RetainPtr<WebView> protector = self;
+ if ([[self inputContext] wantsToHandleMouseEvents] && [[self inputContext] handleMouseEvent:event])
+ return;
+
+ _private->handlingMouseDownEvent = YES;
+
+ // Record the mouse down position so we can determine drag hysteresis.
+ [self _setMouseDownEvent:event];
+
+ NSInputManager *currentInputManager = [NSInputManager currentInputManager];
+ if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
+ goto done;
+
+ [_private->completionController endRevertingChange:NO moveLeft:NO];
+
+ // If the web page handles the context menu event and menuForEvent: returns nil, we'll get control click events here.
+ // We don't want to pass them along to KHTML a second time.
+ if (!([event modifierFlags] & NSControlKeyMask)) {
+ _private->ignoringMouseDraggedEvents = NO;
+
+ // Don't do any mouseover while the mouse is down.
+ [self _cancelUpdateMouseoverTimer];
+
+ // Let WebCore get a chance to deal with the event. This will call back to us
+ // to start the autoscroll timer if appropriate.
+ if (Frame* frame = [self _mainCoreFrame])
+ frame->eventHandler()->mouseDown(event);
+ }
+
+done:
+ _private->handlingMouseDownEvent = NO;
+}
+
+- (void)mouseUp:(NSEvent *)event
+{
+ // FIXME (Viewless): This method should be shared with WebHTMLView, which needs to
+ // do the same work in the usesDocumentViews case. We don't want to maintain two
+ // duplicate copies of this method.
+
+ if (_private->usesDocumentViews) {
+ [super mouseUp:event];
+ return;
+ }
+
+ // There's a chance that responding to this event will run a nested event loop, and
+ // fetching a new event might release the old one. Retaining and then autoreleasing
+ // the current event prevents that from causing a problem inside WebKit or AppKit code.
+ [[event retain] autorelease];
+
+ [self _setMouseDownEvent:nil];
+
+ NSInputManager *currentInputManager = [NSInputManager currentInputManager];
+ if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
+ return;
+
+ [self retain];
+
+ [self _stopAutoscrollTimer];
+ if (Frame* frame = [self _mainCoreFrame])
+ frame->eventHandler()->mouseUp(event);
+ [self _updateMouseoverWithFakeEvent];
+
+ [self release];
+}
+
++ (void)_updateMouseoverWithEvent:(NSEvent *)event
+{
+ WebView *oldView = lastMouseoverView;
+
+ lastMouseoverView = nil;
+
+ NSView *contentView = [[event window] contentView];
+ NSPoint locationForHitTest = [[contentView superview] convertPoint:[event locationInWindow] fromView:nil];
+ for (NSView *hitView = [contentView hitTest:locationForHitTest]; hitView; hitView = [hitView superview]) {
+ if ([hitView isKindOfClass:[WebView class]]) {
+ lastMouseoverView = static_cast<WebView *>(hitView);
+ break;
+ }
+ }
+
+ if (lastMouseoverView && lastMouseoverView->_private->hoverFeedbackSuspended)
+ lastMouseoverView = nil;
+
+ if (lastMouseoverView != oldView) {
+ if (Frame* oldCoreFrame = [oldView _mainCoreFrame]) {
+ NSEvent *oldViewEvent = [NSEvent mouseEventWithType:NSMouseMoved
+ location:NSMakePoint(-1, -1)
+ modifierFlags:[[NSApp currentEvent] modifierFlags]
+ timestamp:[NSDate timeIntervalSinceReferenceDate]
+ windowNumber:[[oldView window] windowNumber]
+ context:[[NSApp currentEvent] context]
+ eventNumber:0 clickCount:0 pressure:0];
+ oldCoreFrame->eventHandler()->mouseMoved(oldViewEvent);
+ }
+ }
+
+ if (!lastMouseoverView)
+ return;
+
+ if (Frame* coreFrame = core([lastMouseoverView mainFrame]))
+ coreFrame->eventHandler()->mouseMoved(event);
+}
+
+- (void)_updateMouseoverWithFakeEvent
+{
+ [self _cancelUpdateMouseoverTimer];
+
+ NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
+ location:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
+ modifierFlags:[[NSApp currentEvent] modifierFlags]
+ timestamp:[NSDate timeIntervalSinceReferenceDate]
+ windowNumber:[[self window] windowNumber]
+ context:[[NSApp currentEvent] context]
+ eventNumber:0 clickCount:0 pressure:0];
+
+ [[self class] _updateMouseoverWithEvent:fakeEvent];
+}
+
+- (void)_cancelUpdateMouseoverTimer
+{
+ if (_private->updateMouseoverTimer) {
+ CFRunLoopTimerInvalidate(_private->updateMouseoverTimer);
+ CFRelease(_private->updateMouseoverTimer);
+ _private->updateMouseoverTimer = NULL;
+ }
+}
+
+- (void)_stopAutoscrollTimer
+{
+ NSTimer *timer = _private->autoscrollTimer;
+ _private->autoscrollTimer = nil;
+ [_private->autoscrollTriggerEvent release];
+ _private->autoscrollTriggerEvent = nil;
+ [timer invalidate];
+ [timer release];
+}
+
+- (void)_setToolTip:(NSString *)toolTip
+{
+ if (_private->usesDocumentViews) {
+ id documentView = [[[self _selectedOrMainFrame] frameView] documentView];
+ if ([documentView isKindOfClass:[WebHTMLView class]])
+ [documentView _setToolTip:toolTip];
+ return;
+ }
+
+ // FIXME (Viewless): Code to handle tooltips needs to move into WebView.
+}
+
+ at end
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index 521aeee..15596db 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -65,6 +65,7 @@ namespace WebCore {
@interface WebView (WebViewInternal)
- (WebCore::Frame*)_mainCoreFrame;
+- (WebFrame *)_selectedOrMainFrame;
- (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url;
- (WebCore::KeyboardUIMode)_keyboardUIMode;
@@ -76,12 +77,7 @@ namespace WebCore {
- (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame;
#endif
-- (void)_setMouseDownEvent:(NSEvent *)event;
-- (void)_cancelUpdateMouseoverTimer;
-- (void)_stopAutoscrollTimer;
-- (void)_updateMouseoverWithFakeEvent;
- (void)_selectionChanged;
-- (void)_setToolTip:(NSString *)toolTip;
#if USE(ACCELERATED_COMPOSITING)
- (BOOL)_needsOneShotDrawingSynchronization;
@@ -95,6 +91,14 @@ namespace WebCore {
#endif
+ at interface WebView (WebViewEventHandling)
+- (void)_closingEventHandling;
+- (void)_updateMouseoverWithFakeEvent;
+- (void)_cancelUpdateMouseoverTimer;
+- (void)_stopAutoscrollTimer;
+- (void)_setToolTip:(NSString *)toolTip;
+ at end
+
// FIXME: Temporary way to expose methods that are in the wrong category inside WebView.
@interface WebView (WebViewOtherInternal)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list