[webkit-changes] cvs commit: WebCore/layout-tests/editing/pasteboard 3976872-expected.txt 3976872.html

Justin justing at opensource.apple.com
Tue Sep 6 16:53:10 PDT 2005


justing     05/09/06 16:53:10

  Modified:    .        ChangeLog
               khtml/editing replace_selection_command.cpp
  Added:       layout-tests/editing/pasteboard 3976872-expected.txt
                        3976872.html
  Log:
          Reviewed by harrison
  
          Fixes <rdar://problem/3976872> REGRESSION (Mail): Pasted lines of plain text don't get the proper style if pasted into newlines
  
          For style matched paste, style information was gathered incorrectly.
  
          Test cases added:
          * layout-tests/editing/pasteboard/3976872-expected.txt: Added.
          * layout-tests/editing/pasteboard/3976872.html: Added.
  
          * khtml/editing/replace_selection_command.cpp:
          (khtml::ReplaceSelectionCommand::doApply):
          Even though the startBlock (selection.start().node()->enclosingBlockFlowElement) is where manipulation
          begins on a paste, it can be missing necessary style information.
  
  Revision  Changes    Path
  1.98      +18 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- ChangeLog	6 Sep 2005 10:17:57 -0000	1.97
  +++ ChangeLog	6 Sep 2005 23:53:09 -0000	1.98
  @@ -1,3 +1,21 @@
  +2005-09-06  Justin Garcia  <justin.garcia at apple.com>
  +
  +        Reviewed by harrison
  +        
  +        Fixes <rdar://problem/3976872> REGRESSION (Mail): Pasted lines of plain text don't get the proper style if pasted into newlines
  +
  +        For style matched paste, style information was gathered incorrectly.
  +        
  +        Test cases added:
  +        * layout-tests/editing/pasteboard/3976872-expected.txt: Added.
  +        * layout-tests/editing/pasteboard/3976872.html: Added.
  +        
  +        * khtml/editing/replace_selection_command.cpp:
  +        (khtml::ReplaceSelectionCommand::doApply):
  +        Even though the startBlock (selection.start().node()->enclosingBlockFlowElement) is where manipulation 
  +        begins on a paste, it can be missing necessary style information.
  +
  +
   2005-09-06  Eric Seidel  <eseidel at apple.com>
           Fix by Tobias Lidskog <tobiaslidskog at mac.com>
   
  
  
  
  1.13      +6 -5      WebCore/khtml/editing/replace_selection_command.cpp
  
  Index: replace_selection_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/replace_selection_command.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- replace_selection_command.cpp	29 Aug 2005 23:39:17 -0000	1.12
  +++ replace_selection_command.cpp	6 Sep 2005 23:53:09 -0000	1.13
  @@ -631,7 +631,12 @@
       // collect information about the current selection, prior to deleting the selection
       Selection selection = endingSelection();
       ASSERT(selection.isCaretOrRange());
  -
  +    
  +    if (m_matchStyle) {
  +        m_insertionStyle = styleAtPosition(selection.start());
  +        m_insertionStyle->ref();
  +    }
  +    
       VisiblePosition visibleStart(selection.start(), selection.startAffinity());
       VisiblePosition visibleEnd(selection.end(), selection.endAffinity());
       bool startAtStartOfBlock = isStartOfBlock(visibleStart);
  @@ -716,10 +721,6 @@
       startPos = positionOutsideContainingSpecialElement(startPos);
   
       KHTMLPart *part = document()->part();
  -    if (m_matchStyle) {
  -        m_insertionStyle = styleAtPosition(startPos);
  -        m_insertionStyle->ref();
  -    }
       
       // FIXME: Improve typing style.
       // See this bug: <rdar://problem/3769899> Implementation of typing style needs improvement
  
  
  
  1.1                  WebCore/layout-tests/editing/pasteboard/3976872-expected.txt
  
  Index: 3976872-expected.txt
  ===================================================================
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > B > DIV > DIV > BODY > HTML > #document to 28 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldInsertText:this text should end up bold replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 28 of #text > B > DIV > DIV > BODY > HTML > #document to 28 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  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 {P} at (0,0) size 784x18
          RenderText {TEXT} at (0,0) size 381x18
            text run at (0,0) width 381: "This tests paste and match style on an empty (but styled) line"
        RenderBlock {P} at (0,34) size 784x36
          RenderText {TEXT} at (0,0) size 751x36
            text run at (0,0) width 751: "The first line is copied (unstyled), then it's bolded, then a paragraph separator is inserted and the original unstyled line is"
            text run at (0,18) width 181: "pasted (with style matching)."
        RenderBlock {HR} at (0,86) size 784x2 [border: (1px inset #000000)]
        RenderBlock {DIV} at (0,96) size 784x40
          RenderBlock {DIV} at (0,0) size 784x20 [border: (1px solid #FF0000)]
            RenderInline {B} at (0,0) size 187x18
              RenderText {TEXT} at (1,1) size 187x18
                text run at (1,1) width 187: "this text should end up bold"
            RenderInline {B} at (0,0) size 0x18
          RenderBlock {DIV} at (0,20) size 784x20 [border: (1px solid #FF0000)]
            RenderInline {B} at (0,0) size 187x18
              RenderText {TEXT} at (1,1) size 187x18
                text run at (1,1) width 187: "this text should end up bold"
  caret: position 28 of child 0 {TEXT} of child 0 {B} of child 1 {DIV} of child 7 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.1                  WebCore/layout-tests/editing/pasteboard/3976872.html
  
  Index: 3976872.html
  ===================================================================
  <html> 
  <head>
  
  <style>
  .editing { 
      border: 1px solid red; 
  }
  </style>
  <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
  
  <script>
  
  function editingTest() {
      extendSelectionForwardByLineCommand();
      copyCommand();
      boldCommand();
      moveSelectionBackwardByCharacterCommand();
      insertParagraphCommand();
      moveSelectionBackwardByCharacterCommand();
      pasteAndMatchStyleCommand();
  }
  
  </script>
  
  <title>Paste and match style on an empty (but styled) line</title> 
  </head> 
  <body>
  
  <p>This tests paste and match style on an empty (but styled) line</p>
  <p>The first line is copied (unstyled), then it's bolded, then a paragraph separator is inserted and the original unstyled line is pasted (with style matching).</p>
  
  <hr>
  
  <div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
  <div id="test" class="editing">this text should end up bold</div>
  </div>
  
  <script>
  runEditingTest();
  </script>
  
  </body>
  </html>
  
  
  



More information about the webkit-changes mailing list