Written by Darin, reviewed and tested by me
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Feb 2005 01:54:18 +0000 (01:54 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Feb 2005 01:54:18 +0000 (01:54 +0000)
        - fixed <rdar://problem/3969684> Panther-only: extra blank lines between
        pasted content from Blot

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::attributedString):
        don't emit paragraph breaks if the margins are tiny; matches what
        we do for plain-text conversion

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

WebCore/ChangeLog-2005-08-23
WebCore/kwq/KWQKHTMLPart.mm

index bbeace192761771896884186f1957b10097bc81f..0ce0ffd62d446509def3a4ee57436f5273d6ec00 100644 (file)
@@ -1,3 +1,15 @@
+2005-02-01  John Sullivan  <sullivan@apple.com>
+
+        Written by Darin, reviewed and tested by me
+        
+        - fixed <rdar://problem/3969684> Panther-only: extra blank lines between 
+        pasted content from Blot
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::attributedString):
+        don't emit paragraph breaks if the margins are tiny; matches what
+        we do for plain-text conversion
+
 === Safari-182 ===
 
 2005-02-01  Ken Kocienda  <kocienda@apple.com>
index c7138a62dbcba09ae038ab488ea126de5c0f530b..160cfce902ddcc457d88afcde5202cb29582cd98 100644 (file)
@@ -1232,7 +1232,7 @@ NSView *KWQKHTMLPart::nextKeyViewInFrameHierarchy(NodeImpl *node, KWQSelectionDi
     if (!next) {
         KWQKHTMLPart *parent = KWQ(parentPart());
         if (parent) {
-            next = parent->nextKeyView(parent->childFrame(this)->m_frame->element(), direction);
+            next = parent->nextKeyViewInFrameHierarchy(parent->childFrame(this)->m_frame->element(), direction);
         }
     }
     
@@ -2915,7 +2915,7 @@ NSAttributedString *KWQKHTMLPart::attributedString(NodeImpl *_start, int startOf
                 int start = (n == _startNode) ? startOffset : -1;
                 int end = (n == endNode) ? endOffset : -1;
                 if (renderer->isText()) {
-                    if (renderer->style()->whiteSpace() == PRE) {
+                    if (style->whiteSpace() == PRE) {
                         if (needSpace && !addedSpace) {
                             if (text.isEmpty() && linkStartLocation == [result length]) {
                                 ++linkStartLocation;
@@ -3037,7 +3037,7 @@ NSAttributedString *KWQKHTMLPart::attributedString(NodeImpl *_start, int startOf
                                 RenderListItem *listRenderer = static_cast<RenderListItem*>(renderer);
 
                                 maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
-                                switch(listRenderer->style()->listStyleType()) {
+                                switch(style->listStyleType()) {
                                     case khtml::DISC:
                                         listText += ((QChar)BULLET_CHAR);
                                         break;
@@ -3104,15 +3104,23 @@ NSAttributedString *KWQKHTMLPart::attributedString(NodeImpl *_start, int startOf
                     case ID_H3:
                     case ID_H4:
                     case ID_H5:
-                    case ID_H6:
+                    case ID_H6: {
                         if (!hasNewLine)
                             text += '\n';
-                        if (!hasParagraphBreak) {
-                            text += '\n';
-                            hasParagraphBreak = true;
+                        
+                        // In certain cases, emit a paragraph break.
+                        int bottomMargin = renderer->collapsedMarginBottom();
+                        int fontSize = style->htmlFont().getFontDef().computedPixelSize();
+                        if (bottomMargin * 2 >= fontSize) {
+                            if (!hasParagraphBreak) {
+                                text += '\n';
+                                hasParagraphBreak = true;
+                            }
                         }
+                        
                         hasNewLine = true;
                         break;
+                    }
                         
                     case ID_IMG:
                         if (pendingStyledSpace != nil) {