[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:37:32 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit dd63ceba42e68b544d982817102df18555760f51
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 28 16:55:28 2004 +0000

    WebCore:
    
            Reviewed by Darin
    
            * khtml/khtml_part.cpp:
            (KHTMLPart::notifySelectionChanged): Call new postDidChangeSelectionNotification function
            to send Cocoa notification when the selection changes.
            (KHTMLPart::appliedEditing): Call postDidChangeNotification to send Cocoa notification when the document changes
            due to editing.
            (KHTMLPart::unappliedEditing): Ditto.
            (KHTMLPart::reappliedEditing): Ditto.
            * kwq/DOMHTML.mm:
            (-[DOMHTMLDocument _HTMLDocumentImpl]): Fix cast to account for multiple inheritance used by the impl class.
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::postDidChangeSelectionNotification): New function. Call the bridge to post the notification.
            (KWQKHTMLPart::postDidChangeNotification): Ditto.
            * kwq/WebCoreBridge.h: Declare new -postDidChangeSelectionNotification and -postDidChangeNotification methods.
    
    WebKit:
    
            Reviewed by Darin
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge postDidChangeNotification]): Posts Cocoa notification when the document changes
            due to editing.
            (-[WebBridge postDidChangeSelectionNotification]): Posts Cocoa notification when the document selection
            changes.
            * WebKit.exp: Export editing notification string constants.
            * WebView.subproj/WebView.m: Define editing notification string constants.
            (-[WebView computedStyleForElement:pseudoElement:]): Add implementation.
            (-[WebView setEditingDelegate:]): Do work to set up delegate to receive notification callbacks.
            (-[WebView DOMDocument]): Simplify to just call the bridge DOMDocument. No need to jump through hoops here.
            (-[WebView insertNewline:]): Consult delegate before taking action.
            (-[WebView deleteBackward:]): Ditto.
            (-[WebView insertText:]): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6502 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5cd0d3a..b9630e1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2004-04-28  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::notifySelectionChanged): Call new postDidChangeSelectionNotification function
+        to send Cocoa notification when the selection changes.
+        (KHTMLPart::appliedEditing): Call postDidChangeNotification to send Cocoa notification when the document changes
+        due to editing.
+        (KHTMLPart::unappliedEditing): Ditto.
+        (KHTMLPart::reappliedEditing): Ditto.
+        * kwq/DOMHTML.mm:
+        (-[DOMHTMLDocument _HTMLDocumentImpl]): Fix cast to account for multiple inheritance used by the impl class.
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::postDidChangeSelectionNotification): New function. Call the bridge to post the notification.
+        (KWQKHTMLPart::postDidChangeNotification): Ditto.
+        * kwq/WebCoreBridge.h: Declare new -postDidChangeSelectionNotification and -postDidChangeNotification methods.
+
 2004-04-28  Darin Adler  <darin at apple.com>
 
         Reviewed by Ken.
@@ -12,6 +31,7 @@
 
 	<rdar://problem/3564519>: API: please add a way to set the media type for a WebView
 
+
         Reviewed by Chris.
 
         * khtml/khtmlview.cpp:
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 65c425a..1383c3e 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -2605,6 +2605,10 @@ void KHTMLPart::notifySelectionChanged(bool endTyping)
     d->m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation;
     
     emitSelectionChanged();
+    
+#if APPLE_CHANGES
+    KWQ(this)->postDidChangeSelectionNotification();
+#endif
 }
 
 void KHTMLPart::setXPosForVerticalArrowNavigation(int x)
@@ -5112,6 +5116,7 @@ void KHTMLPart::appliedEditing(EditCommand &cmd)
     if (d->m_lastEditCommand != cmd) {
 #if APPLE_CHANGES
         KWQ(this)->registerCommandForUndo(cmd);
+        KWQ(this)->postDidChangeNotification();
 #endif
     }
     d->m_lastEditCommand = cmd;
@@ -5123,6 +5128,7 @@ void KHTMLPart::unappliedEditing(EditCommand &cmd)
 
 #if APPLE_CHANGES
     KWQ(this)->registerCommandForRedo(cmd);
+    KWQ(this)->postDidChangeNotification();
 #endif
     d->m_lastEditCommand = EditCommand::emptyCommand();
 }
@@ -5131,6 +5137,7 @@ void KHTMLPart::reappliedEditing(EditCommand &cmd)
 {
 #if APPLE_CHANGES
     KWQ(this)->registerCommandForUndo(cmd);
+    KWQ(this)->postDidChangeNotification();
 #endif
     d->m_lastEditCommand = EditCommand::emptyCommand();
 }
