[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 06:39:44 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 7c54faaf205cff42810ef691b19761eb1e8296e0
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 18 18:28:47 2002 +0000

    	- fixed 3037974 -- successful Find does not deselect text field
    
            * khtml/khtml_part.cpp: (KHTMLPart::checkCompleted):
    	Turn off the code that restores the cursor position because we don't
    	use the KHTML saveState/restoreState. But we should.
    
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::setSelection): Call setFocusNode(0), because on the
    	Macintosh, selection and focus are mutually exclusive.
            (DocumentImpl::close): Remove no-longer-needed APPLE_CHANGES.
            (DocumentImpl::setFocusNode): Set focus to the KHTMLView when focus
    	is being removed from a particular node. Clear the selection when
    	focus is set on a particular node because on the Macintosh, selection
    	and focus are mutually exclusive.
    
            * kwq/KWQKHTMLPartImpl.h: Add set/clearDocumentFocus functions that we can use
    	to keep document's idea of focused node in sync. with AppKit's.
            * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::setDocumentFocus): Added.
    	(KWQKHTMLPartImpl::clearDocumentFocus): Added.
    
            * kwq/KWQNSTextField.mm:
            (-[KWQNSTextField becomeFirstResponder]): Call setDocumentFocus.
            (-[KWQSecureTextField becomeFirstResponder]): Call setDocumentFocus.
    
            * kwq/qt/qwidget.h: Removed endEditing().
            * kwq/KWQWidget.mm: (QWidget::clearFocus): Call clearDocumentFocus.
    	(QWidget::endEditing): Removed.
    
            * khtml/rendering/render_form.h:
            * khtml/rendering/render_form.cpp:
            (RenderImageButton::RenderImageButton): Remove the KWQInvisibleButton
    	hack, which is no longer needed.
            * kwq/KWQInvisibleButton.h: Removed.
            * kwq/KWQInvisibleButton.mm: Removed.
            * WebCore.pbproj/project.pbxproj: Removed KWQInvisibleButton.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2082 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 00e8004..52ee6ce 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,43 @@
 2002-09-18  Darin Adler  <darin at apple.com>
 
+	- fixed 3037974 -- successful Find does not deselect text field
+
+        * khtml/khtml_part.cpp: (KHTMLPart::checkCompleted):
+	Turn off the code that restores the cursor position because we don't
+	use the KHTML saveState/restoreState. But we should.
+
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::setSelection): Call setFocusNode(0), because on the
+	Macintosh, selection and focus are mutually exclusive.
+        (DocumentImpl::close): Remove no-longer-needed APPLE_CHANGES.
+        (DocumentImpl::setFocusNode): Set focus to the KHTMLView when focus
+	is being removed from a particular node. Clear the selection when
+	focus is set on a particular node because on the Macintosh, selection
+	and focus are mutually exclusive.
+
+        * kwq/KWQKHTMLPartImpl.h: Add set/clearDocumentFocus functions that we can use
+	to keep document's idea of focused node in sync. with AppKit's.
+        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::setDocumentFocus): Added.
+	(KWQKHTMLPartImpl::clearDocumentFocus): Added.
+
+        * kwq/KWQNSTextField.mm:
+        (-[KWQNSTextField becomeFirstResponder]): Call setDocumentFocus.
+        (-[KWQSecureTextField becomeFirstResponder]): Call setDocumentFocus.
+
+        * kwq/qt/qwidget.h: Removed endEditing().
+        * kwq/KWQWidget.mm: (QWidget::clearFocus): Call clearDocumentFocus.
+	(QWidget::endEditing): Removed.
+
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderImageButton::RenderImageButton): Remove the KWQInvisibleButton
+	hack, which is no longer needed.
+        * kwq/KWQInvisibleButton.h: Removed.
+        * kwq/KWQInvisibleButton.mm: Removed.
+        * WebCore.pbproj/project.pbxproj: Removed KWQInvisibleButton.
+
+2002-09-18  Darin Adler  <darin at apple.com>
+
 	- fixed 3027470 -- hitting tab when the google.com text field is selected
 	(all bars hidden) makes border flash
 
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 00e8004..52ee6ce 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,43 @@
 2002-09-18  Darin Adler  <darin at apple.com>
 
