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

Darin darin at opensource.apple.com
Sun Dec 18 14:13:22 PST 2005


darin       05/12/18 14:13:21

  Modified:    .        ChangeLog
               kwq      KWQKHTMLPart.mm
  Log:
          Reviewed by Eric, landed by Darin.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5631
            KWQKHTMLPart::attributedString ignores many tags
  
          * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::attributedString):
          Fix incorrectly nested else.
  
  Revision  Changes    Path
  1.559     +10 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.558
  retrieving revision 1.559
  diff -u -r1.558 -r1.559
  --- ChangeLog	18 Dec 2005 05:01:31 -0000	1.558
  +++ ChangeLog	18 Dec 2005 22:13:16 -0000	1.559
  @@ -1,3 +1,13 @@
  +2005-12-18  Alexey Proskuryakov  <ap at nypop.com>
  +
  +        Reviewed by Eric, landed by Darin.
  +
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5631
  +          KWQKHTMLPart::attributedString ignores many tags
  +
  +        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::attributedString):
  +        Fix incorrectly nested else.
  +
   2005-12-17  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
           Reviewed and landed by Darin.
  
  
  
  1.705     +48 -49    WebCore/kwq/KWQKHTMLPart.mm
  
  Index: KWQKHTMLPart.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
  retrieving revision 1.704
  retrieving revision 1.705
  diff -u -r1.704 -r1.705
  --- KWQKHTMLPart.mm	16 Dec 2005 02:30:14 -0000	1.704
  +++ KWQKHTMLPart.mm	18 Dec 2005 22:13:20 -0000	1.705
  @@ -3115,60 +3115,59 @@
                           [result appendAttributedString: partialString];                
                           [partialString release];
                       }
  -                    else if (n->hasTagName(olTag) || n->hasTagName(ulTag)) {
  -                        if (!hasNewLine)
  -                            text += "\n";
  -                        hasNewLine = true;
  -                    } else if (n->hasTagName(tdTag) ||
  -                               n->hasTagName(thTag) ||
  -                               n->hasTagName(hrTag) ||
  -                               n->hasTagName(ddTag) ||
  -                               n->hasTagName(dlTag) ||
  -                               n->hasTagName(dtTag) ||
  -                               n->hasTagName(preTag) ||
  -                               n->hasTagName(blockquoteTag) ||
  -                               n->hasTagName(divTag)) {
  -                        if (!hasNewLine)
  -                            text += '\n';
  -                        hasNewLine = true;
  -                    } else if (n->hasTagName(pTag) ||
  -                               n->hasTagName(trTag) ||
  -                               n->hasTagName(h1Tag) ||
  -                               n->hasTagName(h2Tag) ||
  -                               n->hasTagName(h3Tag) ||
  -                               n->hasTagName(h4Tag) ||
  -                               n->hasTagName(h5Tag) ||
  -                               n->hasTagName(h6Tag)) {
  -                        if (!hasNewLine)
  +                } else if (n->hasTagName(olTag) || n->hasTagName(ulTag)) {
  +                    if (!hasNewLine)
  +                        text += "\n";
  +                    hasNewLine = true;
  +                } else if (n->hasTagName(tdTag) ||
  +                           n->hasTagName(thTag) ||
  +                           n->hasTagName(hrTag) ||
  +                           n->hasTagName(ddTag) ||
  +                           n->hasTagName(dlTag) ||
  +                           n->hasTagName(dtTag) ||
  +                           n->hasTagName(preTag) ||
  +                           n->hasTagName(blockquoteTag) ||
  +                           n->hasTagName(divTag)) {
  +                    if (!hasNewLine)
  +                        text += '\n';
  +                    hasNewLine = true;
  +                } else if (n->hasTagName(pTag) ||
  +                           n->hasTagName(trTag) ||
  +                           n->hasTagName(h1Tag) ||
  +                           n->hasTagName(h2Tag) ||
  +                           n->hasTagName(h3Tag) ||
  +                           n->hasTagName(h4Tag) ||
  +                           n->hasTagName(h5Tag) ||
  +                           n->hasTagName(h6Tag)) {
  +                    if (!hasNewLine)
  +                        text += '\n';
  +                    
  +                    // 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';
  -                        
  -                        // 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;
  -                            }
  +                            hasParagraphBreak = true;
                           }
  -                        
  -                        hasNewLine = true;
                       }
  -                    else if (n->hasTagName(imgTag)) {
  -                        if (pendingStyledSpace != nil) {
  -                            if (linkStartLocation == [result length]) {
  -                                ++linkStartLocation;
  -                            }
  -                            [result appendAttributedString:pendingStyledSpace];
  -                            [pendingStyledSpace release];
  -                            pendingStyledSpace = nil;
  +                    
  +                    hasNewLine = true;
  +                }
  +                else if (n->hasTagName(imgTag)) {
  +                    if (pendingStyledSpace != nil) {
  +                        if (linkStartLocation == [result length]) {
  +                            ++linkStartLocation;
                           }
  -                        NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<ElementImpl *>(n));
  -                        NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
  -                        NSAttributedString *iString = [NSAttributedString attributedStringWithAttachment:attachment];
  -                        [result appendAttributedString: iString];
  -                        [attachment release];
  +                        [result appendAttributedString:pendingStyledSpace];
  +                        [pendingStyledSpace release];
  +                        pendingStyledSpace = nil;
                       }
  +                    NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<ElementImpl *>(n));
  +                    NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
  +                    NSAttributedString *iString = [NSAttributedString attributedStringWithAttachment:attachment];
  +                    [result appendAttributedString: iString];
  +                    [attachment release];
                   }
   
                   NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
  
  
  



More information about the webkit-changes mailing list