diff --git a/WebCore/kwq/DOMHTML.mm b/WebCore/kwq/DOMHTML.mm
index 9b21e84..3b870a4 100644
--- a/WebCore/kwq/DOMHTML.mm
+++ b/WebCore/kwq/DOMHTML.mm
@@ -335,7 +335,7 @@ using DOM::NodeImpl;
 
 - (HTMLDocumentImpl *)_HTMLDocumentImpl
 {
-    return reinterpret_cast<HTMLDocumentImpl *>(_internal);
+    return static_cast<HTMLDocumentImpl *>(reinterpret_cast<NodeImpl *>(_internal));
 }
 
 - (NSString *)title
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 214e54c..247e89e 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -279,6 +279,8 @@ public:
     void issueCutCommand();
     void issueCopyCommand();
     void issuePasteCommand();
+    void postDidChangeSelectionNotification();
+    void postDidChangeNotification();
 
     void bindObject(void *object, QString name);
     
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 73a1065..038b3f8 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -2939,3 +2939,13 @@ void KWQKHTMLPart::issuePasteCommand()
 {
     [_bridge issuePasteCommand];
 }
+
+void KWQKHTMLPart::postDidChangeSelectionNotification()
+{
+    [_bridge postDidChangeSelectionNotification];
+}
+
+void KWQKHTMLPart::postDidChangeNotification()
+{
+    [_bridge postDidChangeNotification];
+}
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index e699763..56a2aa7 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -439,6 +439,8 @@ typedef enum {
 - (void)issueCutCommand;
 - (void)issueCopyCommand;
 - (void)issuePasteCommand;
+- (void)postDidChangeSelectionNotification;
+- (void)postDidChangeNotification;
 
 - (void)editingKeyDown:(NSEvent *)event;
 
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 7c66a9b..07e05df 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -32,6 +32,7 @@
 #import "dom_position.h"
 #import "dom_selection.h"
 #import "dom2_rangeimpl.h"
+#import "dom2_viewsimpl.h"
 #import "htmlediting.h"
 #import "html_documentimpl.h"
 #import "html_formimpl.h"
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index e1d1083..a64bfa3 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,21 @@
+2004-04-28  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge postDidChangeNotification]): Posts Cocoa notification when the document changes
+        due to editing.
+        (-[WebBridge postDidChangeSelectionNotification]): Posts Cocoa notification when the document selection
+        changes.
+        * WebKit.exp: Export editing notification string constants.
+        * WebView.subproj/WebView.m: Define editing notification string constants.
+        (-[WebView computedStyleForElement:pseudoElement:]): Add implementation.
+        (-[WebView setEditingDelegate:]): Do work to set up delegate to receive notification callbacks.
+        (-[WebView DOMDocument]): Simplify to just call the bridge DOMDocument. No need to jump through hoops here.
+        (-[WebView insertNewline:]): Consult delegate before taking action.
+        (-[WebView deleteBackward:]): Ditto.
+        (-[WebView insertText:]): Ditto.
+
 2004-04-27  John Sullivan  <sullivan at apple.com>
 
         Fixed broken development build.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 98b0452..7d934ab 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -1166,6 +1166,16 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
     return applet;
 }
 
