WebCore:
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jul 2004 15:38:14 +0000 (15:38 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jul 2004 15:38:14 +0000 (15:38 +0000)
        Reviewed by Hyatt

        Fix for this bug:

        <rdar://problem/3707505> HTMLCompose: blinking cursor in both an address text field and the message body

        * khtml/khtml_part.cpp:
        (KHTMLPart::setCaretVisible): This method renamed from setSelectionVisible. Since it really only operates
        on the caret, this seems like a better name.
        * khtml/khtml_part.h:
        * khtml/khtmlview.cpp:
        (KHTMLView::focusInEvent): Call setCaretVisible(true)
        (KHTMLView::focusOutEvent): Call setCaretVisible(false)
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setShowsFirstResponder): Name change: setSelectionVisible becomes setCaretVisible.
        * kwq/WebCoreBridge.h: Expose setCaretVisible as a bridge method.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge setCaretVisible:]): Ditto.

WebKit:

        Reviewed by Hyatt

        Fix for this bug:

        <rdar://problem/3707505> HTMLCompose: blinking cursor in both an address text field and the message body

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView setCaretVisible:]): New helper. Calls over bridge to do the work.
        (-[WebHTMLView windowDidBecomeKey:]): This function cannot just assume that self is first responder
        (and do things like adjusting text background color and restoring focus rings).
        First-responder-ness needs to be checked first. Now it is.
        (-[WebHTMLView windowDidResignKey:]): Ditto.
        (-[WebHTMLView becomeFirstResponder]): Call new helper to make caret visible.
        (-[WebHTMLView resignFirstResponder]): Call new helper to make caret invisible.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7061 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/khtml_part.cpp
WebCore/khtml/khtml_part.h
WebCore/khtml/khtmlview.cpp
WebCore/kwq/KWQKHTMLPart.mm
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreBridge.mm
WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m

index 344e602254e0d667949f3b9f79f9abea74bae1cf..00b1e5a2b0e873074ddc354db95359a5ed68752b 100644 (file)
@@ -1,3 +1,24 @@
+2004-07-20  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Hyatt
+
+        Fix for this bug:
+        
+        <rdar://problem/3707505> HTMLCompose: blinking cursor in both an address text field and the message body
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::setCaretVisible): This method renamed from setSelectionVisible. Since it really only operates
+        on the caret, this seems like a better name.
+        * khtml/khtml_part.h:
+        * khtml/khtmlview.cpp:
+        (KHTMLView::focusInEvent): Call setCaretVisible(true)
+        (KHTMLView::focusOutEvent): Call setCaretVisible(false)
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::setShowsFirstResponder): Name change: setSelectionVisible becomes setCaretVisible.
+        * kwq/WebCoreBridge.h: Expose setCaretVisible as a bridge method.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge setCaretVisible:]): Ditto.
+
 2004-07-19  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Trey.
index be41a846a9881790ad2fc7cedbc6cd3df7b35d43..5a41a764b9f5eaef1579158a957f53a91891262c 100644 (file)
@@ -2315,7 +2315,7 @@ void KHTMLPart::invalidateSelection()
     selectionLayoutChanged();
 }
 
