[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:13:08 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9c03760cf1fbe8e0b6978346653c1ce56bd48d03
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 10 18:19:55 2002 +0000

    WebCore:
    
            Reviewed by John.
    
    	- fixed 3108912 -- onclick handlers not supported on form elements
    
    	We now pass the events back to the NSView here in WebCore; they pass through all the
    	machinery in the DOM before getting sent on.
    
            * kwq/KWQKHTMLPart.h: Add widgetWillReleaseView and handleMouseDownEventForWidget functions,
    	overrides for khtmlMousePressEvent, khtmlMouseDoubleClickEvent, khtmlMouseReleaseEvent, and
    	a new _mouseDownView field.
    
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::KWQKHTMLPart): Initialize _mouseDownView to nil.
            (KWQKHTMLPart::khtmlMousePressEvent): Call handleMouseDownEventForWidget, but if it returns
    	false call through to the base class function.
            (KWQKHTMLPart::khtmlMouseDoubleClickEvent): Ditto.
            (KWQKHTMLPart::handleMouseDownEventForWidget): Do a hit test to find out which view to send
    	the mouse down event to, and then send it.
            (KWQKHTMLPart::khtmlMouseReleaseEvent): Send the mouse up event to the view we sent a mouse
    	down event to, or call through to the base class otherwise.
            (KWQKHTMLPart::widgetWillReleaseView): Clear out the _mouseDownView field if the view is
    	being released by the QWidget that owns it.
    
            * kwq/KWQWidget.mm:
            (QWidget::~QWidget): Call KWQKHTMLPart::widgetWillReleaseView.
            (QWidget::setView): Call KWQKHTMLPart::widgetWillReleaseView on the old view.
    
    WebKit:
    
            Reviewed by John.
    
    	- fixed 3108912 -- onclick handlers not supported on form elements
    
            * WebView.subproj/WebHTMLView.m: (-[WebHTMLView hitTest:]):
    	Take over hit testing so that all clicks on subviews are handled by the WebHTMLView.
    	WebCore now handles getting the mouse events to the subviews after passing
    	the events through the DOM.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2987 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1ec36d9..a9cb6ce 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,32 @@
+2002-12-10  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3108912 -- onclick handlers not supported on form elements
+
+	We now pass the events back to the NSView here in WebCore; they pass through all the
+	machinery in the DOM before getting sent on.
+
+        * kwq/KWQKHTMLPart.h: Add widgetWillReleaseView and handleMouseDownEventForWidget functions,
+	overrides for khtmlMousePressEvent, khtmlMouseDoubleClickEvent, khtmlMouseReleaseEvent, and
+	a new _mouseDownView field.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart): Initialize _mouseDownView to nil.
+        (KWQKHTMLPart::khtmlMousePressEvent): Call handleMouseDownEventForWidget, but if it returns
+	false call through to the base class function.
+        (KWQKHTMLPart::khtmlMouseDoubleClickEvent): Ditto.
+        (KWQKHTMLPart::handleMouseDownEventForWidget): Do a hit test to find out which view to send
+	the mouse down event to, and then send it.
+        (KWQKHTMLPart::khtmlMouseReleaseEvent): Send the mouse up event to the view we sent a mouse
+	down event to, or call through to the base class otherwise.
+        (KWQKHTMLPart::widgetWillReleaseView): Clear out the _mouseDownView field if the view is
+	being released by the QWidget that owns it.
+
+        * kwq/KWQWidget.mm:
+        (QWidget::~QWidget): Call KWQKHTMLPart::widgetWillReleaseView.
+        (QWidget::setView): Call KWQKHTMLPart::widgetWillReleaseView on the old view.
+
 2002-12-09  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1ec36d9..a9cb6ce 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,32 @@
+2002-12-10  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3108912 -- onclick handlers not supported on form elements
+
+	We now pass the events back to the NSView here in WebCore; they pass through all the
+	machinery in the DOM before getting sent on.
+
+        * kwq/KWQKHTMLPart.h: Add widgetWillReleaseView and handleMouseDownEventForWidget functions,
+	overrides for khtmlMousePressEvent, khtmlMouseDoubleClickEvent, khtmlMouseReleaseEvent, and
+	a new _mouseDownView field.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart): Initialize _mouseDownView to nil.
+        (KWQKHTMLPart::khtmlMousePressEvent): Call handleMouseDownEventForWidget, but if it returns
+	false call through to the base class function.
+        (KWQKHTMLPart::khtmlMouseDoubleClickEvent): Ditto.
+        (KWQKHTMLPart::handleMouseDownEventForWidget): Do a hit test to find out which view to send
+	the mouse down event to, and then send it.
+        (KWQKHTMLPart::khtmlMouseReleaseEvent): Send the mouse up event to the view we sent a mouse
+	down event to, or call through to the base class otherwise.
+        (KWQKHTMLPart::widgetWillReleaseView): Clear out the _mouseDownView field if the view is
+	being released by the QWidget that owns it.
+
+        * kwq/KWQWidget.mm:
+        (QWidget::~QWidget): Call KWQKHTMLPart::widgetWillReleaseView.
+        (QWidget::setView): Call KWQKHTMLPart::widgetWillReleaseView on the old view.
+
 2002-12-09  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 4147b1a..b165c3c 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -143,9 +143,17 @@ public:
 
     void addMetaData(const QString &key, const QString &value);
 
