[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:48:20 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bc583d045080459a64c610dec8a04f60b5c7cad5
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 24 00:23:31 2003 +0000

    WebCore:
    
            Reviewed by John.
    
            - fixed 2/3 of 3279864 -- remove class_poseAs calls from WebKit (will also remove init routine)
    
            * kwq/KWQTextArea.h: Add drawing state variable so we can tell the difference
            between calls to draw the insertion point inside and calls to draw outside the
            redraw machinery.
            * kwq/KWQTextArea.mm:
            (-[KWQTextArea displayRectIgnoringOpacity:]): Added. Set drawing flag while in here.
            This is the method used by KWQWidget to draw.
            (-[KWQTextArea textView:shouldDrawInsertionPointInRect:color:turnedOn:]): Added.
            Calls setNeedsDisplay (the NSView version, not the NSTextView override) instead
            of immediately drawing when asked to draw outside the normal redraw machinery.
            (-[KWQTextAreaTextView keyDown:]): Call interceptKeyEvent before handling each
            key down event.
            * kwq/KWQTextField.h: Add drawing state variable so we can tell the difference
            between calls to draw the insertion point inside and calls to draw outside the
            redraw machinery.
            * kwq/KWQTextField.mm:
            (-[KWQTextField displayRectIgnoringOpacity:]): Added. Set drawing flag while in here.
            This is the method used by KWQWidget to draw.
            (-[KWQTextField textView:shouldDrawInsertionPointInRect:color:turnedOn:]): Added.
            Calls setNeedsDisplay (the NSView version, not the NSTextView override) instead
            of immediately drawing when asked to draw outside the normal redraw machinery.
            (-[KWQTextField textView:shouldHandleEvent:]): Call interceptKeyEvent before
            handling each key down event.
            (-[KWQTextField textView:didHandleEvent:]): Call fieldEditorDidMouseDown: after
            handling each mouse down event.
    
            * kwq/KWQWidget.mm: (QWidget::paint): Add comment about dependency on
            displayRectIgnoringOpacity: use in KWQTextArea and KWQTextField.
    
            * kwq/WebCoreFirstResponderChanges.h: Added a comment about obsolescence.
    
            - Xcode wanted to change this, because it now knows JavaScriptCore is a framework
    
            * WebCore.pbproj/project.pbxproj: Munged by Xcode.
    
    WebKit:
    
            Reviewed by John.
    
            - fixed 2/3 of 3279864 -- remove class_poseAs calls from WebKit (will also remove init routine)
    
            * WebView.subproj/WebHTMLViewPrivate.m: (+[WebHTMLView load]):
            Only pose as NSTextView and NSWindow if we have an older AppKit.
            If we have a new enough AppKit, the code in WebCore now takes care of things.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4696 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 8f767f6..0d50ba0 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,43 @@
+2003-07-23  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed 2/3 of 3279864 -- remove class_poseAs calls from WebKit (will also remove init routine)
+
+        * kwq/KWQTextArea.h: Add drawing state variable so we can tell the difference
+        between calls to draw the insertion point inside and calls to draw outside the
+        redraw machinery.
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea displayRectIgnoringOpacity:]): Added. Set drawing flag while in here.
+        This is the method used by KWQWidget to draw.
+        (-[KWQTextArea textView:shouldDrawInsertionPointInRect:color:turnedOn:]): Added.
+        Calls setNeedsDisplay (the NSView version, not the NSTextView override) instead
+        of immediately drawing when asked to draw outside the normal redraw machinery.
+        (-[KWQTextAreaTextView keyDown:]): Call interceptKeyEvent before handling each
+        key down event.
+        * kwq/KWQTextField.h: Add drawing state variable so we can tell the difference
+        between calls to draw the insertion point inside and calls to draw outside the
+        redraw machinery.
+        * kwq/KWQTextField.mm:
+        (-[KWQTextField displayRectIgnoringOpacity:]): Added. Set drawing flag while in here.
+        This is the method used by KWQWidget to draw.
+        (-[KWQTextField textView:shouldDrawInsertionPointInRect:color:turnedOn:]): Added.
+        Calls setNeedsDisplay (the NSView version, not the NSTextView override) instead
+        of immediately drawing when asked to draw outside the normal redraw machinery.
+        (-[KWQTextField textView:shouldHandleEvent:]): Call interceptKeyEvent before
+        handling each key down event.
+        (-[KWQTextField textView:didHandleEvent:]): Call fieldEditorDidMouseDown: after
+        handling each mouse down event.
+
+        * kwq/KWQWidget.mm: (QWidget::paint): Add comment about dependency on
+        displayRectIgnoringOpacity: use in KWQTextArea and KWQTextField.
+
+        * kwq/WebCoreFirstResponderChanges.h: Added a comment about obsolescence.
+
+        - Xcode wanted to change this, because it now knows JavaScriptCore is a framework
+
+        * WebCore.pbproj/project.pbxproj: Munged by Xcode.
+
 2003-07-23  Dave Hyatt  <hyatt at apple.com>
 
 	Fix for 3340885, invalid colors were being mapped to transparentColor,
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8f767f6..0d50ba0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,43 @@
+2003-07-23  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed 2/3 of 3279864 -- remove class_poseAs calls from WebKit (will also remove init routine)
+
+        * kwq/KWQTextArea.h: Add drawing state variable so we can tell the difference
+        between calls to draw the insertion point inside and calls to draw outside the
+        redraw machinery.
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea displayRectIgnoringOpacity:]): Added. Set drawing flag while in here.
+        This is the method used by KWQWidget to draw.
+        (-[KWQTextArea textView:shouldDrawInsertionPointInRect:color:turnedOn:]): Added.
+        Calls setNeedsDisplay (the NSView version, not the NSTextView override) instead
+        of immediately drawing when asked to draw outside the normal redraw machinery.
+        (-[KWQTextAreaTextView keyDown:]): Call interceptKeyEvent before handling each
+        key down event.
+        * kwq/KWQTextField.h: Add drawing state variable so we can tell the difference
+        between calls to draw the insertion point inside and calls to draw outside the
+        redraw machinery.
+        * kwq/KWQTextField.mm:
+        (-[KWQTextField displayRectIgnoringOpacity:]): Added. Set drawing flag while in here.
+        This is the method used by KWQWidget to draw.
+        (-[KWQTextField textView:shouldDrawInsertionPointInRect:color:turnedOn:]): Added.
+        Calls setNeedsDisplay (the NSView version, not the NSTextView override) instead
+        of immediately drawing when asked to draw outside the normal redraw machinery.
+        (-[KWQTextField textView:shouldHandleEvent:]): Call interceptKeyEvent before
+        handling each key down event.
+        (-[KWQTextField textView:didHandleEvent:]): Call fieldEditorDidMouseDown: after
+        handling each mouse down event.
+
+        * kwq/KWQWidget.mm: (QWidget::paint): Add comment about dependency on
+        displayRectIgnoringOpacity: use in KWQTextArea and KWQTextField.
+
+        * kwq/WebCoreFirstResponderChanges.h: Added a comment about obsolescence.
+
+        - Xcode wanted to change this, because it now knows JavaScriptCore is a framework
+
+        * WebCore.pbproj/project.pbxproj: Munged by Xcode.
+
 2003-07-23  Dave Hyatt  <hyatt at apple.com>
 
 	Fix for 3340885, invalid colors were being mapped to transparentColor,
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 6a10adf..52fbf34 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -9477,7 +9477,7 @@
 //F83
 //F84
 		F8216299029F4FB501000131 = {
-			expectedFileType = file;
+			expectedFileType = wrapper.framework;
 			fallbackIsa = PBXFileReference;
 			isa = PBXFrameworkReference;
 			path = JavaScriptCore.framework;
diff --git a/WebCore/kwq/KWQTextArea.h b/WebCore/kwq/KWQTextArea.h
index 1d9d851..2b9ae67 100644
--- a/WebCore/kwq/KWQTextArea.h
+++ b/WebCore/kwq/KWQTextArea.h
@@ -35,6 +35,7 @@ class QTextEdit;
     QTextEdit *widget;
     BOOL wrap;
     BOOL inNextValidKeyView;
+    BOOL inDrawingMachinery;
 }
 
 - initWithQTextEdit:(QTextEdit *)w; 
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index 8da18ff..a75c337 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -423,6 +423,43 @@ static NSRange RangeOfParagraph(NSString *text, int paragraph)
     [textView setAlignment:alignment];
 }
 
