mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Click2Flash: Fixed browser window flashing on loading some flash objects
- this bug so far occurs only on X11 - implemented asynchronous JavaScript element replacing
This commit is contained in:
parent
ba1cf804eb
commit
75a004499e
@ -229,9 +229,43 @@ void ClickToFlash::load()
|
||||
qWarning("Click2Flash: Cannot find Flash object.");
|
||||
}
|
||||
else {
|
||||
QWebElement substitute = m_element.clone();
|
||||
substitute.setAttribute(QLatin1String("type"), "application/futuresplash");
|
||||
m_element.replace(substitute);
|
||||
/*
|
||||
Old code caused sometimes flashing of the whole browser window and then somehow
|
||||
ruined rendering of opacity effects, etc.. in the window on X11.
|
||||
|
||||
QWebElement substitute = m_element.clone();
|
||||
substitute.setAttribute(QLatin1String("type"), "application/futuresplash");
|
||||
m_element.replace(substitute);
|
||||
|
||||
So asynchronous JavaScript code is used to remove element from page and then substitute
|
||||
it with unblocked Flash. The JavaScript code is:
|
||||
|
||||
var qz_c2f_clone = this.cloneNode(true);
|
||||
var qz_c2f_parentNode = this.parentNode;
|
||||
var qz_c2f_nextSibling = this.nextSibling;
|
||||
|
||||
this.parentNode.removeChild(this);
|
||||
|
||||
setTimeout(function(){
|
||||
if(qz_c2f_nextSibling) {
|
||||
qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);
|
||||
}
|
||||
else {
|
||||
qz_c2f_parentNode.appendChild(qz_c2f_clone);
|
||||
}
|
||||
}, 0);
|
||||
|
||||
*/
|
||||
|
||||
m_element.setAttribute("type", "application/futuresplash");
|
||||
QString js = "var qz_c2f_clone=this.cloneNode(true);var qz_c2f_parentNode=this.parentNode;"
|
||||
"var qz_c2f_nextSibling=this.nextSibling;this.parentNode.removeChild(this);"
|
||||
"setTimeout(function(){if(qz_c2f_nextSibling){"
|
||||
"qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);}"
|
||||
"else{qz_c2f_parentNode.appendChild(qz_c2f_clone);}"
|
||||
"}, 0);";
|
||||
m_element.evaluateJavaScript(js);
|
||||
|
||||
|
||||
acceptedUrl = m_url;
|
||||
acceptedArgNames = m_argumentNames;
|
||||
@ -295,7 +329,3 @@ void ClickToFlash::showInfo()
|
||||
qz_centerWidgetToParent(widg, m_page->view());
|
||||
widg->show();
|
||||
}
|
||||
|
||||
ClickToFlash::~ClickToFlash()
|
||||
{
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ class QT_QUPZILLA_EXPORT ClickToFlash : public QWidget
|
||||
|
||||
public:
|
||||
explicit ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, WebPage* parentPage);
|
||||
~ClickToFlash();
|
||||
|
||||
static bool isAlreadyAccepted(const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues);
|
||||
|
||||
@ -97,7 +96,6 @@ private:
|
||||
static QStringList acceptedArgNames;
|
||||
static QStringList acceptedArgValues;
|
||||
|
||||
|
||||
WebPage* m_page;
|
||||
};
|
||||
|
||||
|
@ -432,6 +432,12 @@ QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
|
||||
return new PopupWebPage(type, p_QupZilla);
|
||||
}
|
||||
|
||||
QObject* WebPage::createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
return pluginFactory()->create(classid, url, paramNames, paramValues);
|
||||
}
|
||||
|
||||
void WebPage::addAdBlockRule(const QString &filter, const QUrl &url)
|
||||
{
|
||||
AdBlockedEntry entry;
|
||||
|
@ -100,6 +100,7 @@ private slots:
|
||||
protected:
|
||||
bool event(QEvent* event);
|
||||
QWebPage* createWindow(QWebPage::WebWindowType type);
|
||||
QObject* createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues);
|
||||
|
||||
private:
|
||||
bool supportsExtension(Extension extension) const;
|
||||
|
Loading…
Reference in New Issue
Block a user