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

John sullivan at opensource.apple.com
Mon Aug 29 10:42:45 PDT 2005


sullivan    05/08/29 10:42:44

  Modified:    .        ChangeLog
               khtml/ecma kjs_dom.cpp
               khtml/html html_tableimpl.cpp
               khtml/xml dom_nodeimpl.cpp dom_nodeimpl.h
               kwq      DOM.mm
  Log:
          Reviewed by Beth Dakin.
  
          Test cases added: none, doesn't affect layout
  
          - fixed <rdar://problem/4232588> many leaks beneath ApplyStyleCommand::mergeEndWithNextIfIdentical,
          seen running webkit tests (probably affects Mail)
  
          Fixed by making NodeImpl::childNodes() return a SharedPtr.
  
          * khtml/ecma/kjs_dom.cpp:
          (KJS::DOMNode::getValueProperty):
          use get() to get the pointer from the SharedPtr
  
          * khtml/html/html_tableimpl.cpp:
          (DOM::HTMLTableSectionElementImpl::insertRow):
          expect a SharedPtr for childNodes(); no need to delete at end of block. (This code was already
          managing memory correctly, but other callers of childNodes() where not.)
          (DOM::HTMLTableSectionElementImpl::deleteRow):
          ditto
          (DOM::HTMLTableRowElementImpl::insertCell):
          ditto
          (DOM::HTMLTableRowElementImpl::deleteCell):
          ditto
  
          * khtml/xml/dom_nodeimpl.h:
          * khtml/xml/dom_nodeimpl.cpp:
          (DOM::NodeImpl::childNodes):
          return SharedPtr
  
          * kwq/DOM.mm:
          (-[DOMNode childNodes]):
          use get() to get the pointer from the SharedPtr
  
  Revision  Changes    Path
  1.33      +35 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ChangeLog	29 Aug 2005 05:54:25 -0000	1.32
  +++ ChangeLog	29 Aug 2005 17:42:42 -0000	1.33
  @@ -1,3 +1,38 @@
  +2005-08-29  John Sullivan  <sullivan at apple.com>
  +
  +        Reviewed by Beth Dakin.
  +
  +        Test cases added: none, doesn't affect layout
  +        
  +        - fixed <rdar://problem/4232588> many leaks beneath ApplyStyleCommand::mergeEndWithNextIfIdentical, 
  +        seen running webkit tests (probably affects Mail)
  +        
  +        Fixed by making NodeImpl::childNodes() return a SharedPtr.
  +
  +        * khtml/ecma/kjs_dom.cpp:
  +        (KJS::DOMNode::getValueProperty):
  +        use get() to get the pointer from the SharedPtr
  +        
  +        * khtml/html/html_tableimpl.cpp:
  +        (DOM::HTMLTableSectionElementImpl::insertRow):
  +        expect a SharedPtr for childNodes(); no need to delete at end of block. (This code was already 
  +        managing memory correctly, but other callers of childNodes() where not.)
  +        (DOM::HTMLTableSectionElementImpl::deleteRow):
  +        ditto
  +        (DOM::HTMLTableRowElementImpl::insertCell):
  +        ditto
  +        (DOM::HTMLTableRowElementImpl::deleteCell):
  +        ditto
  +        
  +        * khtml/xml/dom_nodeimpl.h:
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (DOM::NodeImpl::childNodes):
  +        return SharedPtr
  +        
  +        * kwq/DOM.mm:
  +        (-[DOMNode childNodes]):
  +        use get() to get the pointer from the SharedPtr
  +
   2005-08-28  Maciej Stachowiak  <mjs at apple.com>
   
   	- added pixel test results for the layout tests, so others can check if their resutls match
  
  
  
  1.92      +1 -1      WebCore/khtml/ecma/kjs_dom.cpp
  
  Index: kjs_dom.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.cpp,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- kjs_dom.cpp	25 Aug 2005 23:13:41 -0000	1.91
  +++ kjs_dom.cpp	29 Aug 2005 17:42:42 -0000	1.92
  @@ -290,7 +290,7 @@
     case ParentElement: // IE only apparently
       return getDOMNode(exec,node.parentNode());
     case ChildNodes:
  -    return getDOMNodeList(exec,node.childNodes());
  +    return getDOMNodeList(exec,node.childNodes().get());
     case FirstChild:
       return getDOMNode(exec,node.firstChild());
     case LastChild:
  
  
  
  1.61      +8 -12     WebCore/khtml/html/html_tableimpl.cpp
  
  Index: html_tableimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.cpp,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- html_tableimpl.cpp	25 Aug 2005 23:13:49 -0000	1.60
  +++ html_tableimpl.cpp	29 Aug 2005 17:42:43 -0000	1.61
  @@ -806,8 +806,8 @@
   HTMLElementImpl *HTMLTableSectionElementImpl::insertRow( long index, int& exceptioncode )
   {
       HTMLTableRowElementImpl *r = 0L;
  -    NodeListImpl *children = childNodes();
  -    int numRows = children ? (int)children->length() : 0;
  +    SharedPtr<NodeListImpl> children = childNodes();
  +    int numRows = children.notNull() ? (int)children->length() : 0;
       //kdDebug(6030) << k_funcinfo << "index=" << index << " numRows=" << numRows << endl;
       if ( index < -1 || index > numRows ) {
           exceptioncode = DOMException::INDEX_SIZE_ERR; // per the DOM
  @@ -826,20 +826,18 @@
               insertBefore(r, n, exceptioncode );
           }
       }
  -    delete children;
       return r;
   }
   
   void HTMLTableSectionElementImpl::deleteRow( long index, int &exceptioncode )
   {
  -    NodeListImpl *children = childNodes();
  -    int numRows = children ? (int)children->length() : 0;
  +    SharedPtr<NodeListImpl> children = childNodes();
  +    int numRows = children.notNull() ? (int)children->length() : 0;
       if ( index == -1 ) index = numRows - 1;
       if( index >= 0 && index < numRows )
           HTMLElementImpl::removeChild(children->item(index), exceptioncode);
       else
           exceptioncode = DOMException::INDEX_SIZE_ERR;
  -    delete children;
   }
   
   int HTMLTableSectionElementImpl::numRows() const
  @@ -978,8 +976,8 @@
   HTMLElementImpl *HTMLTableRowElementImpl::insertCell( long index, int &exceptioncode )
   {
       HTMLTableCellElementImpl *c = 0L;
  -    NodeListImpl *children = childNodes();
  -    int numCells = children ? children->length() : 0;
  +    SharedPtr<NodeListImpl> children = childNodes();
  +    int numCells = children.notNull() ? children->length() : 0;
       if ( index < -1 || index > numCells )
           exceptioncode = DOMException::INDEX_SIZE_ERR; // per the DOM
       else
  @@ -996,20 +994,18 @@
               insertBefore(c, n, exceptioncode);
           }
       }
  -    delete children;
       return c;
   }
   
   void HTMLTableRowElementImpl::deleteCell( long index, int &exceptioncode )
   {
  -    NodeListImpl *children = childNodes();
  -    int numCells = children ? children->length() : 0;
  +    SharedPtr<NodeListImpl> children = childNodes();
  +    int numCells = children.notNull() ? children->length() : 0;
       if ( index == -1 ) index = numCells-1;
       if( index >= 0 && index < numCells )
           HTMLElementImpl::removeChild(children->item(index), exceptioncode);
       else
           exceptioncode = DOMException::INDEX_SIZE_ERR;
  -    delete children;
   }
   
   SharedPtr<HTMLCollectionImpl> HTMLTableRowElementImpl::cells()
  
  
  
  1.179     +2 -2      WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.178
  retrieving revision 1.179
  diff -u -r1.178 -r1.179
  --- dom_nodeimpl.cpp	28 Aug 2005 00:58:41 -0000	1.178
  +++ dom_nodeimpl.cpp	29 Aug 2005 17:42:43 -0000	1.179
  @@ -164,9 +164,9 @@
       // be default nodeValue is null, so setting it has no effect
   }
   
  -NodeListImpl *NodeImpl::childNodes()
  +SharedPtr<NodeListImpl> NodeImpl::childNodes()
   {
  -  return new ChildNodeListImpl(this);
  +    return SharedPtr<NodeListImpl>(new ChildNodeListImpl(this));
   }
   
   NodeImpl *NodeImpl::firstChild() const
  
  
  
  1.98      +1 -1      WebCore/khtml/xml/dom_nodeimpl.h
  
  Index: dom_nodeimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- dom_nodeimpl.h	8 Aug 2005 21:12:01 -0000	1.97
  +++ dom_nodeimpl.h	29 Aug 2005 17:42:43 -0000	1.98
  @@ -95,7 +95,7 @@
       NodeImpl *parentNode() const { return m_parent; }
       NodeImpl *previousSibling() const { return m_previous; }
       NodeImpl *nextSibling() const { return m_next; }
  -    virtual NodeListImpl *childNodes();
  +    virtual SharedPtr<NodeListImpl> childNodes();
       virtual NodeImpl *firstChild() const;
       virtual NodeImpl *lastChild() const;
       virtual bool hasAttributes() const;
  
  
  
  1.44      +1 -1      WebCore/kwq/DOM.mm
  
  Index: DOM.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/DOM.mm,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- DOM.mm	25 Aug 2005 23:13:57 -0000	1.43
  +++ DOM.mm	29 Aug 2005 17:42:44 -0000	1.44
  @@ -224,7 +224,7 @@
   
   - (DOMNodeList *)childNodes
   {
  -    return [DOMNodeList _nodeListWithImpl:[self _nodeImpl]->childNodes()];
  +    return [DOMNodeList _nodeListWithImpl:[self _nodeImpl]->childNodes().get()];
   }
   
   - (DOMNode *)firstChild
  
  
  



More information about the webkit-changes mailing list