+// This is the only one of the display family of calls that we use, and the way we do
+// displaying in WebCore means this is called on this NSView explicitly, so this catches
+// all cases where we are inside the normal display machinery. (Used only by the insertion
+// point method below.)
+- (void)displayRectIgnoringOpacity:(NSRect)rect
+{
+    inDrawingMachinery = YES;
+    [super displayRectIgnoringOpacity:rect];
+    inDrawingMachinery = NO;
+}
+
+// Use the "needs display" mechanism to do all insertion point drawing in the web view.
+- (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
+{
+    // We only need to take control of the cases where we are being asked to draw by something
+    // outside the normal display machinery, and when we are being asked to draw the insertion
+    // point, not erase it.
+    if (inDrawingMachinery || !drawInsteadOfErase) {
+        return YES;
+    }
+
+    // NSTextView's insertion-point drawing code sets the rect width to 1.
+    // So we do the same thing, to affect exactly the same rectangle.
+    rect.size.width = 1;
+
+    // Call through to the setNeedsDisplayInRect implementation in NSView.
+    // If we call the one in NSTextView through the normal method dispatch
+    // we will reenter the caret blinking code and end up with a nasty crash
+    // (see Radar 3250608).
+    SEL selector = @selector(setNeedsDisplayInRect:);
+    typedef void (*IMPWithNSRect)(id, SEL, NSRect);
+    IMPWithNSRect implementation = (IMPWithNSRect)[NSView instanceMethodForSelector:selector];
+    implementation(view, selector, rect);
+
+    return NO;
+}
+
 @end
 
 @implementation KWQTextAreaTextView
@@ -558,6 +595,22 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
     widget->clicked();
 }
 
