[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_3_BRANCH: kdelibs/khtml
From:       Germain Garand <germain () ebooksfrance ! com>
Date:       2004-09-08 18:08:39
Message-ID: 20040908180839.CEE2FE61 () office ! kde ! org
[Download RAW message or body]

CVS commit by ggarand: 

backport jump-to-anchor fixes

CCMAIL: 57360-done@bugs.kde.org


  M +14 -4     khtml_part.cpp   1.1015.2.3
  M +13 -9     xml/dom_nodeimpl.cpp   1.236.2.1


--- kdelibs/khtml/xml/dom_nodeimpl.cpp  #1.236:1.236.2.1
@@ -1351,9 +1351,11 @@ bool NodeBaseImpl::getUpperLeftCorner(in
         if((o->isText() && !o->isBR()) || o->isReplaced()) {
             o->container()->absolutePosition( xPos, yPos );
-            if (o->isText())
-                xPos += static_cast<RenderText *>(o)->minXPos();
-            else
+            if (o->isText()) {
+                xPos += o->inlineXPos();
+                yPos += o->inlineYPos();
+            } else {
                 xPos += o->xPos();
             yPos += o->yPos();
+            }
             return true;
         }
@@ -1393,9 +1395,11 @@ bool NodeBaseImpl::getLowerRightCorner(i
         if((o->isText() && !o->isBR()) || o->isReplaced()) {
             o->container()->absolutePosition(xPos, yPos);
-            if (o->isText())
-                xPos += static_cast<RenderText *>(o)->minXPos() + o->width();
-            else
-                xPos += o->xPos()+o->width();
-            yPos += o->yPos()+o->height();
+            if (o->isText()) {
+                xPos += o->inlineXPos() + o->width();
+                yPos += o->inlineYPos() + o->height();
+            } else {
+                xPos += o->xPos() + o->width();
+                yPos += o->yPos() + o->height();
+            }
             return true;
         }

--- kdelibs/khtml/khtml_part.cpp  #1.1015.2.2:1.1015.2.3
@@ -576,4 +576,5 @@ bool KHTMLPart::openURL( const KURL &url
     args.yOffset = d->m_view->contentsY();
     d->m_extension->setURLArgs(args);
+    disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(gotoAnchor()));
     connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition()));
   }
@@ -2242,7 +2243,10 @@ void KHTMLPart::setUserStyleSheet(const 
 void KHTMLPart::gotoAnchor()
 {
+  if ( !d->m_doc || !d->m_doc->parsing() ) {
   disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(gotoAnchor()));
-  if ( !gotoAnchor( m_url.encodedHtmlRef()) )
-      gotoAnchor( m_url.htmlRef() );
+  }
+
+  if ( !gotoAnchor(m_url.encodedHtmlRef()) )
+      gotoAnchor(m_url.htmlRef());
 }
 
@@ -2262,5 +2266,11 @@ bool KHTMLPart::gotoAnchor( const QStrin
   }
 
-  if(!n) {
+  // Implement the rule that "" and "top" both mean top of page as in other browsers.
+  bool quirkyName = !n && !d->m_doc->inStrictMode() && (name.isEmpty() || name.lower() == "top");
+
+  if (quirkyName) {
+      d->m_view->setContentsPos(0, 0);
+      return true;
+  } else if (!n) {
       kdDebug(6050) << "KHTMLPart::gotoAnchor node '" << name << "' not found" << endl;
       return false;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic