[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:14:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c9a8d22ba03d98ee24ec1c07fa0f97906dc461bb
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 12 09:45:59 2002 +0000

    WebCore:
    
            Reviewed by Maciej and Richard.
    
    	- fixed 3125497 -- REGRESSION: Infinite recursion with mouseUp: events
    
    	The problem was that events could end up back at the same part due to the responder chain.
    
            * kwq/KWQKHTMLPart.h: Added mouseDown, mouseDragged, mouseUp, mouseMoved, buttonForCurrentEvent,
    	and stateForCurrentEvent. Remove setCurrentEvent and currentEvent. Renamed handleMouseDownEventForWidget
    	to passWidgetMouseDownEventToWidget. John and I had agreed to this name change before the last commit,
    	but I forgot.
    
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::KWQKHTMLPart): Initialize _sendingEventToSubview to false. No need to initialize
    	_mouseDownWasInSubframe at all since it's only looked at when _mouseDownView is non-nil.
            (KWQKHTMLPart::keyEvent): Save and restore _currentEvent instead of setting to nil.
    	Use stateForCurrentEvent instead of stateForEvent:.
            (KWQKHTMLPart::khtmlMousePressEvent): Name change.
            (KWQKHTMLPart::khtmlMouseDoubleClickEvent): Name change.
            (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Name change. Set _sendingEventToSubview when
            sending event to subview.
            (KWQKHTMLPart::khtmlMouseReleaseEvent): Name change. Set _sendingEventToSubview when sending
    	event to subview.
            (KWQKHTMLPart::passSubframeEventToSubframe): Name change. Set _sendingEventToSubview when
    	sending event to subview.
            (KWQKHTMLPart::buttonForCurrentEvent): Added. Similar to code I moved here from WebCoreBridge.
            (KWQKHTMLPart::stateForCurrentEvent): Added. Similar to code I moved here from WebCoreBridge.
            (KWQKHTMLPart::mouseDown): Added. Similar to code I moved here from WebCoreBridge, except returns
    	and does nothing if _sendingEventToSubview is set.
            (KWQKHTMLPart::mouseDragged): Ditto.
            (KWQKHTMLPart::mouseUp): Ditto.
            (KWQKHTMLPart::mouseMoved): Added. Similar to code I moved here from WebCoreBridge.
    
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge mouseDown:]): Just call _part->mouseDown().
            (-[WebCoreBridge mouseDragged:]): Just call _part->mouseDragged().
            (-[WebCoreBridge mouseUp:]): Just call _part->mouseUp().
            (-[WebCoreBridge mouseMoved:]): Just call _part->mouseMoved().
    
            * kwq/WebCoreBridgePrivate.h: Removed.
            * WebCore.pbproj/project.pbxproj: Removed WebCoreBridgePrivate.h.
    
    WebKit:
    
            Reviewed by Maciej and Richard.
    
            - fixed reentrancy crash I ran into while debugging infinite recursion bugs
    
            * WebView.subproj/WebHTMLViewPrivate.m:
            (-[WebHTMLView _updateMouseoverWithFakeEvent]): Added. Does part of what _frameOrBoundsChanged did.
            (-[WebHTMLView _frameOrBoundsChanged]): Schedule the mouseover update to happen soon, rather than
            doing it right away. If we do it right away, we might reenter because sending a mouse moved event
            can result in another layout since mouse moved events are the same as mouse dragged events in KHTML.
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView viewWillMoveToWindow:]): Cancel the scheduled mouseover update.
    
            * WebKit.pbproj/project.pbxproj: Electron uber alles.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 5bfcdfc..0bf4676 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,46 @@