+- (void)keyDown:(NSEvent *)event
+{
+    // FIXME: We only want this code when we are not posing in WebKit,
+    // so we do the same version number check here that we had there.
+    // Once we remove the posing from WebKit entirely, we can remove
+    // this version check as well.
+    if (NSAppKitVersionNumber >= 705) {
+        WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
+        [bridge interceptKeyEvent:event toView:self];
+        // FIXME: In theory, if the bridge intercepted the event we should return not call super.
+        // But the code in the Web Kit that this replaces did not do that, so lets not do it until
+        // we can do more testing to see if it works well.
+    }
+    [super keyDown:event];
+}
+
 @end
 
 @implementation NSView (KWQTextArea)
diff --git a/WebCore/kwq/KWQTextField.h b/WebCore/kwq/KWQTextField.h
index 529bcda..27a63de 100644
--- a/WebCore/kwq/KWQTextField.h
+++ b/WebCore/kwq/KWQTextField.h
@@ -35,10 +35,11 @@ class QLineEdit;
     QLineEdit *widget;
     NSTextField *secureField;
     KWQTextFieldFormatter *formatter;
-    BOOL _hasFocus;
+    BOOL hasFocus;
     BOOL edited;
     BOOL inNextValidKeyView;
     NSRange lastSelectedRange;
+    BOOL inDrawingMachinery;
 }
 
 - initWithQLineEdit:(QLineEdit *)widget;
diff --git a/WebCore/kwq/KWQTextField.mm b/WebCore/kwq/KWQTextField.mm
index 65262c2..4550ef3 100644
--- a/WebCore/kwq/KWQTextField.mm
+++ b/WebCore/kwq/KWQTextField.mm
@@ -355,6 +355,7 @@
     return widget;
 }
 
+// FIXME: We can remove this once we require AppKit-705 or newer.
 - (void)fieldEditorDidMouseDown:(NSEvent *)event
 {
     widget->sendConsumedMouseUp();
@@ -367,6 +368,62 @@
     [super setAlignment:alignment];
 }
 
+// This is the only one of the display family of calls that we use, and the way we do
+// displaying in WebCore means this is called on this NSView explicitly, so this catches
+// all cases where we are inside the normal display machinery. (Used only by the insertion
+// point method below.)
+- (void)displayRectIgnoringOpacity:(NSRect)rect
+{
+    inDrawingMachinery = YES;
+    [super displayRectIgnoringOpacity:rect];
+    inDrawingMachinery = NO;
+}
+
+// Use the "needs display" mechanism to do all insertion point drawing in the web view.
+- (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
+{
+    // We only need to take control of the cases where we are being asked to draw by something
+    // outside the normal display machinery, and when we are being asked to draw the insertion
+    // point, not erase it.
+    if (inDrawingMachinery || !drawInsteadOfErase) {
+        return YES;
+    }
+
+    // NSTextView's insertion-point drawing code sets the rect width to 1.
+    // So we do the same thing, to affect exactly the same rectangle.
+    rect.size.width = 1;
+
+    // Call through to the setNeedsDisplayInRect implementation in NSView.
+    // If we call the one in NSTextView through the normal method dispatch
+    // we will reenter the caret blinking code and end up with a nasty crash
+    // (see Radar 3250608).
+    SEL selector = @selector(setNeedsDisplayInRect:);
+    typedef void (*IMPWithNSRect)(id, SEL, NSRect);
+    IMPWithNSRect implementation = (IMPWithNSRect)[NSView instanceMethodForSelector:selector];
+    implementation(view, selector, rect);
+
+    return NO;
+}
+
+- (BOOL)textView:(NSTextView *)view shouldHandleEvent:(NSEvent *)event
+{
+    if ([event type] == NSKeyDown) {
+        WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
+        [bridge interceptKeyEvent:event toView:view];
+        // FIXME: In theory, if the bridge intercepted the event we should return NO.
+        // But the code in the Web Kit that we moved in here did not do that.
+    }
+    return YES;
+}
+
+- (void)textView:(NSTextView *)view didHandleEvent:(NSEvent *)event
+{
+    if ([event type] == NSLeftMouseUp) {
+        widget->sendConsumedMouseUp();
+        widget->clicked();
+    }
+}
+
 @end
 
 @implementation KWQTextField (KWQInternal)
@@ -401,15 +458,15 @@
     }
 }
 
