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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:52:26 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 3ec72cf5be9548020876fbb826fc3d6670df86a6
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 23 23:17:24 2004 +0000

    WebCore:
    
            Reviewed by Trey
    
            Fix for this bug:
    
            <rdar://problem/3738920> Caret blinks in inactive window
    
            As part of the fix, I cleaned up the way we handle special drawing that needs
            to be done in the HTML view that is first responder in the key window (e.g the
            drawing of text selection highlight and caret blinking).
    
            * khtml/khtml_part.cpp: Removed setCaretVisible function. Updating caret visibility
            is now done in setDisplaysWithFocusAttributes, described below.
            * khtml/khtml_part.h: Ditto.
            * khtml/khtmlpart_p.h:
            (KHTMLPartPrivate::KHTMLPartPrivate): m_caretVisible now defaults to false. This prevents
            the caret from blinking when an app is started from the command line and remains in the
            background.
            * khtml/khtmlview.cpp:
            (KHTMLView::focusInEvent): Remove caret code from here. Not needed.
            (KHTMLView::focusOutEvent): Ditto.
            * kwq/KWQKHTMLPart.h:
            (KWQKHTMLPart::displaysWithFocusAttributes): New accessor to return cached value to other code
            in WebCore.
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::KWQKHTMLPart):
            (KWQKHTMLPart::setDisplaysWithFocusAttributes): Renamed from setShowsFirstResponder and modified
            to do the display updating in a clearer way....and now has comments!
            * kwq/WebCoreBridge.h: Remove several obsolete functions that use to try to do the work of the new
            setDisplaysWithFocusAttributes function (and did so less well).
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge drawRect:]): Now calls displaysWithFocusAttributes to figure out how to draw the
            text selection background.
            (-[WebCoreBridge setDisplaysWithFocusAttributes:]): Calls through to setDisplaysWithFocusAttributes in
            KWQKHTMLPart.
            (-[WebCoreBridge selectionColor]): Flipped the value of this ternary expression to accommodate the
            change from usesInactiveTextBackgroundColor to setDisplaysWithFocusAttributes.
            (-[WebCoreBridge setCaretVisible:]): Removed.
    
    WebKit:
    
            Reviewed by Trey
    
            Fix for this bug:
    
            <rdar://problem/3738920> Caret blinks in inactive window
    
            As part of the fix, I cleaned up the way we handle special drawing that needs
            to be done in the HTML view that is first responder in the key window (e.g the
            drawing of text selection highlight and caret blinking).
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView updateFocusDisplay]): New method that centralizes the changes
            we need to make when the first responder-ness of the view or key-ness of the
            window changes.
            (-[WebHTMLView viewDidMoveToWindow]): Call new updateFocusDisplay helper.
            (-[WebHTMLView windowDidBecomeKey:]): Ditto.
            (-[WebHTMLView windowDidResignKey:]): Ditto.
            (-[WebHTMLView becomeFirstResponder]): Ditto.
            (-[WebHTMLView resignFirstResponder]): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7116 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c9ce4c1..21382e8 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,43 @@
+2004-07-23  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Trey
+
+        Fix for this bug:
+        
+        <rdar://problem/3738920> Caret blinks in inactive window
+
+        As part of the fix, I cleaned up the way we handle special drawing that needs
+        to be done in the HTML view that is first responder in the key window (e.g the
+        drawing of text selection highlight and caret blinking).
+
+        * khtml/khtml_part.cpp: Removed setCaretVisible function. Updating caret visibility
+        is now done in setDisplaysWithFocusAttributes, described below.
+        * khtml/khtml_part.h: Ditto.
+        * khtml/khtmlpart_p.h:
+        (KHTMLPartPrivate::KHTMLPartPrivate): m_caretVisible now defaults to false. This prevents
+        the caret from blinking when an app is started from the command line and remains in the
+        background.
+        * khtml/khtmlview.cpp:
+        (KHTMLView::focusInEvent): Remove caret code from here. Not needed.
+        (KHTMLView::focusOutEvent): Ditto.
+        * kwq/KWQKHTMLPart.h:
+        (KWQKHTMLPart::displaysWithFocusAttributes): New accessor to return cached value to other code
+        in WebCore.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart):
+        (KWQKHTMLPart::setDisplaysWithFocusAttributes): Renamed from setShowsFirstResponder and modified
+        to do the display updating in a clearer way....and now has comments!
+        * kwq/WebCoreBridge.h: Remove several obsolete functions that use to try to do the work of the new
+        setDisplaysWithFocusAttributes function (and did so less well).
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge drawRect:]): Now calls displaysWithFocusAttributes to figure out how to draw the
+        text selection background.
+        (-[WebCoreBridge setDisplaysWithFocusAttributes:]): Calls through to setDisplaysWithFocusAttributes in 
+        KWQKHTMLPart.
+        (-[WebCoreBridge selectionColor]): Flipped the value of this ternary expression to accommodate the
+        change from usesInactiveTextBackgroundColor to setDisplaysWithFocusAttributes.
+        (-[WebCoreBridge setCaretVisible:]): Removed.
+
 2004-07-23  John Sullivan  <sullivan at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/khtml/khtmlpart_p.h b/WebCore/khtml/khtmlpart_p.h
