[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:15:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b50226ef4d298681ff5e5d6a048f6c7aac1cb1c5
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 16 00:42:44 2002 +0000

            Reviewed by Dave.
    
    	- fixed 3127900 -- REGRESSION: text fields select all their text when clicked on with the mouse
    
            * kwq/KWQKHTMLPart.h: Add _firstResponderAtMouseDownTime.
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::khtmlMousePressEvent): Don't call makeFirstResponder: if it's already set.
            (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Using _firstResponderAtMouseDownTime, catch the
    	case where an NSTextField's editor was just created and became first responder. In those cases,
    	pass the mouseDown: to the text field, not the newly created editor. Even though it shouldn't make
    	a difference it does. Also don't makeFirstResponder: if it's already set.
            (KWQKHTMLPart::mouseDown): Set _firstResponderAtMouseDownTime.
    
            * kwq/KWQWidget.mm: (QWidget::setFocus): Don't call makeFirstResponder: if it's already set.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3066 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 7712dcb..59170e2 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2002-12-15  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+	- fixed 3127900 -- REGRESSION: text fields select all their text when clicked on with the mouse
+
+        * kwq/KWQKHTMLPart.h: Add _firstResponderAtMouseDownTime.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::khtmlMousePressEvent): Don't call makeFirstResponder: if it's already set.
+        (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Using _firstResponderAtMouseDownTime, catch the
+	case where an NSTextField's editor was just created and became first responder. In those cases,
+	pass the mouseDown: to the text field, not the newly created editor. Even though it shouldn't make
+	a difference it does. Also don't makeFirstResponder: if it's already set.
+        (KWQKHTMLPart::mouseDown): Set _firstResponderAtMouseDownTime.
+
+        * kwq/KWQWidget.mm: (QWidget::setFocus): Don't call makeFirstResponder: if it's already set.
+
 2002-12-15  David Hyatt  <hyatt at apple.com>
 
 	Make sure framesets don't get built twice when FOUC delays
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7712dcb..59170e2 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2002-12-15  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+	- fixed 3127900 -- REGRESSION: text fields select all their text when clicked on with the mouse
+
+        * kwq/KWQKHTMLPart.h: Add _firstResponderAtMouseDownTime.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::khtmlMousePressEvent): Don't call makeFirstResponder: if it's already set.
+        (KWQKHTMLPart::passWidgetMouseDownEventToWidget): Using _firstResponderAtMouseDownTime, catch the
+	case where an NSTextField's editor was just created and became first responder. In those cases,
+	pass the mouseDown: to the text field, not the newly created editor. Even though it shouldn't make
+	a difference it does. Also don't makeFirstResponder: if it's already set.
+        (KWQKHTMLPart::mouseDown): Set _firstResponderAtMouseDownTime.
+
+        * kwq/KWQWidget.mm: (QWidget::setFocus): Don't call makeFirstResponder: if it's already set.
+
 2002-12-15  David Hyatt  <hyatt at apple.com>
 
 	Make sure framesets don't get built twice when FOUC delays
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 2cc7e3d..c8fb56a 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -43,13 +43,15 @@ namespace KJS {
 #ifdef __OBJC__
 @class NSAttributedString;
 @class NSEvent;
+ at class NSResponder;
 @class NSView;
 @class WebCoreBridge;
 #else
 class NSAttributedString;
+class NSEvent;
+class NSResponder;
 class NSView;
 class WebCoreBridge;
-class NSEvent;
 #endif
 
 enum KWQSelectionDirection {
@@ -193,6 +195,7 @@ private:
     bool _sendingEventToSubview;
     
     static NSEvent *_currentEvent;
+    static NSResponder *_firstResponderAtMouseDownTime;
 
     static QPtrList<KWQKHTMLPart> &mutableInstances();
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 7895f0d..81143ac 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -74,6 +74,7 @@ using KParts::ReadOnlyPart;
 using KParts::URLArgs;
 
 NSEvent *KWQKHTMLPart::_currentEvent = nil;
+NSResponder *KWQKHTMLPart::_firstResponderAtMouseDownTime = nil;
 
 void KHTMLPart::completed()
 {
@@ -725,8 +726,11 @@ void KWQKHTMLPart::khtmlMousePressEvent(MousePressEvent *event)
     if (!passWidgetMouseDownEventToWidget(event)) {
         // We don't do this at the start of mouse down handling, because we don't want to do it until
         // we know we didn't hit a widget.
-        NSView *documentView = view()->getDocumentView();
-        [[documentView window] makeFirstResponder:documentView];
+        NSView *view = d->m_view->getDocumentView();
+        NSWindow *window = [view window];
+        if ([window firstResponder] != view) {
+            [window makeFirstResponder:view];
+        }
         
         KHTMLPart::khtmlMousePressEvent(event);
     }
@@ -764,11 +768,31 @@ bool KWQKHTMLPart::passWidgetMouseDownEventToWidget(RenderWidget *renderWidget)
         ERROR("KHTML says we hit a RenderWidget, but AppKit doesn't agree we hit the corresponding NSView");
         return false;
     }
-
-    // Normally [NSWindow sendEvent:] handles this.
-    // But in our case, the event was sent to the view representing the entire web page.
-    if ([view acceptsFirstResponder]) {
-        [[view window] makeFirstResponder:view];
+    
+    NSWindow *window = [view window];
+    if ([window firstResponder] == view) {
+        // In the case where we just became first responder, we should send the mouseDown:
+        // to the NSTextField, not the NSTextField's editor. This code makes sure that happens.
+        // If we don't do this, we see a flash of selected text when clicking in a text field.
+        if (_firstResponderAtMouseDownTime != view && [view isKindOfClass:[NSTextView class]]) {
+            NSView *superview = view;
+            while (superview != nodeView) {
+                superview = [superview superview];
+                ASSERT(superview);
+                if ([superview isKindOfClass:[NSControl class]]) {
+                    if ([(NSControl *)superview currentEditor] == view) {
+                        view = superview;
+                    }
+                    break;
+                }
+            }
+        }
+    } else {
+        // Normally [NSWindow sendEvent:] handles setting the first responder.
+        // But in our case, the event was sent to the view representing the entire web page.
+        if ([view acceptsFirstResponder]) {
+            [window makeFirstResponder:view];
+        }
     }
 
     ASSERT(!_sendingEventToSubview);
@@ -955,12 +979,17 @@ void KWQKHTMLPart::mouseDown(NSEvent *event)
 
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = event;
+    
+    NSResponder *oldFirstResponderAtMouseDownTime = _firstResponderAtMouseDownTime;
+    _firstResponderAtMouseDownTime = [[[d->m_view->getView() window] firstResponder] retain];
 
     QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint([event locationInWindow]),
         buttonForCurrentEvent(), stateForCurrentEvent(), [event clickCount]);
     d->m_view->viewportMousePressEvent(&kEvent);
     
     _currentEvent = oldCurrentEvent;
+    [_firstResponderAtMouseDownTime release];
+    _firstResponderAtMouseDownTime = oldFirstResponderAtMouseDownTime;
 }
 
 void KWQKHTMLPart::mouseDragged(NSEvent *event)
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index d7d244a..1da5de0 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -196,7 +196,11 @@ void QWidget::setFocus()
         renderWidget->view()->addChild(this, x, y);
     }
     
-    [[getView() window] makeFirstResponder:getView()];
+    NSView *view = getView();
+    NSWindow *window = [view window];
+    if ([window firstResponder] != view && [view acceptsFirstResponder]) {
+        [window makeFirstResponder:view];
+    }
 }
 
 void QWidget::clearFocus()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list