[webkit-changes] cvs commit: WebCore/layout-tests/editing/deleting delete-br-011-expected.txt delete-br-011.html

David harrison at opensource.apple.com
Mon Jul 18 11:15:00 PDT 2005


harrison    05/07/18 11:15:00

  Modified:    .        ChangeLog
               khtml/editing delete_selection_command.cpp
  Added:       layout-tests/editing/deleting delete-br-011-expected.txt
                        delete-br-011.html
  Log:
          Reviewed by Justin.
  
          <rdar://problem/4065343> Mail: Deleting a line sometimes makes the insertion point jump to the top of the message
  
          Test cases added: delete-br-011.html
  
          * khtml/editing/delete_selection_command.cpp:
          (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete):
          Make sure m_endingSelection is usable.
  
          (khtml::DeleteSelectionCommand::doApply):
          Skip general delete related code when just doing handleSpecialCaseBRDelete().
  
          * layout-tests/editing/deleting/delete-br-011-expected.txt: Added.
          * layout-tests/editing/deleting/delete-br-011.html: Added.
          Mimics composing a Mail.app reply, clicking past the end of the content, and hitting delete key.
  
  Revision  Changes    Path
  1.4434    +19 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4433
  retrieving revision 1.4434
  diff -u -r1.4433 -r1.4434
  --- ChangeLog	16 Jul 2005 06:45:15 -0000	1.4433
  +++ ChangeLog	18 Jul 2005 18:14:56 -0000	1.4434
  @@ -1,3 +1,22 @@
  +2005-07-18  David Harrison  <harrison at apple.com>
  +
  +        Reviewed by Justin.
  +
  +        <rdar://problem/4065343> Mail: Deleting a line sometimes makes the insertion point jump to the top of the message
  +        
  +        Test cases added: delete-br-011.html
  +
  +        * khtml/editing/delete_selection_command.cpp:
  +        (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete):
  +        Make sure m_endingSelection is usable.
  +        
  +        (khtml::DeleteSelectionCommand::doApply):
  +        Skip general delete related code when just doing handleSpecialCaseBRDelete().
  +        
  +        * layout-tests/editing/deleting/delete-br-011-expected.txt: Added.
  +        * layout-tests/editing/deleting/delete-br-011.html: Added.
  +        Mimics composing a Mail.app reply, clicking past the end of the content, and hitting delete key.
  +
   2005-07-15  Adele Peterson  <adele at apple.com>
   
           Written by Anders Carlsson  <andersca at mac.com>
  
  
  
  1.6       +16 -5     WebCore/khtml/editing/delete_selection_command.cpp
  
  Index: delete_selection_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/delete_selection_command.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- delete_selection_command.cpp	9 Jul 2005 20:19:07 -0000	1.5
  +++ delete_selection_command.cpp	18 Jul 2005 18:15:00 -0000	1.6
  @@ -286,8 +286,9 @@
       bool downstreamStartIsBR = m_downstreamStart.node()->hasTagName(HTMLNames::br());
       bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && m_downstreamStart.node() == m_upstreamEnd.node();
       if (isBROnLineByItself) {
  +        m_endingPosition = Position(m_downstreamStart.node()->parentNode(), m_downstreamStart.node()->nodeIndex());
           removeNode(m_downstreamStart.node());
  -        m_endingPosition = m_upstreamStart;
  +        m_endingPosition = m_endingPosition.equivalentDeepPosition();
           m_mergeBlocksAfterDelete = false;
           return true;
       }
  @@ -702,7 +703,6 @@
       
       // set up our state
       initializePositionData();
  -
       if (!m_startBlock || !m_endBlock) {
           // Can't figure out what blocks we're in. This can happen if
           // the document structure is not what we are expecting, like if
  @@ -713,6 +713,17 @@
           return;
       }
       
  +    // deleting just a BR is handled specially, at least because we do not
  +    // want to replace it with a placeholder BR!
  +    if (handleSpecialCaseBRDelete()) {
  +        calculateTypingStyleAfterDelete(false);
  +        debugPosition("endingPosition   ", m_endingPosition);
  +        setEndingSelection(Selection(m_endingPosition, affinity));
  +        clearTransientState();
  +        rebalanceWhitespace();
  +        return;
  +    }
  +
       // if all we are deleting is complete paragraph(s), we need to make
       // sure a blank paragraph remains when we are done
       bool forceBlankParagraph = isStartOfParagraph(VisiblePosition(m_upstreamStart, VP_DEFAULT_AFFINITY)) &&
  @@ -722,10 +733,9 @@
       deleteInsignificantTextDownstream(m_trailingWhitespace);    
   
       saveTypingStyleState();
  -    insertPlaceholderForAncestorBlockContent();
       
  -    if (!handleSpecialCaseBRDelete())
  -        handleGeneralDelete();
  +    insertPlaceholderForAncestorBlockContent();
  +    handleGeneralDelete();
       
       // Do block merge if start and end of selection are in different blocks.
       moveNodesAfterNode();
  @@ -745,6 +755,7 @@
           addBlockPlaceholderIfNeeded(m_endingPosition.node());
   
       calculateTypingStyleAfterDelete(addedPlaceholder);
  +
       debugPosition("endingPosition   ", m_endingPosition);
       setEndingSelection(Selection(m_endingPosition, affinity));
       clearTransientState();
  
  
  
  1.1                  WebCore/layout-tests/editing/deleting/delete-br-011-expected.txt
  
  Index: delete-br-011-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (8,8) size 784x584
        RenderBlock (anonymous) at (0,0) size 784x18
          RenderText {TEXT} at (0,0) size 31x18
            text run at (0,0) width 31: "hello"
        RenderBlock {DIV} at (0,18) size 784x56 [border: (2px solid #FF0000)]
          RenderBR {BR} at (14,14) size 0x28
        RenderBlock (anonymous) at (0,74) size 784x0
  caret: position 1 of child 0 {BR} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.1                  WebCore/layout-tests/editing/deleting/delete-br-011.html
  
  Index: delete-br-011.html
  ===================================================================
  <html> 
  <head>
  
  <style>
  .editing { 
      border: 2px solid red; 
      padding: 12px; 
      font-size: 24px; 
  }
  </style>
  <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
  
  <script>
  
  function editingTest() {
      for (i = 0; i < 5; i++)
          moveSelectionForwardByLineCommand();
      deleteCommand();
  }
  
  </script>
  
  <title>Editing Test</title> 
  </head> 
  <body onload="runEditingTest();" contenteditable id="root">hello<div class="editing" id="test"><br></div><br></body></html>
  
  
  



More information about the webkit-changes mailing list