-void KHTMLPart::setSelectionVisible(bool flag)
+void KHTMLPart::setCaretVisible(bool flag)
 {
     if (d->m_caretVisible == flag)
         return;
index 87bae96d8a13dd0d91e92a72d45788cbe12bfca5..ad0f66a5e1c748ab8ce066c420ac35ee645b98d2 100644 (file)
@@ -603,7 +603,7 @@ public:
   /**
    * Controls the visibility of the selection.
    */
-  void setSelectionVisible(bool flag=true);
+  void setCaretVisible(bool flag=true);
 
   /**
    * Paints the caret.
index 8120d40531a28b0e5ba9322e2b16dbcc76e521f3..d49fc8625e5e1c284cde466e489a549618de4b4c 100644 (file)
@@ -1937,14 +1937,14 @@ void KHTMLView::dropEvent( QDropEvent *ev )
 
 void KHTMLView::focusInEvent( QFocusEvent *e )
 {
-    m_part->setSelectionVisible();
+    m_part->setCaretVisible();
     QScrollView::focusInEvent( e );
 }
 
 void KHTMLView::focusOutEvent( QFocusEvent *e )
 {
     m_part->stopAutoScroll();
-    m_part->setSelectionVisible(false);
+    m_part->setCaretVisible(false);
     QScrollView::focusOutEvent( e );
 }
 
index 0d8a1d35823aad1c7c50f33a71e1a6948830d8ea..040fbe570b41706e6a5d4e9623d7c35c15bcf0a5 100644 (file)
@@ -3277,7 +3277,7 @@ void KWQKHTMLPart::setShowsFirstResponder(bool flag)
             if (node && node->renderer())
                 node->renderer()->repaint();
         }
-        setSelectionVisible(flag);
+        setCaretVisible(flag);
     }
 }
 
index 67b447b41cc0e3b008395550d2a88e8aa8d40ea9..847767b00332598cb691b80307665b573664ed11 100644 (file)
@@ -305,6 +305,8 @@ typedef enum {
 - (void)insertText:(NSString *)text;
 - (void)insertNewline;
 
+- (void)setCaretVisible:(BOOL)flag;
+
 - (void)setSelectionToDragCaret;
 - (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment;
 - (void)moveDragCaretToPoint:(NSPoint)point;
index abce3c407794f2ca56e02e5653a33a8e8e44a938..2c9ddd09bd26b99b13cc4444b35670c2b1f17514 100644 (file)
@@ -1487,6 +1487,14 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     [self ensureCaretVisible];
 }
 
+- (void)setCaretVisible:(BOOL)flag
+{
+    if (!_part)
+        return;
+        
+    _part->setCaretVisible(flag);
+}
+
 - (void)setSelectionToDragCaret
 {
     _part->setSelection(_part->dragCaret());
index e0c36b5bf2688f66ca0ff139244c6b9d2ca31425..f26514b53d176513a83c05a65da437fbfcd2e560 100644 (file)
@@ -1,3 +1,20 @@
+2004-07-20  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Hyatt
+
+        Fix for this bug:
+        
+        <rdar://problem/3707505> HTMLCompose: blinking cursor in both an address text field and the message body
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView setCaretVisible:]): New helper. Calls over bridge to do the work.
+        (-[WebHTMLView windowDidBecomeKey:]): This function cannot just assume that self is first responder
+        (and do things like adjusting text background color and restoring focus rings). 
+        First-responder-ness needs to be checked first. Now it is.
+        (-[WebHTMLView windowDidResignKey:]): Ditto.
+        (-[WebHTMLView becomeFirstResponder]): Call new helper to make caret visible.
+        (-[WebHTMLView resignFirstResponder]): Call new helper to make caret invisible.
+
 2004-07-12  Richard Williamson   <rjw@apple.com>
 
         Fixed 3721917.  The RealPlayer plugin doesn't support the new 
index 2eb393fc467d8731c59c88e7aba589d785b81b3a..423b0f4029389741d961f7ce0fe2a2285b7c0f60 100644 (file)
@@ -1258,6 +1258,11 @@ static WebHTMLView *lastHitView = nil;
     }
 }
 
+- (void)setCaretVisible:(BOOL)flag
+{
+    [[self _bridge] setCaretVisible:flag];
+}
+
 - (BOOL)maintainsInactiveSelection
 {
     // This method helps to determing whether the view should maintain
@@ -1705,16 +1710,20 @@ static WebHTMLView *lastHitView = nil;
 {
     ASSERT([notification object] == [self window]);
     [self addMouseMovedObserver];
-    [self updateTextBackgroundColor];
-    [self updateShowsFirstResponder];
+    if ([self firstResponderIsSelfOrDescendantView]) {
+        [self updateTextBackgroundColor];
+        [self updateShowsFirstResponder];
+    }
 }
 
 - (void)windowDidResignKey: (NSNotification *)notification
 {
     ASSERT([notification object] == [self window]);
     [self removeMouseMovedObserver];
-    [self updateTextBackgroundColor];
-    [self updateShowsFirstResponder];
+    if ([self firstResponderIsSelfOrDescendantView]) {
+        [self updateTextBackgroundColor];
+        [self updateShowsFirstResponder];
+    }
 }
 
 - (void)windowWillClose:(NSNotification *)notification
@@ -2054,6 +2063,7 @@ static WebHTMLView *lastHitView = nil;
     if (view) {
         [[self window] makeFirstResponder:view];
     }
+    [self setCaretVisible:YES];
     [self updateTextBackgroundColor];
     return YES;
 }
@@ -2073,6 +2083,7 @@ static WebHTMLView *lastHitView = nil;
                 [self deselectAll];
             }
         }
+        [self setCaretVisible:NO];
         [self updateTextBackgroundColor];
         _private->resigningFirstResponder = NO;
     }