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

Vicki vicki at opensource.apple.com
Thu Oct 27 18:51:01 PDT 2005


vicki       05/10/27 18:51:01

  Modified:    .        ChangeLog
               khtml/xml dom_nodeimpl.cpp
  Log:
          Reviewed by Hyatt.
  
  	Fix problems with link jumping.  In the cases below, we were calculating the wrong position to scroll to.
  
          <rdar://problem/4247537> link jumping should scroll to tallest object on line, not first object on line
          <rdar://problem/3489554> when calculating position for link jumping, skip siblings that are unrendered whitespace
          <rdar://problem/4244382> Safari - erratic behavior of empty anchor tags followed by whitespace
          <rdar://problem/4256060> Link scrolling to last object on the page doesn't work if the link being scrolled to contains an empty inline
          <rdar://problem/4276623> erratic link jumping when tables are involved
  
          * khtml/xml/dom_nodeimpl.cpp:
          (DOM::ContainerNodeImpl::getUpperLeftCorner):
  
  Revision  Changes    Path
  1.309     +15 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.308
  retrieving revision 1.309
  diff -u -r1.308 -r1.309
  --- ChangeLog	28 Oct 2005 00:49:44 -0000	1.308
  +++ ChangeLog	28 Oct 2005 01:50:56 -0000	1.309
  @@ -1,3 +1,18 @@
  +2005-10-26  Vicki Murley  <vicki at apple.com>
  +
  +        Reviewed by Hyatt.
  + 
  +	Fix problems with link jumping.  In the cases below, we were calculating the wrong position to scroll to.
  +
  +        <rdar://problem/4247537> link jumping should scroll to tallest object on line, not first object on line
  +        <rdar://problem/3489554> when calculating position for link jumping, skip siblings that are unrendered whitespace
  +        <rdar://problem/4244382> Safari - erratic behavior of empty anchor tags followed by whitespace
  +        <rdar://problem/4256060> Link scrolling to last object on the page doesn't work if the link being scrolled to contains an empty inline
  +        <rdar://problem/4276623> erratic link jumping when tables are involved
  +
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (DOM::ContainerNodeImpl::getUpperLeftCorner):
  +
   2005-10-27  Eric Seidel  <eseidel at apple.com>
   
           Build fix, forgot to commit project file.
  
  
  
  1.206     +31 -18    WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.205
  retrieving revision 1.206
  diff -u -r1.205 -r1.206
  --- dom_nodeimpl.cpp	27 Oct 2005 23:15:04 -0000	1.205
  +++ dom_nodeimpl.cpp	28 Oct 2005 01:51:00 -0000	1.206
  @@ -2356,50 +2356,63 @@
       }
   }
   
  -// I don't like this way of implementing the method, but I didn't find any
  -// other way. Lars
   bool ContainerNodeImpl::getUpperLeftCorner(int &xPos, int &yPos) const
   {
       if (!m_render)
           return false;
       RenderObject *o = m_render;
  +    RenderObject *p = o;
  +
       xPos = yPos = 0;
  -    if ( !o->isInline() || o->isReplaced() ) {
  +    if (!o->isInline() || o->isReplaced()) {
           o->absolutePosition( xPos, yPos );
           return true;
       }
   
       // find the next text/image child, to get a position
       while(o) {
  +        p = o;
           if(o->firstChild())
               o = o->firstChild();
           else if(o->nextSibling())
               o = o->nextSibling();
           else {
  -            // FIXME: If the element we're scrolling to doesn't have a child or next sibling and none of the nodes on 
  -            // the parent chain have siblings, then this loop returns false prematurely - 4256060
  -            RenderObject *next = 0;
  -            while(!next) {
  -                o = o->parent();
  -                if(!o) return false;
  -                next = o->nextSibling();
  -            }
  -            o = next;
  +            o = o->parent();
  +            if (o) 
  +                o = o->nextSibling();
  +            if (!o)
  +                break;
           }
  -        if (o->parent()->element() == this && o->isText() && !o->isBR() && !static_cast<RenderText*>(o)->firstTextBox()) {
  -            // do nothing - skip child node of the named anchor if it doesn't have a text box rdar://problems/4233844&4246096
  +
  +        if (!o->isInline() || o->isReplaced()) {
  +            o->absolutePosition( xPos, yPos );
  +            return true;
  +        }
  +
  +        if (p->element() && p->element() == this && o->isText() && !o->isBR() && !static_cast<RenderText*>(o)->firstTextBox()) {
  +                // do nothing - skip unrendered whitespace that is a child or next sibling of the anchor
           }
           else if((o->isText() && !o->isBR()) || o->isReplaced()) {
               o->container()->absolutePosition( xPos, yPos );
  -            if (o->isText())
  +            if (o->isText() && static_cast<RenderText *>(o)->firstTextBox()) {
                   xPos += static_cast<RenderText *>(o)->minXPos();
  -            else
  +                yPos += static_cast<RenderText *>(o)->firstTextBox()->root()->topOverflow();
  +            }
  +            else {
                   xPos += o->xPos();
  -            yPos += o->yPos();
  +                yPos += o->yPos();
  +            }
               return true;
           }
       }
  -    return true;
  +    
  +    // If the target doesn't have any children or siblings that could be used to calculate the scroll position, we must be
  +    // at the end of the document.  Scroll to the bottom.
  +    if (!o) {
  +        yPos += getDocument()->view()->contentsHeight();
  +        return true;
  +    }
  +    return false;
   }
   
   bool ContainerNodeImpl::getLowerRightCorner(int &xPos, int &yPos) const
  
  
  



More information about the webkit-changes mailing list