+2002-12-12  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej and Richard.
+
+	- fixed 3125497 -- REGRESSION: Infinite recursion with mouseUp: events
+
+	The problem was that events could end up back at the same part due to the responder chain.
+
+        * kwq/KWQKHTMLPart.h: Added mouseDown, mouseDragged, mouseUp, mouseMoved, buttonForCurrentEvent,
+	and stateForCurrentEvent. Remove setCurrentEvent and currentEvent. Renamed handleMouseDownEventForWidget
+	to passWidgetMouseDownEventToWidget. John and I had agreed to this name change before the last commit,
+	but I forgot.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart): Initialize _sendingEventToSubview to false. No need to initialize
+	_mouseDownWasInSubframe at all since it's only looked at when _mouseDownView is non-nil.
+        (KWQKHTMLPart::keyEvent): Save and restore _currentEvent instead of setting to nil.
+	Use stateForCurrentEvent instead of stateForEvent:.
+        (KWQKHTMLPart::khtmlMousePressEvent): Name change.
+        (KWQKHTMLPart::khtmlMouseDoubleClickEvent): Name change.
+        (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Name change. Set _sendingEventToSubview when
+        sending event to subview.
+        (KWQKHTMLPart::khtmlMouseReleaseEvent): Name change. Set _sendingEventToSubview when sending
+	event to subview.
+        (KWQKHTMLPart::passSubframeEventToSubframe): Name change. Set _sendingEventToSubview when
+	sending event to subview.
+        (KWQKHTMLPart::buttonForCurrentEvent): Added. Similar to code I moved here from WebCoreBridge.
+        (KWQKHTMLPart::stateForCurrentEvent): Added. Similar to code I moved here from WebCoreBridge.
+        (KWQKHTMLPart::mouseDown): Added. Similar to code I moved here from WebCoreBridge, except returns
+	and does nothing if _sendingEventToSubview is set.
+        (KWQKHTMLPart::mouseDragged): Ditto.
+        (KWQKHTMLPart::mouseUp): Ditto.
+        (KWQKHTMLPart::mouseMoved): Added. Similar to code I moved here from WebCoreBridge.
+
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge mouseDown:]): Just call _part->mouseDown().
+        (-[WebCoreBridge mouseDragged:]): Just call _part->mouseDragged().
+        (-[WebCoreBridge mouseUp:]): Just call _part->mouseUp().
+        (-[WebCoreBridge mouseMoved:]): Just call _part->mouseMoved().
+
+        * kwq/WebCoreBridgePrivate.h: Removed.
+        * WebCore.pbproj/project.pbxproj: Removed WebCoreBridgePrivate.h.
+
 2002-12-12  Richard Williamson   <rjw at apple.com>
 
         Fixed 3125583.  Don't redraw view under resize bar
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5bfcdfc..0bf4676 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,46 @@
+2002-12-12  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej and Richard.
+
+	- fixed 3125497 -- REGRESSION: Infinite recursion with mouseUp: events
+
+	The problem was that events could end up back at the same part due to the responder chain.
+
+        * kwq/KWQKHTMLPart.h: Added mouseDown, mouseDragged, mouseUp, mouseMoved, buttonForCurrentEvent,
+	and stateForCurrentEvent. Remove setCurrentEvent and currentEvent. Renamed handleMouseDownEventForWidget
+	to passWidgetMouseDownEventToWidget. John and I had agreed to this name change before the last commit,
+	but I forgot.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart): Initialize _sendingEventToSubview to false. No need to initialize
+	_mouseDownWasInSubframe at all since it's only looked at when _mouseDownView is non-nil.
+        (KWQKHTMLPart::keyEvent): Save and restore _currentEvent instead of setting to nil.
+	Use stateForCurrentEvent instead of stateForEvent:.
+        (KWQKHTMLPart::khtmlMousePressEvent): Name change.
+        (KWQKHTMLPart::khtmlMouseDoubleClickEvent): Name change.
+        (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Name change. Set _sendingEventToSubview when
+        sending event to subview.
+        (KWQKHTMLPart::khtmlMouseReleaseEvent): Name change. Set _sendingEventToSubview when sending
+	event to subview.
+        (KWQKHTMLPart::passSubframeEventToSubframe): Name change. Set _sendingEventToSubview when
+	sending event to subview.
+        (KWQKHTMLPart::buttonForCurrentEvent): Added. Similar to code I moved here from WebCoreBridge.
+        (KWQKHTMLPart::stateForCurrentEvent): Added. Similar to code I moved here from WebCoreBridge.
+        (KWQKHTMLPart::mouseDown): Added. Similar to code I moved here from WebCoreBridge, except returns
+	and does nothing if _sendingEventToSubview is set.
+        (KWQKHTMLPart::mouseDragged): Ditto.
+        (KWQKHTMLPart::mouseUp): Ditto.
+        (KWQKHTMLPart::mouseMoved): Added. Similar to code I moved here from WebCoreBridge.
+
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge mouseDown:]): Just call _part->mouseDown().
+        (-[WebCoreBridge mouseDragged:]): Just call _part->mouseDragged().
+        (-[WebCoreBridge mouseUp:]): Just call _part->mouseUp().
+        (-[WebCoreBridge mouseMoved:]): Just call _part->mouseMoved().
+
+        * kwq/WebCoreBridgePrivate.h: Removed.
+        * WebCore.pbproj/project.pbxproj: Removed WebCoreBridgePrivate.h.
+
 2002-12-12  Richard Williamson   <rjw at apple.com>
 
         Fixed 3125583.  Don't redraw view under resize bar
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 1283ad6..4d1584c 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -470,7 +470,6 @@
 				931C8A180380288B008635CE,
 				BC7294FA03804B3C00A80166,
 				BC7294FE03804B5600A80166,