-- (void)setHasFocus:(BOOL)hasFocus
+- (void)setHasFocus:(BOOL)nowHasFocus
 {
-    if (hasFocus == _hasFocus) {
+    if (nowHasFocus == hasFocus) {
         return;
     }
 
-    _hasFocus = hasFocus;
+    hasFocus = nowHasFocus;
 
-    if (hasFocus) {
+    if (nowHasFocus) {
         // Select all the text if we are tabbing in, but otherwise preserve/remember
         // the selection from last time we had focus (to match WinIE).
         if ([[self window] keyViewSelectionDirection] != NSDirectSelection) {
@@ -606,6 +663,7 @@
     return [(KWQTextField *)[self delegate] widget];
 }
 
+// FIXME: We can remove this once we require AppKit-705 or newer.
 - (void)fieldEditorDidMouseDown:(NSEvent *)event
 {
     ASSERT([[self delegate] isKindOfClass:[KWQTextField class]]);
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 0f25ac2..73c4441 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -419,11 +419,11 @@ void QWidget::paint(QPainter *p, const QRect &r)
         return;
     }
     NSView *view = getOuterView();
+    // KWQTextArea and KWQTextField both rely on the fact that we use this particular
+    // NSView display method. If you change this, be sure to update them as well.
     [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]];
 }
 
-
-
 void QWidget::sendConsumedMouseUp()
 {
     khtml::RenderWidget *widget = const_cast<khtml::RenderWidget *>
diff --git a/WebCore/kwq/WebCoreFirstResponderChanges.h b/WebCore/kwq/WebCoreFirstResponderChanges.h
index 3c6f70e..b9d2266 100644
--- a/WebCore/kwq/WebCoreFirstResponderChanges.h
+++ b/WebCore/kwq/WebCoreFirstResponderChanges.h
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+// FIXME: Remove this entire file once we require AppKit-705 or newer.
+
 #import <Foundation/Foundation.h>
 
 // The WebCore client must arrange to call these methods after a text
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 214d431..943e324 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,13 @@
+2003-07-23  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed 2/3 of 3279864 -- remove class_poseAs calls from WebKit (will also remove init routine)
+
+        * WebView.subproj/WebHTMLViewPrivate.m: (+[WebHTMLView load]):
+        Only pose as NSTextView and NSWindow if we have an older AppKit.
+        If we have a new enough AppKit, the code in WebCore now takes care of things.
+
 2003-07-23  Richard Williamson   <rjw at apple.com>
 
 	Fixed for 3259840.  Use ATSU for scripts we don't handle internally,
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index c5f50f6..3f1c267 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -110,12 +110,20 @@ static BOOL forceRealHitTest = NO;
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
-    // Avoid indirect invocation of any class initializers.  This is a work-around to prevent
+    // Avoid indirect invocation of any class initializers by using function
+    // calls instead of methods here. This is a work-around to prevent
     // the +initializers being called before the REQUIRED AppKit initialization
     // that's done in +[NSApplication load].
+
     class_poseAs(objc_getClass("WebNSView"), objc_getClass("NSView"));
-    class_poseAs(objc_getClass("WebNSTextView"), objc_getClass("NSTextView"));
-    class_poseAs(objc_getClass("WebNSWindow"), objc_getClass("NSWindow"));
+
+    // Only do these two poses if we have an older AppKit.
+    // If AppKit is 705 or newer, this is handled over on the WebCore side,
+    // using the new NSTextView SPI.
+    if (NSAppKitVersionNumber < 705) {
+        class_poseAs(objc_getClass("WebNSTextView"), objc_getClass("NSTextView"));
+        class_poseAs(objc_getClass("WebNSWindow"), objc_getClass("NSWindow"));
+    }
 
     [pool release];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list