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


The following commit has been merged in the debian/unstable branch:
commit 842d2036237eb58848400a443ffeaf1b3aacfc2d
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 10 16:27:46 2004 +0000

            Reviewed by Darin
    
            Fix for this bug:
    
            <rdar://problem/3672088>: "Editable WebViews should maintain a selection even when they're not firstResponder"
    
            Add some code to determine whether a WebHTMLView should maintain an
            inactive selection when the view is not first responder. Traditionally,
            these views have not maintained such selections, clearing them when the
            view was not first responder. However, for appls embedding this view as
            an editing widget, it is desirable to act more like an NSTextView. For
            now, however, the view only acts in this way when the web view is set to
            be editable with -[WebView setEditable:YES]. This will maintain
            traditional behavior for WebKit clients dating back to before this
            change, and will likely be a decent switch for the long term, since
            clients to ste the web view to be editable probably want it to act like
            a "regular" Cocoa view in terms of its selection behavior.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView updateTextBackgroundColor]): Add code to tell whether the view is resigning first responder,
            and if it is, use the inactive text background color.
            (-[WebHTMLView maintainsInactiveSelection]): New helper which does checks to see if the new selection
            behavior should be used, or whether we should continue with traditional WebKit behavior.
            (-[WebHTMLView resignFirstResponder]): Call new maintainsInactiveSelection helper. If true,
            do not clear the selection.
            * WebView.subproj/WebHTMLViewInternal.h: Add resigningFirstResponder flag.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6807 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 3ca8451..d996b72 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,32 @@
+2004-06-09  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+
+        Fix for this bug:
+        
+        <rdar://problem/3672088>: "Editable WebViews should maintain a selection even when they're not firstResponder"
+
+        Add some code to determine whether a WebHTMLView should maintain an
+        inactive selection when the view is not first responder. Traditionally,
+        these views have not maintained such selections, clearing them when the
+        view was not first responder. However, for appls embedding this view as
+        an editing widget, it is desirable to act more like an NSTextView. For
+        now, however, the view only acts in this way when the web view is set to
+        be editable with -[WebView setEditable:YES]. This will maintain
+        traditional behavior for WebKit clients dating back to before this
+        change, and will likely be a decent switch for the long term, since
+        clients to ste the web view to be editable probably want it to act like
+        a "regular" Cocoa view in terms of its selection behavior.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView updateTextBackgroundColor]): Add code to tell whether the view is resigning first responder,
+        and if it is, use the inactive text background color.
+        (-[WebHTMLView maintainsInactiveSelection]): New helper which does checks to see if the new selection
+        behavior should be used, or whether we should continue with traditional WebKit behavior.
+        (-[WebHTMLView resignFirstResponder]): Call new maintainsInactiveSelection helper. If true,
+        do not clear the selection.
+        * WebView.subproj/WebHTMLViewInternal.h: Add resigningFirstResponder flag.
+
 2004-06-09  Chris Blumenberg  <cblu at apple.com>
 
 	Implemented drag destination portion of the new drag & drop API.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 133a4ec..132b057 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -115,6 +115,10 @@ static BOOL forceRealHitTest = NO;
 - (void)speakString:(NSString *)string;
 @end
 
+ at interface NSWindow (AppKitSecretsIKnowAbout)
+- (id)_newFirstResponderAfterResigning;
+ at end
+
 @interface NSView (WebHTMLViewPrivate)
 - (void)_web_setPrintingModeRecursive;
 - (void)_web_clearPrintingModeRecursive;
@@ -1299,7 +1303,8 @@ static void FlipImageSpec(CoreDragImageSpec* imageSpec) {
 - (void)updateTextBackgroundColor
 {
     NSWindow *window = [self window];
-    BOOL shouldUseInactiveTextBackgroundColor = !([window isKeyWindow] && [window firstResponder] == self);
+    BOOL shouldUseInactiveTextBackgroundColor = !([window isKeyWindow] && [window firstResponder] == self) ||
+        _private->resigningFirstResponder;
     WebBridge *bridge = [self _bridge];
     if ([bridge usesInactiveTextBackgroundColor] != shouldUseInactiveTextBackgroundColor) {
         [bridge setUsesInactiveTextBackgroundColor:shouldUseInactiveTextBackgroundColor];
@@ -1307,6 +1312,30 @@ static void FlipImageSpec(CoreDragImageSpec* imageSpec) {
     }
 }
 
+- (BOOL)maintainsInactiveSelection
+{
+    // This method helps to determing whether the view should maintain
+    // an inactive selection when the view is not first responder.
+    // Traditionally, these views have not maintained such selections,
+    // clearing them when the view was not first responder. However,
+    // to fix bugs like this one:
+    // <rdar://problem/3672088>: "Editable WebViews should maintain a selection even 
+    //                            when they're not firstResponder"
+    // it was decided to add a switch to act more like an NSTextView.
+    // For now, however, the view only acts in this way when the
+    // web view is set to be editable. This will maintain traditional
+    // behavior for WebKit clients dating back to before this change,
+    // and will likely be a decent switch for the long term, since
+    // clients to ste the web view to be editable probably want it
+    // to act like a "regular" Cocoa view in terms of its selection
+    // behavior.
+    if (![[self _webView] isEditable])
+        return NO;
+        
+    id nextResponder = [[self window] _newFirstResponderAfterResigning];
+    return !nextResponder || ![nextResponder isKindOfClass:[NSView class]] || ![nextResponder isDescendantOf:[self _webView]];
+}
+
 - (void)addMouseMovedObserver
 {
     if ([[self window] isKeyWindow] && ![self _insideAnotherHTMLView]) {
@@ -2066,18 +2095,23 @@ static void FlipImageSpec(CoreDragImageSpec* imageSpec) {
     return YES;
 }
 
-// This approach could be relaxed when dealing with 3228554
+// This approach could be relaxed when dealing with 3228554.
+// Some alteration to the selection behavior was done to deal with 3672088.
 - (BOOL)resignFirstResponder
 {
     BOOL resign = [super resignFirstResponder];
     if (resign) {
-        if ([[self _webView] _isPerformingProgrammaticFocus]) {
-            [self deselectText];
-        }
-        else {
-            [self deselectAll];
+        _private->resigningFirstResponder = YES;
+        if (![self maintainsInactiveSelection]) { 
+            if ([[self _webView] _isPerformingProgrammaticFocus]) {
+                [self deselectText];
+            }
+            else {
+                [self deselectAll];
+            }
         }
         [self updateTextBackgroundColor];
+        _private->resigningFirstResponder = NO;
     }
     return resign;
 }
diff --git a/WebKit/WebView.subproj/WebHTMLViewInternal.h b/WebKit/WebView.subproj/WebHTMLViewInternal.h
index 669d631..e7b4316 100644
--- a/WebKit/WebView.subproj/WebHTMLViewInternal.h
+++ b/WebKit/WebView.subproj/WebHTMLViewInternal.h
@@ -40,6 +40,8 @@
     NSEvent *autoscrollTriggerEvent;
     
     NSArray* pageRects;
+
+    BOOL resigningFirstResponder;
 }
 @end
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list