index d3ea56c..e7a81ff 100644
--- a/WebCore/khtml/khtmlpart_p.h
+++ b/WebCore/khtml/khtmlpart_p.h
@@ -154,7 +154,7 @@ public:
     m_onlyLocalReferences = false;
 
     m_caretBlinkTimer = 0;
-    m_caretVisible = true;
+    m_caretVisible = false;
     m_caretBlinks = true;
     m_caretPaint = true;
     
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index dae015c..5674256 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -273,11 +273,8 @@ public:
     
     void setMediaType(const QString &);
 
-    void setUsesInactiveTextBackgroundColor(bool u) { _usesInactiveTextBackgroundColor = u; }
-    bool usesInactiveTextBackgroundColor() const { return _usesInactiveTextBackgroundColor; }
-
-    void setShowsFirstResponder(bool flag);
-    bool showsFirstResponder() const { return _showsFirstResponder; }
+    void setDisplaysWithFocusAttributes(bool flag);
+    bool displaysWithFocusAttributes() const { return _displaysWithFocusAttributes; }
     
     // Convenience, to avoid repeating the code to dig down to get this.
     QChar backslashAsCurrencySymbol() const;
@@ -379,8 +376,7 @@ private:
 
     KWQWindowWidget *_windowWidget;
 
-    bool _usesInactiveTextBackgroundColor;
-    bool _showsFirstResponder;
+    bool _displaysWithFocusAttributes;
     mutable bool _drawSelectionOnly;
     bool _haveUndoRedoOperations;
     
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 2a13757..ae6f0db 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -183,8 +183,7 @@ KWQKHTMLPart::KWQKHTMLPart()
     , _formValuesAboutToBeSubmitted(nil)
     , _formAboutToBeSubmitted(nil)
     , _windowWidget(NULL)
-    , _usesInactiveTextBackgroundColor(false)
-    , _showsFirstResponder(true)
+    , _displaysWithFocusAttributes(false)
     , _drawSelectionOnly(false)
     , _bindingRoot(0)
     , _windowScriptObject(0)
@@ -3267,17 +3266,28 @@ void KWQKHTMLPart::setMediaType(const QString &type)
     }
 }
 