-				656ACA640387B476001C1259,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -856,18 +855,6 @@
 //652
 //653
 //654
-		656ACA630387B475001C1259 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = WebCoreBridgePrivate.h;
-			refType = 4;
-		};
-		656ACA640387B476001C1259 = {
-			fileRef = 656ACA630387B475001C1259;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		6573C63B03A0BE5700FCA39F = {
 			buildActionMask = 8;
 			files = (
@@ -5905,7 +5892,6 @@
 			children = (
 				F587854702DE375901EA4122,
 				F587854802DE375901EA4122,
-				656ACA630387B475001C1259,
 				F5B2A4FC02E2220F018635CB,
 				F5B2A4FD02E2220F018635CB,
 				F587854902DE375901EA4122,
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 0527284..092ccce 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -147,13 +147,14 @@ public:
 
     void addMetaData(const QString &key, const QString &value);
 
+    void mouseDown(NSEvent *);
+    void mouseDragged(NSEvent *);
+    void mouseUp(NSEvent *);
+    void mouseMoved(NSEvent *);
     bool keyEvent(NSEvent *);
     
     static void widgetWillReleaseView(NSView *);
     
-    static void setCurrentEvent(NSEvent *event) { _currentEvent = event; }
-    static NSEvent *currentEvent() { return _currentEvent; }
-    
     void clearTimers();
     
     bool passSubframeEventToSubframe(DOM::NodeImpl::MouseEvent &);
@@ -163,8 +164,11 @@ private:
     virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
     virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *);
     
-    bool handleMouseDownEventForWidget(khtml::MouseEvent *);
-    bool handleMouseDownEventForWidget(khtml::RenderWidget *);
+    static int buttonForCurrentEvent();
+    static int stateForCurrentEvent();
+
+    bool passWidgetMouseDownEventToWidget(khtml::MouseEvent *);
+    bool passWidgetMouseDownEventToWidget(khtml::RenderWidget *);
 
     void setPolicyBaseURL(const DOM::DOMString &);
 
@@ -186,6 +190,7 @@ private:
     
     NSView *_mouseDownView;
     bool _mouseDownWasInSubframe;
+    bool _sendingEventToSubview;
     
     static NSEvent *_currentEvent;
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 74195d6..26f4920 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -35,7 +35,6 @@
 #import "kjs_window.h"
 
 #import "WebCoreBridge.h"
-#import "WebCoreBridgePrivate.h"
 #import "WebCoreViewFactory.h"
 
 #import "KWQDummyView.h"
@@ -120,7 +119,7 @@ KWQKHTMLPart::KWQKHTMLPart()
     , _completedWithBool(this, SIGNAL(completed(bool)))
     , _ownsView(false)
     , _mouseDownView(nil)
-    , _mouseDownWasInSubframe(false)
+    , _sendingEventToSubview(false)
 {
     // Must init the cache before connecting to any signals
     Cache::init();
@@ -666,6 +665,7 @@ bool KWQKHTMLPart::keyEvent(NSEvent *event)
 	return false;
     }
     
+    NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = event;
 
     const char *characters = [[event characters] lossyCString];
@@ -674,7 +674,7 @@ bool KWQKHTMLPart::keyEvent(NSEvent *event)
     QKeyEvent qEvent([event type] == NSKeyDown ? QEvent::KeyPress : QEvent::KeyRelease,
 		     [event keyCode],
 		     ascii,
-		     [_bridge stateForEvent:event],
+		     stateForCurrentEvent(),
 		     QString::fromNSString([event characters]),
 		     [event isARepeat]);
 
@@ -685,14 +685,14 @@ bool KWQKHTMLPart::keyEvent(NSEvent *event)
 	QKeyEvent qEvent([event type] == NSKeyDown ? QEvent::KeyPress : QEvent::KeyRelease,
 			 [event keyCode],
 			 ascii,
-			 [_bridge stateForEvent:event],
+			 stateForCurrentEvent(),
 			 QString::fromNSString([event characters]),
 			 true);
 	
 	result = result && node->dispatchKeyEvent(&qEvent);
     }
 
-    _currentEvent = nil;
+    _currentEvent = oldCurrentEvent;
 
     return result;
 }
@@ -721,19 +721,19 @@ bool KWQKHTMLPart::closeURL()
 
 void KWQKHTMLPart::khtmlMousePressEvent(MousePressEvent *event)
 {
-    if (!handleMouseDownEventForWidget(event)) {
+    if (!passWidgetMouseDownEventToWidget(event)) {
         KHTMLPart::khtmlMousePressEvent(event);
     }
 }
 
 void KWQKHTMLPart::khtmlMouseDoubleClickEvent(MouseDoubleClickEvent *event)
 {
-    if (!handleMouseDownEventForWidget(event)) {
+    if (!passWidgetMouseDownEventToWidget(event)) {
         KHTMLPart::khtmlMouseDoubleClickEvent(event);
     }
 }
 
-bool KWQKHTMLPart::handleMouseDownEventForWidget(khtml::MouseEvent *event)
+bool KWQKHTMLPart::passWidgetMouseDownEventToWidget(khtml::MouseEvent *event)
 {
     _mouseDownView = nil;
     
@@ -742,10 +742,10 @@ bool KWQKHTMLPart::handleMouseDownEventForWidget(khtml::MouseEvent *event)
     if (!target || !target->isWidget()) {
         return false;
     }
-    return handleMouseDownEventForWidget(static_cast<RenderWidget *>(target));
+    return passWidgetMouseDownEventToWidget(static_cast<RenderWidget *>(target));
 }
 
-bool KWQKHTMLPart::handleMouseDownEventForWidget(RenderWidget *renderWidget)
+bool KWQKHTMLPart::passWidgetMouseDownEventToWidget(RenderWidget *renderWidget)
 {
     _mouseDownView = nil;
     
@@ -763,7 +763,10 @@ bool KWQKHTMLPart::handleMouseDownEventForWidget(RenderWidget *renderWidget)
         return false;
     }
     
+    ASSERT(!_sendingEventToSubview);
+    _sendingEventToSubview = true;
     [view mouseDown:_currentEvent];
+    _sendingEventToSubview = false;
     
     // Remember which view we sent the event to, so we can direct the release event properly.
     _mouseDownView = view;
@@ -779,7 +782,9 @@ void KWQKHTMLPart::khtmlMouseReleaseEvent(MouseReleaseEvent *event)
         return;
     }
     
+    _sendingEventToSubview = true;
     [_mouseDownView mouseUp:_currentEvent];
+    _sendingEventToSubview = false;
     _mouseDownView = nil;
 }
 
@@ -816,7 +821,7 @@ bool KWQKHTMLPart::passSubframeEventToSubframe(DOM::NodeImpl::MouseEvent &event)
             if (!renderPart) {
                 return false;
             }
-            if (!handleMouseDownEventForWidget(renderPart)) {
+            if (!passWidgetMouseDownEventToWidget(renderPart)) {
                 return false;
             }
             _mouseDownWasInSubframe = true;
@@ -826,16 +831,131 @@ bool KWQKHTMLPart::passSubframeEventToSubframe(DOM::NodeImpl::MouseEvent &event)
             if (!(_mouseDownView && _mouseDownWasInSubframe)) {
                 return false;
             }
+            ASSERT(!_sendingEventToSubview);
+            _sendingEventToSubview = true;
             [_mouseDownView mouseUp:_currentEvent];
+            _sendingEventToSubview = false;
             _mouseDownView = nil;
             return true;
         case NSLeftMouseDragged:
             if (!(_mouseDownView && _mouseDownWasInSubframe)) {
                 return false;
             }
+            ASSERT(!_sendingEventToSubview);
+            _sendingEventToSubview = true;
             [_mouseDownView mouseDragged:_currentEvent];
+            _sendingEventToSubview = false;
             return true;
         default:
             return false;
     }
 }