-    bool keyEvent(NSEvent *event);
+    bool keyEvent(NSEvent *);
+    
+    static void widgetWillReleaseView(NSView *);
     
 private:
+    virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
+    virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
+    virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *);
+    
+    bool handleMouseDownEventForWidget(khtml::MouseEvent *);
+
     void setPolicyBaseURL(const DOM::DOMString &);
 
     WebCoreBridge *bridgeForFrameName(const QString &frameName);
@@ -163,6 +171,8 @@ private:
     KWQSignal _completedWithBool;
     
     bool _ownsView;
+    
+    NSView *_mouseDownView;
 
     static QPtrList<KWQKHTMLPart> &mutableInstances();
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 816d1b0..7b95465 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -47,9 +47,17 @@
 
 #undef _KWQ_TIMING
 
+using DOM::DocumentImpl;
+using DOM::DOMString;
+using DOM::EventImpl;
+using DOM::Node;
+
 using khtml::Cache;
 using khtml::ChildFrame;
 using khtml::Decoder;
+using khtml::MouseDoubleClickEvent;
+using khtml::MousePressEvent;
+using khtml::MouseReleaseEvent;
 using khtml::RenderObject;
 using khtml::RenderPart;
 using khtml::RenderText;
@@ -57,6 +65,9 @@ using khtml::RenderWidget;
 
 using KIO::Job;
 
+using KJS::SavedProperties;
+using KJS::Window;
+
 using KParts::ReadOnlyPart;
 using KParts::URLArgs;
 
@@ -72,7 +83,7 @@ void KHTMLPart::completed(bool arg)
     KWQ(this)->_completed.call(arg);
 }
 
-void KHTMLPart::nodeActivated(const DOM::Node &aNode)
+void KHTMLPart::nodeActivated(const Node &)
 {
 }
 
@@ -107,6 +118,7 @@ KWQKHTMLPart::KWQKHTMLPart()
     , _completed(this, SIGNAL(completed()))
     , _completedWithBool(this, SIGNAL(completed(bool)))
     , _ownsView(false)
+    , _mouseDownView(nil)
 {
     Cache::init();
     mutableInstances().prepend(this);
@@ -412,34 +424,34 @@ bool KWQKHTMLPart::canCachePage()
         (d->m_frames.count() ||
         parentPart() ||
         d->m_objects.count() ||
-        d->m_doc->getWindowEventListener (DOM::EventImpl::UNLOAD_EVENT) ||
-        (d->m_jscript && KJS::Window::retrieveWindow(this)->hasTimeouts()))){
+        d->m_doc->getWindowEventListener (EventImpl::UNLOAD_EVENT) ||
+        (d->m_jscript && Window::retrieveWindow(this)->hasTimeouts()))){
         return false;
     }
     return true;
 }
 
-void KWQKHTMLPart::saveWindowProperties(KJS::SavedProperties *windowProperties)
+void KWQKHTMLPart::saveWindowProperties(SavedProperties *windowProperties)
 {
-    KJS::Window::retrieveWindow(this)->saveProperties(*windowProperties);
+    Window::retrieveWindow(this)->saveProperties(*windowProperties);
 }
 
-void KWQKHTMLPart::saveLocationProperties(KJS::SavedProperties *locationProperties)
+void KWQKHTMLPart::saveLocationProperties(SavedProperties *locationProperties)
 {
-    KJS::Window::retrieveWindow(this)->location()->saveProperties(*locationProperties);
+    Window::retrieveWindow(this)->location()->saveProperties(*locationProperties);
 }
 
-void KWQKHTMLPart::restoreWindowProperties(KJS::SavedProperties *windowProperties)
+void KWQKHTMLPart::restoreWindowProperties(SavedProperties *windowProperties)
 {
-    KJS::Window::retrieveWindow(this)->restoreProperties(*windowProperties);
+    Window::retrieveWindow(this)->restoreProperties(*windowProperties);
 }
 
-void KWQKHTMLPart::restoreLocationProperties(KJS::SavedProperties *locationProperties)
+void KWQKHTMLPart::restoreLocationProperties(SavedProperties *locationProperties)
 {
-    KJS::Window::retrieveWindow(this)->location()->restoreProperties(*locationProperties);
+    Window::retrieveWindow(this)->location()->restoreProperties(*locationProperties);
 }
 
-void KWQKHTMLPart::openURLFromPageCache(DOM::DocumentImpl *doc, KURL *url, KJS::SavedProperties *windowProperties, KJS::SavedProperties *locationProperties)
+void KWQKHTMLPart::openURLFromPageCache(DocumentImpl *doc, KURL *url, SavedProperties *windowProperties, SavedProperties *locationProperties)
 {
     d->m_redirectionTimer.stop();
 
@@ -561,7 +573,7 @@ void KWQKHTMLPart::updatePolicyBaseURL()
     }
 }
 