-void KWQKHTMLPart::setShowsFirstResponder(bool flag)
+void KWQKHTMLPart::setDisplaysWithFocusAttributes(bool flag)
 {
-    if (flag != _showsFirstResponder) {
-        _showsFirstResponder = flag;
-        DocumentImpl *doc = xmlDocImpl();
-        if (doc) {
-            NodeImpl *node = doc->focusNode();
-            if (node && node->renderer())
-                node->renderer()->repaint();
-        }
-        setCaretVisible(flag);
+    if (_displaysWithFocusAttributes == flag)
+        return;
+    _displaysWithFocusAttributes = flag;
+        
+    // This method does the job of updating the view based on whether the view is "active".
+    // This involves three kinds of drawing updates:
+
+    // 1. The background color used to draw behind selected content (active | inactive color)
+    if (d->m_view)
+        d->m_view->updateContents(QRect(visibleSelectionRect()));
+
+    // 2. Caret blinking (blinks | does not blink)
+    setCaretVisible(flag);
+
+    // 3. The drawing of a focus ring around links in web pages.
+    DocumentImpl *doc = xmlDocImpl();
+    if (doc) {
+        NodeImpl *node = doc->focusNode();
+        if (node && node->renderer())
+            node->renderer()->repaint();
     }
 }
 
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index f0e86ed..15bf0bd 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -186,11 +186,6 @@ typedef enum {
 - (void)adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
 - (NSArray*)computePageRectsWithPrintWidthScaleFactor:(float)printWidthScaleFactor printHeight:(float)printHeight;
 
-- (void)setUsesInactiveTextBackgroundColor:(BOOL)uses;
-- (BOOL)usesInactiveTextBackgroundColor;
-
-- (void)setShowsFirstResponder:(BOOL)flag;
-
 - (void)setActivationEventNumber:(int)num;
 - (void)mouseDown:(NSEvent *)event;
 - (void)mouseUp:(NSEvent *)event;
@@ -243,6 +238,8 @@ typedef enum {
 - (NSAttributedString *)selectedAttributedString;
 - (NSString *)selectedString;
 
+- (void)setDisplaysWithFocusAttributes:(BOOL)flag;
+
 - (NSString *)stringForRange:(DOMRange *)range;
 
 - (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes;
@@ -306,8 +303,6 @@ typedef enum {
 - (void)insertText:(NSString *)text;
 - (void)insertNewline;
 
-- (void)setCaretVisible:(BOOL)flag;
-
 - (void)setSelectionToDragCaret;
 - (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment;
 - (void)moveDragCaretToPoint:(NSPoint)point;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 418f8b9..a8fb357 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -630,8 +630,9 @@ static BOOL nowPrinting(WebCoreBridge *self)
 - (void)drawRect:(NSRect)rect
 {
     QPainter painter(nowPrinting(self));
-    painter.setUsesInactiveTextBackgroundColor(_part->usesInactiveTextBackgroundColor());
-    painter.setDrawsFocusRing(_part->showsFirstResponder());
+    bool displaysWithFocusAttributes = _part->displaysWithFocusAttributes();
+    painter.setUsesInactiveTextBackgroundColor(!displaysWithFocusAttributes);
+    painter.setDrawsFocusRing(displaysWithFocusAttributes);
     [self drawRect:rect withPainter:&painter];
 }
 
@@ -1253,19 +1254,9 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     return externalRepresentation(_part->renderer()).getNSString();
 }
 
-- (void)setUsesInactiveTextBackgroundColor:(BOOL)uses
+- (void)setDisplaysWithFocusAttributes:(BOOL)flag
 {
-    _part->setUsesInactiveTextBackgroundColor(uses);
-}
-
-- (BOOL)usesInactiveTextBackgroundColor
-{
-    return _part->usesInactiveTextBackgroundColor();
-}
-
-- (void)setShowsFirstResponder:(BOOL)flag
-{
-    _part->setShowsFirstResponder(flag);
+    _part->setDisplaysWithFocusAttributes(flag);
 }
 
 - (void)setShouldCreateRenderers:(BOOL)f
@@ -1301,7 +1292,7 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
             return pseudoStyle->backgroundColor().getNSColor();
         }
     }
-    return _part->usesInactiveTextBackgroundColor() ? [NSColor secondarySelectedControlColor] : [NSColor selectedTextBackgroundColor];
+    return _part->displaysWithFocusAttributes() ? [NSColor selectedTextBackgroundColor] : [NSColor secondarySelectedControlColor];
 }
 
 - (void)adjustViewSize
@@ -1497,14 +1488,6 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     [self ensureCaretVisible];
 }
 
-- (void)setCaretVisible:(BOOL)flag
-{
-    if (!_part)
-        return;
-        
-    _part->setCaretVisible(flag);
-}
-
 - (void)setSelectionToDragCaret
 {
     _part->setSelection(_part->dragCaret());
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 71a1b4b..cc7954b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2004-07-23  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Trey
+
+        Fix for this bug:
+        
+        <rdar://problem/3738920> Caret blinks in inactive window
+
+        As part of the fix, I cleaned up the way we handle special drawing that needs
+        to be done in the HTML view that is first responder in the key window (e.g the
+        drawing of text selection highlight and caret blinking).
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView updateFocusDisplay]): New method that centralizes the changes
+        we need to make when the first responder-ness of the view or key-ness of the
+        window changes.
+        (-[WebHTMLView viewDidMoveToWindow]): Call new updateFocusDisplay helper.
+        (-[WebHTMLView windowDidBecomeKey:]): Ditto.
+        (-[WebHTMLView windowDidResignKey:]): Ditto.
+        (-[WebHTMLView becomeFirstResponder]): Ditto.
+        (-[WebHTMLView resignFirstResponder]): Ditto.
+
 2004-07-22  Darin Adler  <darin at apple.com>
 
         * Plugins.subproj/npruntime.h: Update with new version from newer JavaScriptCore.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 3eae730..c17f434 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -1253,23 +1253,6 @@ static WebHTMLView *lastHitView = nil;
     return YES;
 }
 
