1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[Fix] crash in Click2Flash plugin when element is not found.

- also little improvement in WebView mousepress events
This commit is contained in:
nowrep 2011-12-28 23:25:40 +01:00
parent 89cad89ad0
commit 5af4df90b7
2 changed files with 11 additions and 3 deletions

View File

@ -171,8 +171,13 @@ void ClickToFlash::findElement()
QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos()));
QWebFrame* objectFrame = view->page()->frameAt(objectPos);
QWebHitTestResult hitResult = objectFrame->hitTestContent(objectPos);
QWebElement hitElement = hitResult.element();
QWebHitTestResult hitResult;
QWebElement hitElement;
if (objectFrame) {
hitResult = objectFrame->hitTestContent(objectPos);
hitElement = hitResult.element();
}
if (!hitElement.isNull()) {
m_element = hitElement;

View File

@ -846,10 +846,12 @@ void WebView::mousePressEvent(QMouseEvent* event)
if (isUrlValid(QUrl(m_hoveredLink))) {
tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), tr("New tab"), TabWidget::NewBackgroundTab);
event->accept();
return;
}
#ifdef Q_WS_WIN
else {
QWebView::mouseDoubleClickEvent(event);
return;
}
#endif
break;
@ -859,9 +861,10 @@ void WebView::mousePressEvent(QMouseEvent* event)
return;
}
default:
QWebView::mousePressEvent(event);
break;
}
QWebView::mousePressEvent(event);
}
void WebView::keyPressEvent(QKeyEvent* event)