[webkit-changes] cvs commit: WebCore/khtml/xml dom_nodeimpl.cpp dom_position.cpp dom_position.h

David harrison at opensource.apple.com
Tue Jun 21 11:11:11 PDT 2005


harrison    05/06/21 11:11:11

  Modified:    .        ChangeLog
               khtml/editing selection.cpp visible_position.cpp
               khtml/xml dom_nodeimpl.cpp dom_position.cpp dom_position.h
  Log:
          Reviewed by Justin.
  
          - show class and style attributes for element nodes
          - nil check the node being showTree'd
          - add Position::showTree()
  
          Test cases added: None needed for this debug-only utility code.
  
          * khtml/editing/selection.cpp:
          (khtml::Selection::showTree):
          - nil check the node
          * khtml/editing/visible_position.cpp:
          (khtml::VisiblePosition::previousVisiblePosition):
          - comments
          (khtml::VisiblePosition::showTree):
          - nil check the node
          * khtml/xml/dom_nodeimpl.cpp:
          (appendAttributeDesc):
          (NodeImpl::showNode):
          - show class and style attributes for element nodes
          * khtml/xml/dom_position.cpp:
          (DOM::Position::showTree):
          * khtml/xml/dom_position.h:
          - add Position::showTree()
  
  Revision  Changes    Path
  1.4290    +27 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4289
  retrieving revision 1.4290
  diff -u -r1.4289 -r1.4290
  --- ChangeLog	21 Jun 2005 08:25:23 -0000	1.4289
  +++ ChangeLog	21 Jun 2005 18:11:07 -0000	1.4290
  @@ -1,3 +1,30 @@
  +2005-06-21  David Harrison  <harrison at apple.com>
  +
  +        Reviewed by Justin.
  +        
  +        - show class and style attributes for element nodes
  +        - nil check the node being showTree'd
  +        - add Position::showTree()
  +
  +        Test cases added: None needed for this debug-only utility code.
  +
  +        * khtml/editing/selection.cpp:
  +        (khtml::Selection::showTree):
  +        - nil check the node
  +        * khtml/editing/visible_position.cpp:
  +        (khtml::VisiblePosition::previousVisiblePosition):
  +        - comments
  +        (khtml::VisiblePosition::showTree):
  +        - nil check the node
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (appendAttributeDesc):
  +        (NodeImpl::showNode):
  +        - show class and style attributes for element nodes
  +        * khtml/xml/dom_position.cpp:
  +        (DOM::Position::showTree):
  +        * khtml/xml/dom_position.h:
  +        - add Position::showTree()
  +
   2005-06-20  Maciej Stachowiak  <mjs at apple.com>
   
           Reviewed by Darin(first pass) and Hyatt.
  
  
  
  1.88      +2 -1      WebCore/khtml/editing/selection.cpp
  
  Index: selection.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/selection.cpp,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- selection.cpp	17 Jun 2005 02:13:11 -0000	1.87
  +++ selection.cpp	21 Jun 2005 18:11:10 -0000	1.88
  @@ -1096,7 +1096,8 @@
   
   void Selection::showTree()
   {
  -    m_start.node()->showTreeAndMark(m_start.node(), "S", m_end.node(), "E");
  +    if (m_start.node())
  +        m_start.node()->showTreeAndMark(m_start.node(), "S", m_end.node(), "E");
   }
   #endif
   
  
  
  
  1.50      +4 -0      WebCore/khtml/editing/visible_position.cpp
  
  Index: visible_position.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/visible_position.cpp,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- visible_position.cpp	17 Jun 2005 02:13:11 -0000	1.49
  +++ visible_position.cpp	21 Jun 2005 18:11:10 -0000	1.50
  @@ -200,6 +200,9 @@
       // itself (if it is a candidate) when iterating back from a deepEquivalent
       // that is not a candidate.  That is wrong!  However, our clients seem to
       // like it.  Gotta lose those clients! (initDownstream and initUpstream)
  +    
  +    // How about "if isCandidate(pos) back up to the previous candidate, else
  +    // back up to the second previous candidate"?
       Position current = test;
       while (!current.atStart()) {
           current = current.previous(UsingComposedCharacters);
  @@ -408,6 +411,7 @@
   
   void VisiblePosition::showTree()
   {
  +    if (m_deepPosition.node())
       m_deepPosition.node()->showTreeAndMark(m_deepPosition.node(), "*", NULL, NULL);
   }
   #endif
  
  
  
  1.155     +17 -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.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- dom_nodeimpl.cpp	17 Jun 2005 18:50:29 -0000	1.154
  +++ dom_nodeimpl.cpp	21 Jun 2005 18:11:10 -0000	1.155
  @@ -1601,6 +1601,17 @@
   
   #ifndef NDEBUG
   
  +static void appendAttributeDesc(NodeImpl *node, QString &string, NodeImpl::Id attrID, QString attrDesc)
  +{
  +    if (node->isElementNode()) {
  +        DOMString attr = static_cast<ElementImpl *>(node)->getAttribute(attrID);
  +        if (!attr.isEmpty()) {
  +            string += attrDesc;
  +            string += attr.string();
  +        }
  +    }
  +}
  +
   void NodeImpl::showNode(const char *prefix)
   {
       if (!prefix)
  @@ -1610,8 +1621,12 @@
           value.replace('\\', "\\\\");
           value.replace('\n', "\\n");
           fprintf(stderr, "%s%s\t%p \"%s\"\n", prefix, nodeName().string().local8Bit().data(), this, value.local8Bit().data());
  -    } else
  -        fprintf(stderr, "%s%s\t%p\n", prefix, nodeName().string().local8Bit().data(), this);
  +    } else {
  +        QString attrs = "";
  +        appendAttributeDesc(this, attrs, ATTR_CLASS, " CLASS=");
  +        appendAttributeDesc(this, attrs, ATTR_STYLE, " STYLE=");
  +        fprintf(stderr, "%s%s\t%p%s\n", prefix, nodeName().string().local8Bit().data(), this, attrs.ascii());
  +    }
   }
   
   void NodeImpl::showTree()
  
  
  
  1.71      +6 -0      WebCore/khtml/xml/dom_position.cpp
  
  Index: dom_position.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_position.cpp,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- dom_position.cpp	13 May 2005 16:48:51 -0000	1.70
  +++ dom_position.cpp	21 Jun 2005 18:11:10 -0000	1.71
  @@ -838,6 +838,12 @@
       strncpy(buffer, result.string().latin1(), length - 1);
   }
   #undef FormatBufferSize
  +
  +void Position::showTree() const
  +{
  +    if (m_node)
  +        m_node->showTree();
  +}
   #endif
   
   
  
  
  
  1.34      +1 -0      WebCore/khtml/xml/dom_position.h
  
  Index: dom_position.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_position.h,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- dom_position.h	13 May 2005 16:48:51 -0000	1.33
  +++ dom_position.h	21 Jun 2005 18:11:10 -0000	1.34
  @@ -92,6 +92,7 @@
   
   #ifndef NDEBUG
       void formatForDebugger(char *buffer, unsigned length) const;
  +    void showTree() const;
   #endif
       
   private:
  
  
  



More information about the webkit-changes mailing list