+
+int KWQKHTMLPart::buttonForCurrentEvent()
+{
+    switch ([_currentEvent type]) {
+    case NSLeftMouseDown:
+    case NSLeftMouseUp:
+        return Qt::LeftButton;
+    case NSRightMouseDown:
+    case NSRightMouseUp:
+        return Qt::RightButton;
+    case NSOtherMouseDown:
+    case NSOtherMouseUp:
+        return Qt::MidButton;
+    default:
+        return 0;
+    }
+}
+
+int KWQKHTMLPart::stateForCurrentEvent()
+{
+    int state = buttonForCurrentEvent();
+    
+    unsigned modifiers = [_currentEvent modifierFlags];
+
+    if (modifiers & NSControlKeyMask)
+        state |= Qt::ControlButton;
+    if (modifiers & NSShiftKeyMask)
+        state |= Qt::ShiftButton;
+    if (modifiers & NSAlternateKeyMask)
+        state |= Qt::AltButton;
+    if (modifiers & NSCommandKeyMask)
+        state |= Qt::MetaButton;
+    
+    return state;
+}
+
+void KWQKHTMLPart::mouseDown(NSEvent *event)
+{
+    if (!d->m_view || _sendingEventToSubview) {
+        return;
+    }
+
+    NSEvent *oldCurrentEvent = _currentEvent;
+    _currentEvent = event;
+
+    QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint([event locationInWindow]),
+        buttonForCurrentEvent(), stateForCurrentEvent(), [event clickCount]);
+    d->m_view->viewportMousePressEvent(&kEvent);
+    
+    _currentEvent = oldCurrentEvent;
+}
+
+void KWQKHTMLPart::mouseDragged(NSEvent *event)
+{
+    if (!d->m_view || _sendingEventToSubview) {
+        return;
+    }
+
+    NSEvent *oldCurrentEvent = _currentEvent;
+    _currentEvent = event;
+
+    QMouseEvent kEvent(QEvent::MouseMove, QPoint([event locationInWindow]), Qt::LeftButton, Qt::LeftButton);
+    d->m_view->viewportMouseMoveEvent(&kEvent);
+    
+    _currentEvent = oldCurrentEvent;
+}
+
+void KWQKHTMLPart::mouseUp(NSEvent *event)
+{
+    if (!d->m_view || _sendingEventToSubview) {
+        return;
+    }
+    
+    NSEvent *oldCurrentEvent = _currentEvent;
+    _currentEvent = event;
+
+    // Our behavior here is a little different that Qt. Qt always sends
+    // a mouse release event, even for a double click. To correct problems
+    // in khtml's DOM click event handling we do not send a release here
+    // for a double click. Instead we send that event from KHTMLView's
+    // viewportMouseDoubleClickEvent.
+    int clickCount = [event clickCount];
+    if (clickCount > 0 && clickCount % 2 == 0) {
+        QMouseEvent doubleClickEvent(QEvent::MouseButtonDblClick, QPoint([event locationInWindow]),
+            buttonForCurrentEvent(), stateForCurrentEvent(), clickCount);
+        d->m_view->viewportMouseDoubleClickEvent(&doubleClickEvent);
+    } else {
+        QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint([event locationInWindow]),
+            buttonForCurrentEvent(), stateForCurrentEvent(), clickCount);
+        d->m_view->viewportMouseReleaseEvent(&releaseEvent);
+    }
+    
+    _currentEvent = oldCurrentEvent;
+}
+
+void KWQKHTMLPart::mouseMoved(NSEvent *event)
+{
+    if (!d->m_view) {
+        return;
+    }
+    
+    NSEvent *oldCurrentEvent = _currentEvent;
+    _currentEvent = event;
+    
+    QMouseEvent kEvent(QEvent::MouseMove, QPoint([event locationInWindow]), 0, stateForCurrentEvent());
+    d->m_view->viewportMouseMoveEvent(&kEvent);
+    
+    _currentEvent = oldCurrentEvent;
+}
diff --git a/WebCore/kwq/KWQScrollView.h b/WebCore/kwq/KWQScrollView.h
index 2f7e301..1b7d475 100644
--- a/WebCore/kwq/KWQScrollView.h
+++ b/WebCore/kwq/KWQScrollView.h
@@ -76,6 +76,8 @@ public:
 
     void ensureVisible(int,int);
     void ensureVisible(int,int,int,int);