-void KWQKHTMLPart::setPolicyBaseURL(const DOM::DOMString &s)
+void KWQKHTMLPart::setPolicyBaseURL(const DOMString &s)
 {
     // XML documents will cause this to return null.  docImpl() is
     // an HTMLdocument only. -dwh
@@ -702,6 +714,74 @@ void KWQKHTMLPart::scrollToAnchor(const KURL &URL)
 
 bool KWQKHTMLPart::closeURL()
 {
-  saveDocumentState();
-  return KHTMLPart::closeURL();
+    saveDocumentState();
+    return KHTMLPart::closeURL();
+}
+
+void KWQKHTMLPart::khtmlMousePressEvent(MousePressEvent *event)
+{
+    if (!handleMouseDownEventForWidget(event)) {
+        KHTMLPart::khtmlMousePressEvent(event);
+    }
+}
+
+void KWQKHTMLPart::khtmlMouseDoubleClickEvent(MouseDoubleClickEvent *event)
+{
+    if (!handleMouseDownEventForWidget(event)) {
+        KHTMLPart::khtmlMouseDoubleClickEvent(event);
+    }
+}
+
+bool KWQKHTMLPart::handleMouseDownEventForWidget(khtml::MouseEvent *event)
+{
+    _mouseDownView = nil;
+    
+    // Figure out which view to send the event to.
+    RenderObject *target = event->innerNode().handle()->renderer();
+    if (!target->isWidget()) {
+        return false;
+    }
+    NSView *outerView = static_cast<RenderWidget *>(target)->widget()->getOuterView();
+    ASSERT(outerView);
+    ASSERT([outerView superview]);
+    NSView *topView = outerView;
+    NSView *superview;
+    while ((superview = [topView superview])) {
+        topView = superview;
+    }
+    NSView *view = [outerView hitTest:[[outerView superview] convertPoint:[[NSApp currentEvent] locationInWindow] fromView:topView]];
+    if (view == nil) {
+        ERROR("KHTML says we hit a RenderWidget, but AppKit doesn't agree we hit the corresponding NSView");
+        return false;
+    }
+    
+    [view mouseDown:[NSApp currentEvent]];
+    
+    // Remember which view we sent the event to, so we can direct the release event properly.
+    _mouseDownView = view;
+    
+    return true;
+}
+
+void KWQKHTMLPart::khtmlMouseReleaseEvent(MouseReleaseEvent *event)
+{
+    if (!_mouseDownView) {
+        KHTMLPart::khtmlMouseReleaseEvent(event);
+        return;
+    }
+    
+    [_mouseDownView mouseUp:[NSApp currentEvent]];
+    _mouseDownView = nil;
+}
+
+void KWQKHTMLPart::widgetWillReleaseView(NSView *view)
+{
+    if (view == nil) {
+        return;
+    }
+    for (QPtrListIterator<KWQKHTMLPart> it(instances()); it.current(); ++it) {
+        if ([it.current()->_mouseDownView isDescendantOf:view]) {
+            it.current()->_mouseDownView = nil;
+        }
+    }
 }
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 455c76a..1706d7e 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -72,6 +72,7 @@ QWidget::QWidget(NSView *view)
 
 QWidget::~QWidget() 
 {
+    KWQKHTMLPart::widgetWillReleaseView(getOuterView());
     [data->view release];
     delete data;
 }
@@ -344,17 +345,20 @@ NSView *QWidget::getView() const
 
 void QWidget::setView(NSView *view)
 {
-    [view retain];
+    if (view == data->view) {
+        return;
+    }
+    
+    KWQKHTMLPart::widgetWillReleaseView(getOuterView());
     [data->view release];
-    data->view = view;
+    data->view = [view retain];
 }
 
 NSView *QWidget::getOuterView() const
 {
-    // A QScrollView is a widget only used to represent a frame.  If
-    // this widget's view is a WebCoreFrameView the we resize it's containing
-    // view,  an WebView.  The scrollview contained by the WebView
-    // will be autosized.
+    // A QScrollView is a widget normally used to represent a frame.
+    // If this widget's view is a WebCoreFrameView the we resize its containing view, a WebView.
+    // The scroll view contained by the WebView will be autosized.
     NSView *view = data->view;
     ASSERT(view);
     if ([view conformsToProtocol:@protocol(WebCoreFrameView)]) {
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 4cad048..238b49a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2002-12-10  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3108912 -- onclick handlers not supported on form elements
+
+        * WebView.subproj/WebHTMLView.m: (-[WebHTMLView hitTest:]):
+	Take over hit testing so that all clicks on subviews are handled by the WebHTMLView.
+	WebCore now handles getting the mouse events to the subviews after passing
+	the events through the DOM.
+
 2002-12-09  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Trey.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 4b6c3f5..da3ab62 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -924,14 +924,10 @@
 {
 }
 
-#if 0
-
 - (NSView *)hitTest:(NSPoint)point
 {
-    // We handle all clicks. We don't allow subviews to handle them.
+    // We handle all clicks. They are passed along to subviews by WebCore.
     return [super hitTest:point] ? self : nil;
 }
 
-#endif
-
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list