[webkit-changes] cvs commit: WebCore/khtml/editing htmlediting.cpp markup.cpp

Adele adele at opensource.apple.com
Sat Aug 27 10:10:28 PDT 2005


adele       05/08/27 10:10:28

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               khtml/editing Tag: Safari-2-0-branch htmlediting.cpp
                        markup.cpp
  Log:
          Merged fix from TOT to Safari-2-0-branch.
  
          * khtml/editing/htmlediting.cpp:  ReplaceSelectionCommand changes are made here.
  
      2005-08-26  John Sullivan  <sullivan at apple.com>
  
          Reviewed by Darin Adler.
  
          Test cases added: none, doesn't affect layout
  
          - fixed these leaks:
          <rdar://problem/4232514> many leaks of StyleBaseImpl called within computeAndStoreNodeDesiredStyle within -[WebView paste:],
          seen running webkit tests (probably affects Mail)
          <rdar://problem/4232572> many leaks of StyleBaseImpl called within fixupNodeStyles within -[WebView paste:],
          seen running webkit tests (probably affects Mail)
          <rdar://problem/4232629> many leaks of StyleBaseImpl within startMarkup within -[WebHTMLView _writeSelectionToPasteboard:],
          seen running webkit tests
          <rdar://problem/4232779> many leaks of StyleBaseImpl within createMarkup within -[WebHTMLView _writeSelectionToPasteboard:],
          seen running webkit tests
  
          * khtml/editing/markup.cpp:
          (khtml::startMarkup):
          Put Position::computedStyle() result into a local variable so it can be reffed/dereffed, avoids a leak.
          Done in two places in this method. This fixes 4232629.
          (khtml::createMarkup):
          ditto, but only in one place. This fixes 4232779.
  
          * khtml/editing/replace_selection_command.cpp:
          (khtml::ReplaceSelectionCommand::fixupNodeStyles):
          ditto. This fixes 4232572.
          (khtml::computeAndStoreNodeDesiredStyle):
          ditto, but in two places. This fixes 4232514.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +36 -1     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- ChangeLog	26 Aug 2005 21:37:49 -0000	1.1.2.10
  +++ ChangeLog	27 Aug 2005 17:10:26 -0000	1.1.2.11
  @@ -1,3 +1,38 @@
  +2005-08-27  Adele Peterson  <adele at apple.com>
  +
  +        Merged fix from TOT to Safari-2-0-branch.
  +
  +        * khtml/editing/htmlediting.cpp:  ReplaceSelectionCommand changes are made here. 
  +
  +    2005-08-26  John Sullivan  <sullivan at apple.com>
  +
  +        Reviewed by Darin Adler.
  +
  +        Test cases added: none, doesn't affect layout
  +        
  +        - fixed these leaks:
  +        <rdar://problem/4232514> many leaks of StyleBaseImpl called within computeAndStoreNodeDesiredStyle within -[WebView paste:], 
  +        seen running webkit tests (probably affects Mail)
  +        <rdar://problem/4232572> many leaks of StyleBaseImpl called within fixupNodeStyles within -[WebView paste:], 
  +        seen running webkit tests (probably affects Mail)
  +        <rdar://problem/4232629> many leaks of StyleBaseImpl within startMarkup within -[WebHTMLView _writeSelectionToPasteboard:], 
  +        seen running webkit tests
  +        <rdar://problem/4232779> many leaks of StyleBaseImpl within createMarkup within -[WebHTMLView _writeSelectionToPasteboard:], 
  +        seen running webkit tests        
  +
  +        * khtml/editing/markup.cpp:
  +        (khtml::startMarkup):
  +        Put Position::computedStyle() result into a local variable so it can be reffed/dereffed, avoids a leak.
  +        Done in two places in this method. This fixes 4232629.
  +        (khtml::createMarkup):
  +        ditto, but only in one place. This fixes 4232779.
  +        
  +        * khtml/editing/replace_selection_command.cpp:
  +        (khtml::ReplaceSelectionCommand::fixupNodeStyles):
  +        ditto. This fixes 4232572.
  +        (khtml::computeAndStoreNodeDesiredStyle):
  +        ditto, but in two places. This fixes 4232514.
  +
   2005-08-26  David Hyatt  <hyatt at apple.com>
   
   	Fix for 4226539, blank content on leaky-cauldron.org.  Revert
  @@ -157,4 +192,4 @@
           (KJS::XMLHttpRequest::changeState):
           use notNull() instead of testing SharedPtrs against 0
   
  -== Rolled over to ChangeLog-2004-08-23 ==
  +== Rolled over to ChangeLog-2005-08-23 ==
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.228.8.10 +13 -5     WebCore/khtml/editing/htmlediting.cpp
  
  Index: htmlediting.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/htmlediting.cpp,v
  retrieving revision 1.228.8.9
  retrieving revision 1.228.8.10
  diff -u -r1.228.8.9 -r1.228.8.10
  --- htmlediting.cpp	9 Aug 2005 18:46:35 -0000	1.228.8.9
  +++ htmlediting.cpp	27 Aug 2005 17:10:26 -0000	1.228.8.10
  @@ -5399,8 +5399,10 @@
               NodeImpl *blockquote = nearestMailBlockquote(node);
               Position pos(blockquote ? blockquote : node->getDocument()->documentElement(), 0);
               CSSComputedStyleDeclarationImpl *style = pos.computedStyle();
  +            style->ref();
               DOMString desiredColor = desiredStyle->getPropertyValue(CSS_PROP_COLOR);
               DOMString nearestColor = style->getPropertyValue(CSS_PROP_COLOR);
  +            style->deref();
               if (desiredColor != nearestColor)
                   desiredStyle->setProperty(CSS_PROP_COLOR, nearestColor);
           }
  @@ -5448,15 +5450,21 @@
       // being pasted in.
       if (NodeImpl *blockquote = nearestMailBlockquote(node)) {
           CSSComputedStyleDeclarationImpl *blockquoteStyle = Position(blockquote, 0).computedStyle();
  -        if (blockquoteStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR)) {
  -            style->setProperty(CSS_PROP__KHTML_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR, matchNearestBlockquoteColorString());
  -            return;
  -        }
  +            blockquoteStyle->ref();
  +            bool match = (blockquoteStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR));
  +            blockquoteStyle->deref();
  +            if (match) {
  +                style->setProperty(CSS_PROP__KHTML_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR, matchNearestBlockquoteColorString());
  +                return;
  +            }
       }
       NodeImpl *documentElement = node->getDocument() ? node->getDocument()->documentElement() : 0;
       if (documentElement) {
           CSSComputedStyleDeclarationImpl *documentStyle = Position(documentElement, 0).computedStyle();
  -        if (documentStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR)) {
  +        documentStyle->ref();
  +        bool match = (documentStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR));
  +        documentStyle->deref();
  +        if (match) {
               style->setProperty(CSS_PROP__KHTML_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR, matchNearestBlockquoteColorString());
           }
       }
  
  
  
  1.17.8.3  +13 -2     WebCore/khtml/editing/markup.cpp
  
  Index: markup.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/markup.cpp,v
  retrieving revision 1.17.8.2
  retrieving revision 1.17.8.3
  diff -u -r1.17.8.2 -r1.17.8.3
  --- markup.cpp	24 Aug 2005 00:49:05 -0000	1.17.8.2
  +++ markup.cpp	27 Aug 2005 17:10:27 -0000	1.17.8.3
  @@ -190,6 +190,10 @@
                   NodeImpl *element = node->parentNode();
                   if (element) {
                       CSSMutableStyleDeclarationImpl *style = Position(element, 0).computedStyle()->copyInheritableProperties();
  +                    CSSComputedStyleDeclarationImpl *computedStyle = Position(element, 0).computedStyle();
  +                    computedStyle->ref();
  +                    CSSMutableStyleDeclarationImpl *style = computedStyle->copyInheritableProperties();
  +                    computedStyle->deref();
                       style->ref();
                       defaultStyle->diff(style);
                       if (style->length() > 0) {
  @@ -212,7 +216,10 @@
                   const ElementImpl *el = static_cast<const ElementImpl *>(node);
                   DOMString additionalStyle;
                   if (defaultStyle && el->isHTMLElement()) {
  -                    CSSMutableStyleDeclarationImpl *style = Position(const_cast<ElementImpl *>(el), 0).computedStyle()->copyInheritableProperties();
  +                    CSSComputedStyleDeclarationImpl *computedStyle = Position(const_cast<ElementImpl *>(el), 0).computedStyle();
  +                    computedStyle->ref();
  +                    CSSMutableStyleDeclarationImpl *style = computedStyle->copyInheritableProperties();
  +                    computedStyle->deref();
                       style->ref();
                       defaultStyle->diff(style);
                       if (style->length() > 0) {
  @@ -327,7 +334,11 @@
   
       // calculate the "default style" for this markup
       Position pos(doc->documentElement(), 0);
  -    CSSMutableStyleDeclarationImpl *defaultStyle = pos.computedStyle()->copyInheritableProperties();
  +    CSSComputedStyleDeclarationImpl *computedStyle = pos.computedStyle();
  +    computedStyle->ref();
  +    CSSMutableStyleDeclarationImpl *defaultStyle = computedStyle->copyInheritableProperties();
  +    computedStyle->deref();
  +
       defaultStyle->ref();
       
       NodeImpl *startNode = range->startNode();
  
  
  



More information about the webkit-changes mailing list