+    
+    NSView *getDocumentView();
 };
 
 #endif
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 5c82d9f..2395aac 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -418,133 +418,24 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
     }
 }
 
-- (int)stateForEvent:(NSEvent *)event
+- (void)mouseDown:(NSEvent *)event
 {
-    unsigned modifiers = [event modifierFlags];
-    int state = 0;
-    
-    if (modifiers & NSControlKeyMask)
-        state |= Qt::ControlButton;
-    if (modifiers & NSShiftKeyMask)
-        state |= Qt::ShiftButton;
-    if (modifiers & NSAlternateKeyMask)
-        state |= Qt::AltButton;
-    
-    // Mapping command to meta is slightly questionable, but it works for now.
-    if (modifiers & NSCommandKeyMask)
-        state |= Qt::MetaButton;
-    
-    return state;
+    _part->mouseDown(event);
 }
 
-- (void)mouseUp:(NSEvent *)event
+- (void)mouseDragged:(NSEvent *)event
 {
-    if (!_part->view()) {
-        return;
-    }
-    
-    KWQKHTMLPart::setCurrentEvent(event);
-
-    NSPoint p = [event locationInWindow];
-
-    int button, state;
-    switch ([event type]) {
-    case NSRightMouseUp:
-        button = Qt::RightButton;
-        state = Qt::RightButton;
-        break;
-    case NSOtherMouseUp:
-        button = Qt::MidButton;
-        state = Qt::MidButton;
-        break;
-    default:
-        button = Qt::LeftButton;
-        state = Qt::LeftButton;
-        break;
-    }
-    state |= [self stateForEvent:event];
-    
-    int clickCount = [event clickCount];
-
-    // Our behavior here is a little different that Qt.  Qt always sends
-    // a mouse release event, even for a double click.  To correct problems
-    // in khtml's DOM click event handling we do not send a release here
-    // for a double click.  Instead we send that event from khtmlview's
-    // viewportMouseDoubleClickEvent.
-    if (clickCount > 0 && clickCount % 2 == 0) {
-        QMouseEvent doubleClickEvent(QEvent::MouseButtonDblClick, QPoint(p), button, state, clickCount);
-        _part->view()->viewportMouseDoubleClickEvent(&doubleClickEvent);
-    } else {
-        QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(p), button, state, clickCount);
-        _part->view()->viewportMouseReleaseEvent(&releaseEvent);
-    }
-    
-    KWQKHTMLPart::setCurrentEvent(nil);
+    _part->mouseDragged(event);
 }
 
