QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
: q(qq)
, view(0)
- , lastHoverElement(0)
, modified(false)
{
chromeClient = new ChromeClientQt(q);
mainFrame->d->verticalScrollBar() ? mainFrame->d->verticalScrollBar()->value() : 0;
IntPoint pt(ev->x() + xOffset, ev->y() + yOffset);
WebCore::HitTestResult result = QWebFramePrivate::core(mainFrame)->eventHandler()->hitTestResultAtPoint(pt, false);
- WebCore::Element *link = result.URLElement();
- if (link != lastHoverElement) {
- lastHoverElement = link;
- emit q->hoveringOverLink(result.absoluteLinkURL().prettyURL(), result.title(), result.textContent());
+
+ if (result.absoluteLinkURL() != lastHoverURL
+ || result.title() != lastHoverTitle
+ || result.textContent() != lastHoverContent) {
+ lastHoverURL = result.absoluteLinkURL();
+ lastHoverTitle = result.title();
+ lastHoverContent = result.textContent();
+ emit q->hoveringOverLink(lastHoverURL.prettyURL(), lastHoverTitle, lastHoverContent);
}
}
#include "qwebhistory.h"
#include "qwebframe.h"
+#include "KURL.h"
+#include "PlatformString.h"
+
#include <wtf/RefPtr.h>
namespace WebCore
QWebPage *q;
QUndoStack *undoStack;
QWidget *view;
- WebCore::Element *lastHoverElement;
+
+ WebCore::KURL lastHoverURL;
+ WebCore::String lastHoverTitle;
+ WebCore::String lastHoverContent;
bool modified;
+2008-01-16 Holger Freyther <holger.freyther@trolltech.com>
+
+ Reviewed by Simon.
+
+ Change hoveringOverLink implementation to have less issues.
+
+ * Currently we only compare a pointer. In the worst case we
+ could delete the Element we have pointed to and a new one
+ gets the same address. But even if that doesn't happen the
+ WebCore::Element is mutable and JavaScript could change the
+ URL, Title or Content. So we have to compare all these three
+ attributes.
+ * This does not seem to be a performance impact.
+
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::mouseMoveEvent):
+ * Api/qwebpage_p.h:
+
2008-01-16 Holger Freyther <holger.freyther@trolltech.com>
Reviewed by Simon.