[webkit-changes] cvs commit: WebCore/kwq KWQKHTMLPart.mm

Justin justing at opensource.apple.com
Wed Nov 16 17:04:35 PST 2005


justing     05/11/16 17:04:34

  Modified:    .        ChangeLog
               khtml/editing edit_command.cpp
               kwq      KWQKHTMLPart.mm
  Log:
  
        Reviewed by darin
        
        <rdar://problem/4108909> Editing delegate gets extra webViewDidChangeSelection: notifications
        
        Editing operations used to set an empty selection on the part before 
        doing work.  Doing this 1) isn't necessary* 2) creates an extra didChangeSelection 
        notification (4108909) 3) produces a strange shouldChangeSelection call after the 
        editing operation is complete, i.e. "shouldChangeSelection from null to ...?"
        
        There are still strange shouldChangeSelection calls after this change. For example, 
        after a delete, the selection before the delete no longer exists, so it probably 
        doesn't make sense to ask the delegate if WebKit shouldChangeSelection.  This is filed 
        as 4343068.
        
        * This was added on 2004-09-28 in order to mark misspellings in the selection to 
        be operated on (marking misspellings is a side effect of setting a selection). 
  
        Misspellings in the old selection are still marked, but not until after the operation 
        is complete.  Since some editing operations remove the selection from the document 
        (i.e. delete or undo-typing), respondToChangedSelection no longer assumes that the old 
        selection is in the document.
        
        Updated layout tests to reflect this change.
        
        * khtml/editing/edit_command.cpp:
        (khtml::EditCommand::EditCommand): Don't set the part's selection to empty before editing.
        (khtml::EditCommand::apply): Ditto.
        (khtml::EditCommand::unapply): Ditto.
        (khtml::EditCommand::reapply): Ditto.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::respondToChangedSelection): Don't assume that the old selection is still in the document.
  
  Revision  Changes    Path
  1.374     +3 -0      WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.373
  retrieving revision 1.374
  diff -u -r1.373 -r1.374
  --- ChangeLog	17 Nov 2005 00:32:27 -0000	1.373
  +++ ChangeLog	17 Nov 2005 01:04:32 -0000	1.374
  @@ -1,3 +1,6 @@
  +2005-11-16  Justin Garcia  <justin.garcia at apple.com>
  +
        Reviewed by darin
        
        <rdar://problem/4108909> Editing delegate gets extra webViewDidChangeSelection: notifications
        
        Editing operations used to set an empty selection on the part before 
        doing work.  Doing this 1) isn't necessary* 2) creates an extra didChangeSelection 
        notification (4108909) 3) produces a strange shouldChangeSelection call after the 
        editing operation is complete, i.e. "shouldChangeSelection from null to ...?"
        
        There are still strange shouldChangeSelection calls after this change. For example, 
        after a delete, the selection before the delete no longer exists, so it probably 
        doesn't make sense to ask the delegate if WebKit shouldChangeSelection.  This is filed 
        as 4343068.
        
        * This was added on 2004-09-28 in order to mark misspellings in the selection to 
        be operated on (marking misspellings is a side effect of setting a selection).
   
        Misspellings in the old selection are still marked, but not until after the operation 
        is complete.  Since some editing operations remove the selection from the document 
        (i.e. delete or undo-typing), respondToChangedSelection no longer assumes that the old 
        selection is in the document.
        
        Updated layout tests to reflect this change.
        
        * khtml/editing/edit_command.cpp:
        (khtml::EditCommand::EditCommand): Don't set the part's selection to empty before editing.
        (khtml::EditCommand::apply): Ditto.
        (khtml::EditCommand::unapply): Ditto.
        (khtml::EditCommand::reapply): Ditto.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::respondToChangedSelection): Don't assume that the old selection is still in the document.
  +
   2005-11-16  Adele Peterson  <adele at apple.com>
   
           Reviewed by Dave Harrson.
  
  
  
  1.10      +0 -14     WebCore/khtml/editing/edit_command.cpp
  
  Index: edit_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/edit_command.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- edit_command.cpp	3 Oct 2005 21:12:19 -0000	1.9
  +++ edit_command.cpp	17 Nov 2005 01:04:34 -0000	1.10
  @@ -213,8 +213,6 @@
       m_document->ref();
       m_startingSelection = m_document->part()->selection();
       m_endingSelection = m_startingSelection;
  -
  -    m_document->part()->setSelection(SelectionController(), false, true);
   }
   
   EditCommand::~EditCommand()
  @@ -233,8 +231,6 @@
    
       KHTMLPart *part = m_document->part();
   
  -    ASSERT(part->selection().isNone());
  -
       doApply();
       
       m_state = Applied;
  @@ -260,11 +256,6 @@
       bool topLevel = !isCompositeStep();
    
       KHTMLPart *part = m_document->part();
  -
  -    if (topLevel) {
  -        part->setSelection(SelectionController(), false, true);
  -    }
  -    ASSERT(part->selection().isNone());
       
       doUnapply();
       
  @@ -286,11 +277,6 @@
       bool topLevel = !isCompositeStep();
    
       KHTMLPart *part = m_document->part();
  -
  -    if (topLevel) {
  -        part->setSelection(SelectionController(), false, true);
  -    }
  -    ASSERT(part->selection().isNone());
       
       doReapply();
       
  
  
  
  1.688     +8 -2      WebCore/kwq/KWQKHTMLPart.mm
  
  Index: KWQKHTMLPart.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
  retrieving revision 1.687
  retrieving revision 1.688
  diff -u -r1.687 -r1.688
  --- KWQKHTMLPart.mm	14 Nov 2005 03:49:54 -0000	1.687
  +++ KWQKHTMLPart.mm	17 Nov 2005 01:04:34 -0000	1.688
  @@ -4142,8 +4142,14 @@
   {
       if (xmlDocImpl()) {
           if ([_bridge isContinuousSpellCheckingEnabled]) {
  -            VisiblePosition oldStart(oldSelection.start(), oldSelection.startAffinity());
  -            SelectionController oldAdjacentWords(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
  +            SelectionController oldAdjacentWords = SelectionController();
  +            
  +            // If this is a change in selection resulting from a delete operation, oldSelection may no longer
  +            // be in the document.
  +            if (oldSelection.start().node() && oldSelection.start().node()->inDocument()) {
  +                VisiblePosition oldStart(oldSelection.start(), oldSelection.startAffinity());
  +                oldAdjacentWords = SelectionController(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));   
  +            }
   
               VisiblePosition newStart(selection().start(), selection().startAffinity());
               SelectionController newAdjacentWords(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
  
  
  



More information about the webkit-changes mailing list