-- (void)mouseDown:(NSEvent *)event
+- (void)mouseUp:(NSEvent *)event
 {
-    if (!_part->view()) {
-        return;
-    }
-    
-    KWQKHTMLPart::setCurrentEvent(event);
-
-    NSPoint p = [event locationInWindow];
-    
-    int button, state;     
-    switch ([event type]) {
-    case NSRightMouseDown:
-        button = Qt::RightButton;
-        state = Qt::RightButton;
-        break;
-    case NSOtherMouseDown:
-        button = Qt::MidButton;
-        state = Qt::MidButton;
-        break;
-    default:
-        button = Qt::LeftButton;
-        state = Qt::LeftButton;
-        break;
-    }
-    state |= [self stateForEvent:event];
-    
-    QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint(p), button, state, [event clickCount]);
-    _part->view()->viewportMousePressEvent(&kEvent);
-    
-    KWQKHTMLPart::setCurrentEvent(nil);
+    _part->mouseUp(event);
 }
 
 - (void)mouseMoved:(NSEvent *)event
 {
-    if (!_part->view()) {
-        return;
-    }
-    
-    KWQKHTMLPart::setCurrentEvent(event);
-    
-    NSPoint p = [event locationInWindow];
-    
-    QMouseEvent kEvent(QEvent::MouseMove, QPoint(p), 0, [self stateForEvent:event]);
-    _part->view()->viewportMouseMoveEvent(&kEvent);
-    
-    KWQKHTMLPart::setCurrentEvent(nil);
-}
-
-- (void)mouseDragged:(NSEvent *)event
-{
-    if (!_part->view()) {
-        return;
-    }
-    
-    KWQKHTMLPart::setCurrentEvent(event);
-
-    NSPoint p = [event locationInWindow];
-    
-    QMouseEvent kEvent(QEvent::MouseMove, QPoint(p), Qt::LeftButton, Qt::LeftButton);
-    _part->view()->viewportMouseMoveEvent(&kEvent);
-    
-    KWQKHTMLPart::setCurrentEvent(nil);
+    _part->mouseMoved(event);
 }
 
 - (NSDictionary *)elementAtPoint:(NSPoint)point
