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

Darin darin at opensource.apple.com
Sun Dec 18 15:40:14 PST 2005


darin       05/12/18 15:40:14

  Modified:    .        ChangeLog
               khtml/rendering render_frames.cpp render_line.cpp
               khtml/xml dom_nodeimpl.h dom_textimpl.h
  Log:
          Reviewed by Geoff.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5680
            containsOnlyWhitespace does not need to be a virtual function
  
          * khtml/rendering/render_frames.cpp: (RenderPartObject::updateWidget): Cast
          pointer to a TextImpl before calling containsOnlyWhitespace; the code already
          checked isTextNode.
          * khtml/rendering/render_line.cpp: (khtml::shouldDrawDecoration): Expanded an
          if statement into a few separate ones for slight additional clarity. Added a
          check of isTextNode and cast pointer to a TextImpl.
  
          * khtml/xml/dom_nodeimpl.h: Remove containsOnlyWhitespace function.
          * khtml/xml/dom_textimpl.h: Remove virtual keyword from containsOnlyWhitespace.
  
  Revision  Changes    Path
  1.563     +17 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.562
  retrieving revision 1.563
  diff -u -r1.562 -r1.563
  --- ChangeLog	18 Dec 2005 22:55:32 -0000	1.562
  +++ ChangeLog	18 Dec 2005 23:40:08 -0000	1.563
  @@ -1,3 +1,20 @@
  +2005-12-18  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by Geoff.
  +
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5680
  +          containsOnlyWhitespace does not need to be a virtual function
  +
  +        * khtml/rendering/render_frames.cpp: (RenderPartObject::updateWidget): Cast
  +        pointer to a TextImpl before calling containsOnlyWhitespace; the code already
  +        checked isTextNode.
  +        * khtml/rendering/render_line.cpp: (khtml::shouldDrawDecoration): Expanded an
  +        if statement into a few separate ones for slight additional clarity. Added a
  +        check of isTextNode and cast pointer to a TextImpl.
  +
  +        * khtml/xml/dom_nodeimpl.h: Remove containsOnlyWhitespace function.
  +        * khtml/xml/dom_textimpl.h: Remove virtual keyword from containsOnlyWhitespace.
  +
   2005-12-18  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
           Reviewed by Hyatt, landed by Darin.
  
  
  
  1.89      +2 -1      WebCore/khtml/rendering/render_frames.cpp
  
  Index: render_frames.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_frames.cpp,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- render_frames.cpp	18 Dec 2005 05:01:30 -0000	1.88
  +++ render_frames.cpp	18 Dec 2005 23:40:12 -0000	1.89
  @@ -34,6 +34,7 @@
   #include "html/htmltokenizer.h"
   #include "xml/dom2_eventsimpl.h"
   #include "xml/dom_docimpl.h"
  +#include "xml/dom_textimpl.h"
   #include "xml/EventNames.h"
   #include "khtmlview.h"
   #include "khtml_part.h"
  @@ -900,7 +901,7 @@
         m_hasFallbackContent = false;
         for (NodeImpl *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
             if ((!child->isTextNode() && !child->hasTagName(embedTag) && !child->hasTagName(paramTag)) || // Discount <embed> and <param>
  -              (child->isTextNode() && !child->containsOnlyWhitespace()))
  +              (child->isTextNode() && !static_cast<TextImpl*>(child)->containsOnlyWhitespace()))
                 m_hasFallbackContent = true;
         }
         bool success = part->requestObject( this, url, serviceType, paramNames, paramValues );
  
  
  
  1.60      +14 -12    WebCore/khtml/rendering/render_line.cpp
  
  Index: render_line.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_line.cpp,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- render_line.cpp	14 Dec 2005 23:31:56 -0000	1.59
  +++ render_line.cpp	18 Dec 2005 23:40:12 -0000	1.60
  @@ -908,20 +908,22 @@
   
   static bool shouldDrawDecoration(RenderObject* obj)
   {
  -    bool shouldDraw = false;
  -    for (RenderObject* curr = obj->firstChild();
  -         curr; curr = curr->nextSibling()) {
  -        if (curr->isInlineFlow()) {
  -            shouldDraw = true;
  -            break;
  +    for (RenderObject* curr = obj->firstChild(); curr; curr = curr->nextSibling()) {
  +        if (curr->isInlineFlow())
  +            return true;
  +        if (curr->isText() && !curr->isBR()) {
  +            if (!curr->style()->collapseWhiteSpace())
  +                return true;
  +            NodeImpl* currElement = curr->element();
  +            if (!currElement)
  +                return true;
  +            if (!currElement->isTextNode())
  +                return true;
  +            if (!static_cast<TextImpl*>(currElement)->containsOnlyWhitespace())
  +                return true;
           }
  -        else if (curr->isText() && !curr->isBR() && (!curr->style()->collapseWhiteSpace() ||
  -                 !curr->element() || !curr->element()->containsOnlyWhitespace())) {
  -            shouldDraw = true;
  -            break;
  -        }	
       }
  -    return shouldDraw;
  +    return false;
   }
   
   void InlineFlowBox::paintDecorations(RenderObject::PaintInfo& i, int _tx, int _ty, bool paintedChildren)
  
  
  
  1.120     +0 -2      WebCore/khtml/xml/dom_nodeimpl.h
  
  Index: dom_nodeimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- dom_nodeimpl.h	4 Dec 2005 20:55:46 -0000	1.119
  +++ dom_nodeimpl.h	18 Dec 2005 23:40:13 -0000	1.120
  @@ -128,8 +128,6 @@
       virtual bool isMalformed() { return false; }
       virtual void setMalformed(bool malformed) {};
       
  -    virtual bool containsOnlyWhitespace() const { return false; }
  -    
       // helper functions not being part of the DOM
       // Attention: they assume that the caller did the consistency checking!
       void setPreviousSibling(NodeImpl *previous) { m_previous = previous; }
  
  
  
  1.23      +1 -1      WebCore/khtml/xml/dom_textimpl.h
  
  Index: dom_textimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_textimpl.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- dom_textimpl.h	21 Nov 2005 01:20:42 -0000	1.22
  +++ dom_textimpl.h	18 Dec 2005 23:40:13 -0000	1.23
  @@ -51,7 +51,7 @@
       virtual void deleteData ( const unsigned offset, const unsigned count, int &exceptioncode );
       virtual void replaceData ( const unsigned offset, const unsigned count, const DOMString &arg, int &exceptioncode );
   
  -    virtual bool containsOnlyWhitespace() const;
  +    bool containsOnlyWhitespace() const;
       bool containsOnlyWhitespace(unsigned int from, unsigned int len) const;
       
       // DOM methods overridden from  parent classes
  
  
  



More information about the webkit-changes mailing list