WebCore:
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2005 16:36:00 +0000 (16:36 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2005 16:36:00 +0000 (16:36 +0000)
        Reviewed by Darin

        Fix for this bug:

        <rdar://problem/4042935> undo doesn't work properly during inline input

        * kwq/WebCoreBridge.h: Declare new method below.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge replaceMarkedTextWithText:]): New method. Wraps calls to TypingCommand::deleteKeyPressed and
        TypingCommand::insertText to map the way that international text input works onto the typing undo system.

WebKit:

        Reviewed by Darin

        Fix for this bug:

        <rdar://problem/4042935> undo doesn't work properly during inline input

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView setMarkedText:selectedRange:]): Call new -[WebCoreBridge replaceMarkedTextWithText:] instead of
        -[WebCoreBridge replaceSelectionWithText:selectReplacement:smartReplace:]. The former call was just added in
        order to provide a better mapping of international text input onto the typing command/undo design.

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

WebCore/ChangeLog-2005-08-23
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreBridge.mm
WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m

index 0144ace24b4867b95f33a72f56ad1c4907c4d65d..5c72c088bdddd1ab9bee1b8414465361f46a7990 100644 (file)
@@ -1,3 +1,16 @@
+2005-03-16  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Darin
+
+        Fix for this bug:
+        
+        <rdar://problem/4042935> undo doesn't work properly during inline input
+
+        * kwq/WebCoreBridge.h: Declare new method below.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge replaceMarkedTextWithText:]): New method. Wraps calls to TypingCommand::deleteKeyPressed and
+        TypingCommand::insertText to map the way that international text input works onto the typing undo system.
+
 2005-03-16  David Harrison  <harrison@apple.com>
 
         Reviewed by Darin.
index d4d9922e438c6f45756b85ca65d8481c8bf8e0cd..24d6aa1f988352302144e6f5323a666198ebe4b9 100644 (file)
@@ -333,6 +333,7 @@ typedef enum {
 // international text input "marked text"
 - (void)setMarkedTextDOMRange:(DOMRange *)range customAttributes:(NSArray *)attributes ranges:(NSArray *)ranges;
 - (DOMRange *)markedTextDOMRange;
+- (void)replaceMarkedTextWithText:(NSString *)text;
 
 - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
 
index ec3d5c56dedf035fb2c61b95d8b897d10ec1e8fa..d60066780ad2e5168c9b92cdac2c089b3183dba5 100644 (file)
@@ -29,6 +29,7 @@
 
 #import "csshelper.h"
 #import "dom2_eventsimpl.h"
+#import "dom2_range.h"
 #import "dom2_rangeimpl.h"
 #import "dom2_viewsimpl.h"
 #import "dom_docimpl.h"
@@ -1654,6 +1655,21 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     return [DOMRange _rangeWithImpl:_part->markedTextRange().handle()];
 }
 
+- (void)replaceMarkedTextWithText:(NSString *)text
+{
+    if (!partHasSelection(self))
+        return;
+    
+    Range markedTextRange = _part->markedTextRange();
+    if (!markedTextRange.isNull() && !markedTextRange.collapsed())
+        TypingCommand::deleteKeyPressed(_part->xmlDocImpl(), NO);
+    
+    if ([text length] > 0)
+        TypingCommand::insertText(_part->xmlDocImpl(), text, YES);
+    
+    [self ensureSelectionVisible];
+}
+
 // Given proposedRange, returns an extended range that includes adjacent whitespace that should
 // be deleted along with the proposed range in order to preserve proper spacing and punctuation of
 // the text surrounding the deletion.
index 854ee2d61cd937d8e088ec88b93b9f37dcd48173..059508e27cdad2d1a9908d13b3eda403b60e31a2 100644 (file)
@@ -1,3 +1,16 @@
+2005-03-16  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Darin
+
+        Fix for this bug:
+        
+        <rdar://problem/4042935> undo doesn't work properly during inline input
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView setMarkedText:selectedRange:]): Call new -[WebCoreBridge replaceMarkedTextWithText:] instead of 
+        -[WebCoreBridge replaceSelectionWithText:selectReplacement:smartReplace:]. The former call was just added in 
+        order to provide a better mapping of international text input onto the typing command/undo design.
+
 2005-03-15  Richard Williamson   <rjw@apple.com>
 
        Fixed <rdar://problem/4040321> Exception: Someone's trying to encode a WebDataRequestParameters instance
index d0ed0cdd4e4f5770023e7141d4fbde7efd19345b..897be98e9f66a464602d65dc569bebd205c5660d 100644 (file)
@@ -5002,7 +5002,7 @@ static NSArray *validAttributes = nil;
        text = string;
     }
 
-    [bridge replaceSelectionWithText:text selectReplacement:YES smartReplace:NO];
+    [bridge replaceMarkedTextWithText:text];
     [bridge setMarkedTextDOMRange:[self _selectedRange] customAttributes:attributes ranges:ranges];
     if ([self hasMarkedText]) {
         [self _selectRangeInMarkedText:newSelRange];