+	- fixed 3037974 -- successful Find does not deselect text field
+
+        * khtml/khtml_part.cpp: (KHTMLPart::checkCompleted):
+	Turn off the code that restores the cursor position because we don't
+	use the KHTML saveState/restoreState. But we should.
+
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::setSelection): Call setFocusNode(0), because on the
+	Macintosh, selection and focus are mutually exclusive.
+        (DocumentImpl::close): Remove no-longer-needed APPLE_CHANGES.
+        (DocumentImpl::setFocusNode): Set focus to the KHTMLView when focus
+	is being removed from a particular node. Clear the selection when
+	focus is set on a particular node because on the Macintosh, selection
+	and focus are mutually exclusive.
+
+        * kwq/KWQKHTMLPartImpl.h: Add set/clearDocumentFocus functions that we can use
+	to keep document's idea of focused node in sync. with AppKit's.
+        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::setDocumentFocus): Added.
+	(KWQKHTMLPartImpl::clearDocumentFocus): Added.
+
+        * kwq/KWQNSTextField.mm:
+        (-[KWQNSTextField becomeFirstResponder]): Call setDocumentFocus.
+        (-[KWQSecureTextField becomeFirstResponder]): Call setDocumentFocus.
+
+        * kwq/qt/qwidget.h: Removed endEditing().
+        * kwq/KWQWidget.mm: (QWidget::clearFocus): Call clearDocumentFocus.
+	(QWidget::endEditing): Removed.
+
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderImageButton::RenderImageButton): Remove the KWQInvisibleButton
+	hack, which is no longer needed.
+        * kwq/KWQInvisibleButton.h: Removed.
+        * kwq/KWQInvisibleButton.mm: Removed.
+        * WebCore.pbproj/project.pbxproj: Removed KWQInvisibleButton.
+
+2002-09-18  Darin Adler  <darin at apple.com>
+
 	- fixed 3027470 -- hitting tab when the google.com text field is selected
 	(all bars hidden) makes border flash
 
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 00e8004..52ee6ce 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,43 @@
 2002-09-18  Darin Adler  <darin at apple.com>
 
+	- fixed 3037974 -- successful Find does not deselect text field
+
+        * khtml/khtml_part.cpp: (KHTMLPart::checkCompleted):
+	Turn off the code that restores the cursor position because we don't
+	use the KHTML saveState/restoreState. But we should.
+
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::setSelection): Call setFocusNode(0), because on the
+	Macintosh, selection and focus are mutually exclusive.
+        (DocumentImpl::close): Remove no-longer-needed APPLE_CHANGES.
+        (DocumentImpl::setFocusNode): Set focus to the KHTMLView when focus
+	is being removed from a particular node. Clear the selection when
+	focus is set on a particular node because on the Macintosh, selection
+	and focus are mutually exclusive.
+
+        * kwq/KWQKHTMLPartImpl.h: Add set/clearDocumentFocus functions that we can use
+	to keep document's idea of focused node in sync. with AppKit's.
+        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::setDocumentFocus): Added.
+	(KWQKHTMLPartImpl::clearDocumentFocus): Added.
+
+        * kwq/KWQNSTextField.mm:
+        (-[KWQNSTextField becomeFirstResponder]): Call setDocumentFocus.
+        (-[KWQSecureTextField becomeFirstResponder]): Call setDocumentFocus.
+
+        * kwq/qt/qwidget.h: Removed endEditing().
+        * kwq/KWQWidget.mm: (QWidget::clearFocus): Call clearDocumentFocus.
+	(QWidget::endEditing): Removed.
+
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderImageButton::RenderImageButton): Remove the KWQInvisibleButton
+	hack, which is no longer needed.
+        * kwq/KWQInvisibleButton.h: Removed.
+        * kwq/KWQInvisibleButton.mm: Removed.
+        * WebCore.pbproj/project.pbxproj: Removed KWQInvisibleButton.
+
+2002-09-18  Darin Adler  <darin at apple.com>
+
 	- fixed 3027470 -- hitting tab when the google.com text field is selected
 	(all bars hidden) makes border flash
 
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index ed68107..c9d54a4 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -193,7 +193,6 @@
 				F587856C02DE375901EA4122,
 				F587856D02DE375901EA4122,
 				F587857502DE375901EA4122,
-				F587857B02DE375901EA4122,
 				F587858002DE375901EA4122,
 				F587858C02DE375901EA4122,
 				F58785A502DE375901EA4122,
@@ -539,7 +538,6 @@
 				F587857802DE375901EA4122,
 				F587857902DE375901EA4122,
 				F587857A02DE375901EA4122,
