From kde-commits Fri Dec 31 21:42:24 2004 From: John Tapsell Date: Fri, 31 Dec 2004 21:42:24 +0000 To: kde-commits Subject: kdelibs/khtml Message-Id: <20041231214224.9B0A21CF33 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=110452936003280 CVS commit by johnflux: Add a currentPixmap() to html_imageimpl.cpp (since currentImage converts from a pixmap to a qimage). Also don't make a dragobject of a null or incomplete pixmap. This causes konqueror to crash. M +1 -1 khtml_part.cpp 1.1070 M +9 -0 html/html_imageimpl.cpp 1.149 M +8 -0 html/html_imageimpl.h 1.70 --- kdelibs/khtml/khtml_part.cpp #1.1069:1.1070 @@ -6042,5 +6042,5 @@ void KHTMLPart::khtmlMouseMoveEvent( kht urlDrag->metaData()["referrer"] = d->m_referrer; - if( img ) { + if( img && img->complete()) { KMultipleDrag *mdrag = new KMultipleDrag( d->m_view->viewport() ); mdrag->addDragObject( new QImageDrag( img->currentImage(), 0L ) ); --- kdelibs/khtml/html/html_imageimpl.cpp #1.148:1.149 @@ -229,4 +229,13 @@ QImage HTMLImageElementImpl::currentImag } +QPixmap HTMLImageElementImpl::currentPixmap() const +{ + RenderImage *r = static_cast(renderer()); + + if(r) + return r->pixmap(); + + return QPixmap(); +} bool HTMLImageElementImpl::complete() const --- kdelibs/khtml/html/html_imageimpl.h #1.69:1.70 @@ -53,5 +53,13 @@ public: bool isServerMap() const { return ( ismap && !usemap.length() ); } + /** Return the image for this element. + * This has to convert the pixmap into an image first. + * This will return undefined results if complete() is not true. + */ QImage currentImage() const; + /** Return the pixmap for this element. + * This will return undefined results if complete() is not true. + */ + QPixmap currentPixmap() const; DOMString altText() const;