diff --git a/WebCore/kwq/WebCoreBridgePrivate.h b/WebCore/kwq/WebCoreBridgePrivate.h
deleted file mode 100644
index 96a7a73..0000000
--- a/WebCore/kwq/WebCoreBridgePrivate.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2002 Apple Computer, Inc.  All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
- * 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 <WebCore/WebCoreBridge.h>
-
- at interface WebCoreBridge (WebCorePrivate)
-
-- (int)stateForEvent:(NSEvent *)event;
-
- at end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index bda0a7b..b95a758 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2002-12-12  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej and Richard.
+
+        - fixed reentrancy crash I ran into while debugging infinite recursion bugs
+
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (-[WebHTMLView _updateMouseoverWithFakeEvent]): Added. Does part of what _frameOrBoundsChanged did.
+        (-[WebHTMLView _frameOrBoundsChanged]): Schedule the mouseover update to happen soon, rather than
+        doing it right away. If we do it right away, we might reenter because sending a mouse moved event
+        can result in another layout since mouse moved events are the same as mouse dragged events in KHTML.
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView viewWillMoveToWindow:]): Cancel the scheduled mouseover update.
+
+        * WebKit.pbproj/project.pbxproj: Electron uber alles.
+
 2002-12-12  Richard Williamson   <rjw at apple.com>
 
         Fixed 3125585.  One click crasher option clicking on
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index a0e65c5..05840d8 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -185,7 +185,6 @@
 </dict>
 </plist>
 ";
-			shouldUseHeadermap = 0;
 		};
 		0867D69DFE84028FC02AAC07 = {
 			buildActionMask = 2147483647;
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index fa053d6..41861ef 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -231,6 +231,7 @@
     [self removeMouseMovedObserver];
     [self removeWindowObservers];
     [self removeSuperviewObservers];
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_updateMouseoverWithFakeEvent) object:nil];
 }
 
 - (void)viewDidMoveToWindow
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index 62cb6fc..5c9ea0d 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -136,13 +136,8 @@ static BOOL doRealHitTest = NO;
         userInfo:[NSDictionary dictionaryWithObject:fakeEvent forKey:@"NSEvent"]];
 }
 
-- (void)_frameOrBoundsChanged
+- (void)_updateMouseoverWithFakeEvent
 {
-    if (!NSEqualSizes(_private->lastLayoutSize, [(NSClipView *)[self superview] documentVisibleRect].size)) {
-        [self setNeedsLayout:YES];
-        [self setNeedsDisplay:YES];
-    }
-    
     NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
         location:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
         modifierFlags:[[NSApp currentEvent] modifierFlags]
@@ -154,6 +149,17 @@ static BOOL doRealHitTest = NO;
     [self _updateMouseoverWithEvent:fakeEvent];
 }
 
+- (void)_frameOrBoundsChanged
+{
+    if (!NSEqualSizes(_private->lastLayoutSize, [(NSClipView *)[self superview] documentVisibleRect].size)) {
+        [self setNeedsLayout:YES];
+        [self setNeedsDisplay:YES];
+    }
+    
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_updateMouseoverWithFakeEvent) object:nil];
+    [self performSelector:@selector(_updateMouseoverWithFakeEvent) withObject:nil afterDelay:0];
+}
+
 - (NSDictionary *)_elementAtPoint:(NSPoint)point
 {
     NSDictionary *elementInfoWC = [[self _bridge] elementAtPoint:point];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list