-				F587857C02DE375901EA4122,
 				F587857D02DE375901EA4122,
 				F587857F02DE375901EA4122,
 				F587858102DE375901EA4122,
@@ -986,8 +984,6 @@
 				F58784DA02DE375901EA4122,
 				354F248902EE28590ACA2ACA,
 				354F248A02EE28590ACA2ACA,
-				F58784E902DE375901EA4122,
-				F58784EA02DE375901EA4122,
 				F58784EE02DE375901EA4122,
 				F58784EF02DE375901EA4122,
 				F58784FA02DE375901EA4122,
@@ -4345,18 +4341,6 @@
 			path = ../KWQInputDialog.mm;
 			refType = 4;
 		};
-		F58784E902DE375901EA4122 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = KWQInvisibleButton.h;
-			refType = 4;
-		};
-		F58784EA02DE375901EA4122 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = KWQInvisibleButton.mm;
-			refType = 4;
-		};
 		F58784EB02DE375901EA4122 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -5176,18 +5160,6 @@
 			settings = {
 			};
 		};
-		F587857B02DE375901EA4122 = {
-			fileRef = F58784E902DE375901EA4122;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		F587857C02DE375901EA4122 = {
-			fileRef = F58784EA02DE375901EA4122;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		F587857D02DE375901EA4122 = {
 			fileRef = F58784EB02DE375901EA4122;
 			isa = PBXBuildFile;
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 0cfff0b..f1d0171 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -1560,6 +1560,7 @@ void KHTMLPart::checkCompleted()
 //   kdDebug( 6050 ) << "KHTMLPart::checkCompleted() parsing: " << d->m_doc->parsing() << endl;
 //   kdDebug( 6050 ) << "                           complete: " << d->m_bComplete << endl;
 
+#if !APPLE_CHANGES
   // restore the cursor position
   if (d->m_doc && !d->m_doc->parsing() && !d->m_focusNodeRestored)
   {
@@ -1569,6 +1570,7 @@ void KHTMLPart::checkCompleted()
           d->m_doc->setFocusNode(0);
       d->m_focusNodeRestored = true;
   }
+#endif
 
   // Any frame that hasn't completed yet ?
   ConstFrameIt it = d->m_frames.begin();
@@ -3518,9 +3520,7 @@ void KHTMLPart::restoreState( QDataStream &stream )
          >> d->m_ssl_cipher_bits
          >> d->m_ssl_cert_state;
 
-#ifndef APPLE_CHANGES
   d->m_paSecurity->setIcon( d->m_ssl_in_use ? "encrypted" : "decrypted" );
-#endif
 
   stream >> frameCount >> frameNames >> frameServiceTypes >> frameServiceNames
          >> frameURLs >> frameStateBuffers;
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 52a5eb7..96f4d96 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -44,11 +44,6 @@
 
 #include <kdebug.h>
 
-#ifdef APPLE_CHANGES
-#include "render_root.h"
-#include <KWQInvisibleButton.h>
-#endif
-
 using namespace khtml;
 
 RenderFormElement::RenderFormElement(HTMLGenericFormElementImpl *element)
@@ -381,25 +376,7 @@ RenderImageButton::RenderImageButton(HTMLInputElementImpl *element)
     : RenderImage(element)
 {
     // ### support DOMActivate event when clicked
-#ifdef APPLE_CHANGES
-    button = new KWQInvisibleButton(this);
-#endif
-}
-
-#ifdef APPLE_CHANGES
-RenderImageButton::~RenderImageButton()
-{
-    delete button;
-}
-    
-void RenderImageButton::printObject(QPainter *p, int x, int y, int w, int h, int tx, int ty)
-{
-    RenderImage::printObject(p, x, y, w, h, tx, ty);
-    if (!pixmap().isNull()) {
-        button->setFrameInView(tx, ty, contentWidth(), contentHeight(), root()->view());
-    }
 }
-#endif /* APPLE_CHANGES */
 
 // -------------------------------------------------------------------------------
 
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index 8b6a8fe..85b5a4c 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -46,10 +46,6 @@ class QListboxItem;
 typedef class QTextEdit KTextEdit;
 class KHTMLPartBrowserExtension;
 
-#ifdef APPLE_CHANGES
-class KWQInvisibleButton;
-#endif
-
 namespace DOM {
     class HTMLFormElementImpl;
     class HTMLInputElementImpl;
@@ -187,14 +183,6 @@ public:
     RenderImageButton(DOM::HTMLInputElementImpl *element);
 
     virtual const char *renderName() const { return "RenderImageButton"; }
-
-#ifdef APPLE_CHANGES    
-    virtual ~RenderImageButton();
-    virtual void printObject(QPainter *p, int x, int y, int w, int h, int tx, int ty);
-
-private:
-    KWQInvisibleButton *button;
-#endif
 };
 
 
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index cbae82f..0b1fae9 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -1017,6 +1017,10 @@ void DocumentImpl::setVisuallyOrdered()
 
 void DocumentImpl::setSelection(NodeImpl* s, int sp, NodeImpl* e, int ep)
 {
+#if APPLE_CHANGES
+    // With Macintosh UI, you can't have both a selection and a focused node.
+    setFocusNode(0);
+#endif
     if ( m_render )
         static_cast<RenderRoot*>(m_render)->setSelection(s->renderer(),sp,e->renderer(),ep);
 }
@@ -1065,10 +1069,8 @@ void DocumentImpl::close(  )
     delete m_tokenizer;
     m_tokenizer = 0;
 
-#ifndef APPLE_CHANGES
     if (m_view)
         m_view->part()->checkEmitLoadEvent();
-#endif
 }
 
 void DocumentImpl::write( const DOMString &text )
@@ -1928,7 +1930,7 @@ void DocumentImpl::recalcStyleSelector()
 }
 
 void DocumentImpl::setFocusNode(NodeImpl *newFocusNode)
-{
+{    
     // Make sure newFocusNode is actually in this document
     if (newFocusNode && (newFocusNode->getDocument() != this))
         return;
@@ -1939,6 +1941,11 @@ void DocumentImpl::setFocusNode(NodeImpl *newFocusNode)
         m_focusNode = newFocusNode;
         // Remove focus from the existing focus node (if any)
         if (oldFocusNode) {
+            // This goes hand in hand with the Qt focus setting below.
+            if (!m_focusNode && getDocument()->view()) {
+                getDocument()->view()->setFocus();
+            }
+
             if (oldFocusNode->active())
                 oldFocusNode->setActive(false);
 
@@ -1969,6 +1976,10 @@ void DocumentImpl::setFocusNode(NodeImpl *newFocusNode)
                 else if (static_cast<RenderWidget*>(m_focusNode->renderer())->widget())
                     static_cast<RenderWidget*>(m_focusNode->renderer())->widget()->setFocus();
             }
+#if APPLE_CHANGES
+            // With Macintosh UI, you can't have both a selection and a focused node.
+            clearSelection();
+#endif
         }
 
         updateRendering();
diff --git a/WebCore/kwq/KWQInvisibleButton.h b/WebCore/kwq/KWQInvisibleButton.h
deleted file mode 100644
index a90538f..0000000
--- a/WebCore/kwq/KWQInvisibleButton.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001, 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. 
- */
-
-#ifndef KWQINVISIBLEBUTTON_H_
-#define KWQINVISIBLEBUTTON_H_
-
-#ifdef __OBJC__
- at class KWQInvisibleButtonView;
-#else
-class KWQInvisibleButtonView;
-#endif
-
-class KHTMLView;
-
-namespace khtml {
-    class RenderImageButton;
-}
-
-class KWQInvisibleButton {
-public:
-    KWQInvisibleButton(khtml::RenderImageButton *);
-    ~KWQInvisibleButton();
-
-    void setFrameInView(int x, int y, int w, int h, KHTMLView *);
-
-private:
-    khtml::RenderImageButton *imageButton;
-    KWQInvisibleButtonView *buttonView;
-};
-
-#endif
diff --git a/WebCore/kwq/KWQInvisibleButton.mm b/WebCore/kwq/KWQInvisibleButton.mm
deleted file mode 100644
index 3a5bb4a..0000000
--- a/WebCore/kwq/KWQInvisibleButton.mm
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2001, 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 <KWQInvisibleButton.h>
-
-#import <qevent.h>
-#import <khtmlview.h>
-#import <render_form.h>
-#import <dom2_eventsimpl.h>
-
- at interface KWQInvisibleButtonView : NSView
-{
-    khtml::RenderImageButton *imageButton;
-}
-
--(void)setImageButton:(khtml::RenderImageButton *)theImageButton;
-
- at end
-
-
- at implementation KWQInvisibleButtonView
-
--(void)setImageButton:(khtml::RenderImageButton *)theImageButton
-{
-    imageButton = theImageButton;
-}
-
-- (void)mouseDown:(NSEvent *)theEvent
-{
-    DOM::HTMLFormElementImpl *element;
-    
-    element = static_cast<DOM::HTMLGenericFormElementImpl *>(imageButton->element())->form();
-    
-    for (QPtrListIterator<DOM::HTMLGenericFormElementImpl> it(element->formElements); it.current(); ++it) {
-        DOM::HTMLGenericFormElementImpl* current = it.current();
-        if (current->renderer() && 
-            (strcmp(current->renderer()->renderName(), "RenderLineEdit") == 0 || strcmp(current->renderer()->renderName(), "RenderTextArea") == 0)) {
-            static_cast<khtml::RenderWidget *>(current->renderer())->widget()->endEditing();
-            break;
-        }
-    }
-}
-
-- (void)mouseUp:(NSEvent *)theEvent
-{
-    NSPoint mouse = [theEvent locationInWindow];
-    QMouseEvent e2(QEvent::MouseButtonRelease, QPoint((int)mouse.x, (int)mouse.y), 0, 0);
-    imageButton->element()->dispatchMouseEvent(&e2, DOM::EventImpl::KHTML_CLICK_EVENT, 1);
-}
-
- at end
-
-KWQInvisibleButton::KWQInvisibleButton(khtml::RenderImageButton *theImageButton)
-{
-    imageButton = theImageButton;
-    buttonView = nil;
-}
-
-KWQInvisibleButton::~KWQInvisibleButton()
-{
-    [buttonView removeFromSuperview];
-    [buttonView release];
-}
-
-void KWQInvisibleButton::setFrameInView(int x, int y, int w, int h, KHTMLView *khtmlview)
-{
-    if (!buttonView) {
-        buttonView = [[KWQInvisibleButtonView alloc] init];
-        [buttonView setImageButton:imageButton];
-        NSView *nsview = khtmlview->getView();    
-        if ([nsview isKindOfClass:[NSScrollView class]]) {
-            NSScrollView *scrollView = (NSScrollView *)nsview;
-            nsview = [scrollView documentView];
-        }
-        [nsview addSubview:buttonView];
-    }
-    [buttonView setFrame:NSMakeRect(x, y, w, h)];
-}
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 9e1db15..a428d0d 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -109,6 +109,9 @@ public:
     NSView *nextKeyViewInFrameHierarchy(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static NSView *nextKeyViewForWidget(QWidget *startingPoint, KWQSelectionDirection);
     
+    static void setDocumentFocus(QWidget *);
+    static void clearDocumentFocus(QWidget *);
+    
     static WebCoreBridge *bridgeForWidget(QWidget *);
     
     // Incoming calls, used by the bridge.
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 76d0fb3..f922a65 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -504,6 +504,17 @@ NodeImpl *KWQKHTMLPartImpl::nodeForWidget(QWidget *widget)
     return static_cast<const RenderWidget *>(widget->eventFilterObject())->element();
 }
 
+void KWQKHTMLPartImpl::setDocumentFocus(QWidget *widget)
+{
+    NodeImpl *node = nodeForWidget(widget);
+    node->getDocument()->setFocusNode(node);
+}
+
+void KWQKHTMLPartImpl::clearDocumentFocus(QWidget *widget)
+{
+    nodeForWidget(widget)->getDocument()->setFocusNode(0);
+}
+
 void KWQKHTMLPartImpl::saveDocumentState()
 {
     [_bridge saveDocumentState];
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.h b/WebCore/kwq/KWQKHTMLPartImpl.h
index 9e1db15..a428d0d 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.h
+++ b/WebCore/kwq/KWQKHTMLPartImpl.h
@@ -109,6 +109,9 @@ public:
     NSView *nextKeyViewInFrameHierarchy(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static NSView *nextKeyViewForWidget(QWidget *startingPoint, KWQSelectionDirection);
     
+    static void setDocumentFocus(QWidget *);
+    static void clearDocumentFocus(QWidget *);
+    
     static WebCoreBridge *bridgeForWidget(QWidget *);
     
     // Incoming calls, used by the bridge.
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 76d0fb3..f922a65 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -504,6 +504,17 @@ NodeImpl *KWQKHTMLPartImpl::nodeForWidget(QWidget *widget)
     return static_cast<const RenderWidget *>(widget->eventFilterObject())->element();
 }
 
+void KWQKHTMLPartImpl::setDocumentFocus(QWidget *widget)
+{
+    NodeImpl *node = nodeForWidget(widget);
+    node->getDocument()->setFocusNode(node);
+}
+
+void KWQKHTMLPartImpl::clearDocumentFocus(QWidget *widget)
+{
+    nodeForWidget(widget)->getDocument()->setFocusNode(0);
+}
+
 void KWQKHTMLPartImpl::saveDocumentState()
 {
     [_bridge saveDocumentState];
diff --git a/WebCore/kwq/KWQNSTextField.mm b/WebCore/kwq/KWQNSTextField.mm
index af4735c..3c84923 100644
--- a/WebCore/kwq/KWQNSTextField.mm
+++ b/WebCore/kwq/KWQNSTextField.mm
@@ -269,6 +269,7 @@
 
 - (BOOL)becomeFirstResponder
 {
+    KWQKHTMLPartImpl::setDocumentFocus(widget);
     [self _KWQ_scrollFrameToVisible];
     return [super becomeFirstResponder];
 }
@@ -441,6 +442,7 @@
 
 - (BOOL)becomeFirstResponder
 {
+    KWQKHTMLPartImpl::setDocumentFocus(widget);
     [self _KWQ_scrollFrameToVisible];
     return [super becomeFirstResponder];
 }
diff --git a/WebCore/kwq/KWQTextField.mm b/WebCore/kwq/KWQTextField.mm
index af4735c..3c84923 100644
--- a/WebCore/kwq/KWQTextField.mm
+++ b/WebCore/kwq/KWQTextField.mm
@@ -269,6 +269,7 @@
 
 - (BOOL)becomeFirstResponder
 {
+    KWQKHTMLPartImpl::setDocumentFocus(widget);
     [self _KWQ_scrollFrameToVisible];
     return [super becomeFirstResponder];
 }
@@ -441,6 +442,7 @@
 
 - (BOOL)becomeFirstResponder
 {
+    KWQKHTMLPartImpl::setDocumentFocus(widget);
     [self _KWQ_scrollFrameToVisible];
     return [super becomeFirstResponder];
 }
diff --git a/WebCore/kwq/KWQWidget.h b/WebCore/kwq/KWQWidget.h
index 68a66f7..769f3e2 100644
--- a/WebCore/kwq/KWQWidget.h
+++ b/WebCore/kwq/KWQWidget.h
@@ -151,8 +151,6 @@ public:
     void disableFlushDrawing();
     void flushDrawing();
     void setDrawingAlpha(float alpha);
-    
-    virtual void endEditing();
 
 private:
     QWidgetPrivate *data;
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 7f4164a..a806d8b 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -32,6 +32,7 @@
 
 #import <khtmlview.h>
 #import <render_replaced.h>
+#import <KWQKHTMLPartImpl.h>
 
 using khtml::RenderWidget;
 
@@ -206,7 +207,7 @@ void QWidget::setFocus()
 
 void QWidget::clearFocus()
 {
-    ERROR("not yet implemented");
+    KWQKHTMLPartImpl::clearDocumentFocus(this);
 }
 
 QWidget::FocusPolicy QWidget::focusPolicy() const
@@ -361,22 +362,6 @@ void QWidget::setView(NSView *view)
     data->view = view;
 }
 
-void QWidget::endEditing()
-{
-    // FIXME: This seems to end editing of any widget in the same window, not just this one.
-    
-    // Handle the field editor case.
-    // This is probably not necessary, given the next bit of code.
-    NSWindow *window = [getView() window];
-    [window endEditingFor:nil];
-    
-    // Whack any NSText first responders.
-    NSResponder *firstResponder = [window firstResponder];
-    if ([firstResponder isKindOfClass:[NSText class]]) {
-        [window makeFirstResponder:nil];
-    }
-}
-
 void QWidget::lockDrawingFocus()
 {
     [getView() lockFocus];
diff --git a/WebCore/kwq/qt/qwidget.h b/WebCore/kwq/qt/qwidget.h
index 68a66f7..769f3e2 100644
--- a/WebCore/kwq/qt/qwidget.h
+++ b/WebCore/kwq/qt/qwidget.h
@@ -151,8 +151,6 @@ public:
     void disableFlushDrawing();
     void flushDrawing();
     void setDrawingAlpha(float alpha);
-    
-    virtual void endEditing();
 
 private:
     QWidgetPrivate *data;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list