-- (void)updateTextBackgroundColor
-{
-    NSWindow *window = [self window];
-    BOOL shouldUseInactiveTextBackgroundColor = !([window isKeyWindow] && [window firstResponder] == self) ||
-        _private->resigningFirstResponder;
-    WebBridge *bridge = [self _bridge];
-    if ([bridge usesInactiveTextBackgroundColor] != shouldUseInactiveTextBackgroundColor) {
-        [bridge setUsesInactiveTextBackgroundColor:shouldUseInactiveTextBackgroundColor];
-        [self setNeedsDisplayInRect:[bridge visibleSelectionRect]];
-    }
-}
-
-- (void)setCaretVisible:(BOOL)flag
-{
-    [[self _bridge] setCaretVisible:flag];
-}
-
 - (BOOL)maintainsInactiveSelection
 {
     // This method helps to determing whether the view should maintain
@@ -1310,9 +1293,20 @@ static WebHTMLView *lastHitView = nil;
         name:NSMouseMovedNotification object:nil];
 }
 
-- (void)updateShowsFirstResponder
+- (void)updateFocusDisplay
 {
-    [[self _bridge] setShowsFirstResponder:[[self window] isKeyWindow]];
+    // This method does the job of updating the view based on the view's firstResponder-ness and
+    // the window key-ness of the window containing this view. This involves three kinds of 
+    // drawing updates right now, all handled in WebCore in response to the call over the bridge. 
+    // 
+    // The three display attributes are as follows:
+    // 
+    // 1. The background color used to draw behind selected content (active | inactive color)
+    // 2. Caret blinking (blinks | does not blink)
+    // 3. The drawing of a focus ring around links in web pages.
+
+    BOOL flag = !_private->resigningFirstResponder && [[self window] isKeyWindow] && [self firstResponderIsSelfOrDescendantView];
+    [[self _bridge] setDisplaysWithFocusAttributes:flag];
 }
 
 - (void)addSuperviewObservers
@@ -1416,7 +1410,7 @@ static WebHTMLView *lastHitView = nil;
             [self addWindowObservers];
             [self addSuperviewObservers];
             [self addMouseMovedObserver];
-            [self updateTextBackgroundColor];
+            [self updateFocusDisplay];
     
             [[self _pluginController] startAllPlugins];
     
@@ -1717,20 +1711,14 @@ static WebHTMLView *lastHitView = nil;
 {
     ASSERT([notification object] == [self window]);
     [self addMouseMovedObserver];
-    if ([self firstResponderIsSelfOrDescendantView]) {
-        [self updateTextBackgroundColor];
-        [self updateShowsFirstResponder];
-    }
+    [self updateFocusDisplay];
 }
 
 - (void)windowDidResignKey: (NSNotification *)notification
 {
     ASSERT([notification object] == [self window]);
     [self removeMouseMovedObserver];
-    if ([self firstResponderIsSelfOrDescendantView]) {
-        [self updateTextBackgroundColor];
-        [self updateShowsFirstResponder];
-    }
+    [self updateFocusDisplay];
 }
 
 - (void)windowWillClose:(NSNotification *)notification
@@ -2070,8 +2058,7 @@ static WebHTMLView *lastHitView = nil;
     if (view) {
         [[self window] makeFirstResponder:view];
     }
-    [self setCaretVisible:YES];
-    [self updateTextBackgroundColor];
+    [self updateFocusDisplay];
     return YES;
 }
 
@@ -2090,8 +2077,7 @@ static WebHTMLView *lastHitView = nil;
                 [self deselectAll];
             }
         }
-        [self setCaretVisible:NO];
-        [self updateTextBackgroundColor];
+        [self updateFocusDisplay];
         _private->resigningFirstResponder = NO;
     }
     return resign;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list