+- (void)postDidChangeNotification
+{
+    [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeNotification object:[_frame webView]];
+}
+
+- (void)postDidChangeSelectionNotification
+{
+    [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeSelectionNotification object:[_frame webView]];
+}
+
 - (void)registerCommandForUndo:(id)arg
 {
     NSUndoManager *undoManager = [[_frame webView] undoManager];
diff --git a/WebKit/WebKit.exp b/WebKit/WebKit.exp
index 53d4d9d..cceed21 100644
--- a/WebKit/WebKit.exp
+++ b/WebKit/WebKit.exp
@@ -75,6 +75,11 @@ _WebURLPboardType
 _WebViewProgressStartedNotification
 _WebViewProgressEstimateChangedNotification
 _WebViewProgressFinishedNotification
+_WebViewDidBeginEditingNotification
+_WebViewDidChangeNotification
+_WebViewDidEndEditingNotification
+_WebViewDidChangeTypingStyleNotification
+_WebViewDidChangeSelectionNotification
 
 ##
 ## Carbon Support
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 9ec2fcb..ed092e9 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -81,6 +81,12 @@ NSString *WebViewProgressStartedNotification =          @"WebProgressStartedNoti
 NSString *WebViewProgressEstimateChangedNotification =  @"WebProgressEstimateChangedNotification";
 NSString *WebViewProgressFinishedNotification =         @"WebProgressFinishedNotification";
 
+NSString * const WebViewDidBeginEditingNotification =         @"WebViewDidBeginEditingNotification";
+NSString * const WebViewDidChangeNotification =               @"WebViewDidChangeNotification";
+NSString * const WebViewDidEndEditingNotification =           @"WebViewDidEndEditingNotification";
+NSString * const WebViewDidChangeTypingStyleNotification =    @"WebViewDidChangeTypingStyleNotification";
+NSString * const WebViewDidChangeSelectionNotification =      @"WebViewDidChangeSelectionNotification";
+
 enum { WebViewVersion = 2 };
 
 #define timedLayoutSize 4096
@@ -2129,8 +2135,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (DOMCSSStyleDeclaration *)computedStyleForElement:(DOMElement *)element pseudoElement:(NSString *)pseudoElement
 {
-    ERROR("unimplemented");
-    return nil;
+    return [[self DOMDocument] getComputedStyle:element :pseudoElement];
 }
 
 @end
@@ -2222,9 +2227,28 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (void)setEditingDelegate:(id)delegate
 {
+    if (_private->editingDelegate == delegate)
+        return;
+
+    NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
+
+    // remove notifications from current delegate
+    [defaultCenter removeObserver:_private->editingDelegate name:WebViewDidBeginEditingNotification object:self];
+    [defaultCenter removeObserver:_private->editingDelegate name:WebViewDidChangeNotification object:self];
+    [defaultCenter removeObserver:_private->editingDelegate name:WebViewDidEndEditingNotification object:self];
+    [defaultCenter removeObserver:_private->editingDelegate name:WebViewDidChangeTypingStyleNotification object:self];
+    [defaultCenter removeObserver:_private->editingDelegate name:WebViewDidChangeSelectionNotification object:self];
+    
     _private->editingDelegate = delegate;
     [_private->editingDelegateForwarder release];
     _private->editingDelegateForwarder = nil;
+    
+    // add notifications for new delegate
+    [defaultCenter addObserver:_private->editingDelegate selector:@selector(webViewDidBeginEditing:) name:WebViewDidBeginEditingNotification object:self];
+    [defaultCenter addObserver:_private->editingDelegate selector:@selector(webViewDidChange:) name:WebViewDidChangeNotification object:self];
+    [defaultCenter addObserver:_private->editingDelegate selector:@selector(webViewDidEndEditing:) name:WebViewDidEndEditingNotification object:self];
+    [defaultCenter addObserver:_private->editingDelegate selector:@selector(webViewDidChangeTypingStyle:) name:WebViewDidChangeTypingStyleNotification object:self];
+    [defaultCenter addObserver:_private->editingDelegate selector:@selector(webViewDidChangeSelection:) name:WebViewDidChangeSelectionNotification object:self];    
 }
 
 - (id)editingDelegate
@@ -2234,10 +2258,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (DOMDocument *)DOMDocument
 {
-    if ([[[[self mainFrame] dataSource] representation] conformsToProtocol:@protocol(WebDocumentDOM)]) {
-        return [(id <WebDocumentDOM>)[[[self mainFrame] dataSource] representation] DOMDocument];
-    }
-    return nil;
+    return [[self _bridgeForCurrentSelection] DOMDocument];
 }
 
 - (DOMCSSStyleDeclaration *)styleDeclarationWithText:(NSString *)text
@@ -2825,8 +2846,11 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 {
     if ([self _currentSelectionIsEditable]) {
         WebBridge *bridge = [self _bridgeForCurrentSelection];
-        [bridge replaceSelectionWithNewline];
-        [bridge ensureCaretVisible];
+        // Perhaps we should make this delegate call sensitive to the real DOM operation we actually do.
+        if ([[self _editingDelegateForwarder] webView:self shouldInsertText:@"\n" replacingDOMRange:[self selectedDOMRange] givenAction:WebViewInsertActionTyped]) {
+            [bridge replaceSelectionWithNewline];
+            [bridge ensureCaretVisible];
+        }
         return;
     }
     [[self nextResponder] tryToPerform:@selector(insertNewline:) with:sender];
@@ -2896,8 +2920,10 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 {
     if ([self _currentSelectionIsEditable]) {
         WebBridge *bridge = [self _bridgeForCurrentSelection];
-        [bridge deleteKeyPressed];
-        [bridge ensureCaretVisible];
+        if ([[self _editingDelegateForwarder] webView:self shouldDeleteDOMRange:[self selectedDOMRange]]) {
+            [bridge deleteKeyPressed];
+            [bridge ensureCaretVisible];
+        }
         return;
     }
     [[self nextResponder] tryToPerform:@selector(deleteBackward:) with:sender];
@@ -3038,8 +3064,10 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 {
     if ([self _currentSelectionIsEditable]) {
         WebBridge *bridge = [self _bridgeForCurrentSelection];
-        [bridge replaceSelectionWithText:text];
-        [bridge ensureCaretVisible];
+        if ([[self _editingDelegateForwarder] webView:self shouldInsertText:text replacingDOMRange:[self selectedDOMRange] givenAction:WebViewInsertActionTyped]) {
+            [bridge replaceSelectionWithText:text];
+            [bridge ensureCaretVisible];
+        }
         return;
     }
     [[self nextResponder] tryToPerform:@selector(insertText:) with:text];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list