--Boundary-00=_63m/AfbdhtYLHbc Content-Type: text/plain; charset="iso-8859-1"; boundary="" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wednesday 21 July 2004 09.51, Michael A. Borisov wrote: > >Ah, it's about image *maps*. Yes, these are known to be broken. > > No, www.sdesigns.com menu does not contain image maps, but there is a > problem (not related with scrolling). > Did image map bug already fixed or not? I have a patch(attached) ready that fixes the imagemap tooltips issue. If everyone is ok, I will commit in a few days. Jean-Baptiste --Boundary-00=_63m/AfbdhtYLHbc Content-Type: text/x-diff; charset="iso-8859-1"; name="maptitle.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="maptitle.diff" Index: khtmlview.cpp =================================================================== RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v retrieving revision 1.639 diff -u -3 -r1.639 khtmlview.cpp --- khtmlview.cpp 19 Jun 2004 20:47:34 -0000 1.639 +++ khtmlview.cpp 27 Jun 2004 22:46:40 -0000 @@ -111,7 +111,7 @@ }; protected: - virtual void maybeTip(const QPoint &); + virtual void maybeTip(const QPoint &p); private: KHTMLView *m_view; @@ -326,18 +326,26 @@ #ifndef QT_NO_TOOLTIP -void KHTMLToolTip::maybeTip(const QPoint& /*p*/) +void KHTMLToolTip::maybeTip(const QPoint& p) { DOM::NodeImpl *node = m_viewprivate->underMouse; + int vx,vy; + m_view->contentsToViewport(0,0,vx,vy); QRect region; while ( node ) { if ( node->isElementNode() ) { QString s = static_cast( node )->getAttribute( ATTR_TITLE ).string(); - QRect r = node->getRect(); + QRect r=QRect(); + if (node->id()==ID_AREA) + r = static_cast(node)->getRect(QPoint(p.x()-vx,p.y()-vy)); + else r=node->getRect(); + if (!r.isEmpty()) + { region |= QRect( m_view->contentsToViewport( r.topLeft() ), r.size() ); - if ( !s.isEmpty() ) { + if ( !s.isEmpty()) { tip( region, QStyleSheet::convertFromPlainText( s, QStyleSheetItem::WhiteSpaceNormal ) ); break; + } } } node = node->parentNode(); Index: html/html_imageimpl.cpp =================================================================== RCS file: /home/kde/kdelibs/khtml/html/html_imageimpl.cpp,v retrieving revision 1.146 diff -u -3 -r1.146 html_imageimpl.cpp --- html/html_imageimpl.cpp 25 Feb 2004 00:41:34 -0000 1.146 +++ html/html_imageimpl.cpp 27 Jun 2004 22:46:42 -0000 @@ -387,13 +387,29 @@ return inside; } -QRect HTMLAreaElementImpl::getRect() const +QRect HTMLAreaElementImpl::getRect(const QPoint& p) const { - if (parentNode()->renderer()==0) - return QRect(); - int dx, dy; - if (!parentNode()->renderer()->absolutePosition(dx, dy)) + if (!parentNode()) return QRect(); + + int dx=0, dy=0; + QString mapName=static_cast(parentNode())->getAttribute(ATTR_NAME).string(); + NodeImpl *de = static_cast(getDocument()); + for (NodeImpl* n = de->firstChild(); n; n = n->traverseNextNode()) + if ((n->id() == ID_IMG)) + if (static_cast(n)->getAttribute( ATTR_USEMAP ).string().section("#",-1)==mapName) + { + QRect rec=static_cast(n)->getRect(); + if (!rec.isNull()) + { + dx=rec.x(); + dy=rec.y(); + if (QRect(dx,dy,lastw,lasth).contains(p)) break; + } + } + + //if (!parentNode()->renderer()->absolutePosition(dx, dy)) + // return QRect(); QRegion region = getRegion(lastw,lasth); region.translate(dx, dy); return region.boundingRect(); Index: html/html_imageimpl.h =================================================================== RCS file: /home/kde/kdelibs/khtml/html/html_imageimpl.h,v retrieving revision 1.66 diff -u -3 -r1.66 html_imageimpl.h --- html/html_imageimpl.h 24 Jun 2003 21:56:04 -0000 1.66 +++ html/html_imageimpl.h 27 Jun 2004 22:46:42 -0000 @@ -87,7 +87,7 @@ bool mapMouseEvent(int x_, int y_, int width_, int height_, khtml::RenderObject::NodeInfo& info); - virtual QRect getRect() const; + virtual QRect getRect(const QPoint& p) const; protected: QRegion getRegion(int width_, int height) const; --Boundary-00=_63m/AfbdhtYLHbc--