diff options
author | Ben Murdoch <benm@google.com> | 2010-05-11 18:35:50 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-05-14 10:23:05 +0100 |
commit | 21939df44de1705786c545cd1bf519d47250322d (patch) | |
tree | ef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebKit/qt | |
parent | 4ff1d8891d520763f17675827154340c7c740f90 (diff) | |
download | external_webkit-21939df44de1705786c545cd1bf519d47250322d.zip external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2 |
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebKit/qt')
37 files changed, 1397 insertions, 422 deletions
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index c865c4d..821e699 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -292,6 +292,7 @@ void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) if (overlay) overlay->update(QRectF(dirtyRect)); #if USE(ACCELERATED_COMPOSITING) + updateCompositingScrollPosition(); syncLayers(); #endif } @@ -649,10 +650,13 @@ QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& // fire 'CursorChange'. case ItemCursorChange: return value; - case ItemCursorHasChanged: - QEvent event(QEvent::CursorChange); - QApplication::sendEvent(this, &event); - return value; + case ItemCursorHasChanged: { + QEvent event(QEvent::CursorChange); + QApplication::sendEvent(this, &event); + return value; + } + default: + break; } return QGraphicsWidget::itemChange(change, value); diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp index 8af7203..551346b 100644 --- a/WebKit/qt/Api/qwebelement.cpp +++ b/WebKit/qt/Api/qwebelement.cpp @@ -821,7 +821,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str int propID = cssPropertyID(name); - RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element); + RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element, true); if (!propID || !style) return QString(); diff --git a/WebKit/qt/Api/qwebkitversion.h b/WebKit/qt/Api/qwebkitversion.h index f0fbef0..de79dd1 100644 --- a/WebKit/qt/Api/qwebkitversion.h +++ b/WebKit/qt/Api/qwebkitversion.h @@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ -#include <qstring.h> +#include <QtCore/qstring.h> #ifndef qwebkitversion_h #define qwebkitversion_h diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 0e11c15..c9fc210 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -81,8 +81,9 @@ #include "runtime/InitializeThreading.h" #include "PageGroup.h" #include "NotificationPresenterClientQt.h" -#include "QWebPageClient.h" +#include "PageClientQt.h" #include "WorkerThread.h" +#include "wtf/Threading.h" #include <QApplication> #include <QBasicTimer> @@ -120,126 +121,8 @@ using namespace WebCore; -void QWEBKIT_EXPORT qt_wrt_setViewMode(QWebPage* page, const QString& mode) -{ - QWebPagePrivate::priv(page)->viewMode = mode; - WebCore::Frame* frame = QWebFramePrivate::core(page->mainFrame()); - WebCore::FrameView* view = frame->view(); - frame->document()->updateStyleSelector(); - view->forceLayout(); -} - bool QWebPagePrivate::drtRun = false; -class QWebPageWidgetClient : public QWebPageClient { -public: - QWebPageWidgetClient(QWidget* view) - : view(view) - { - Q_ASSERT(view); - } - - virtual bool isQWidgetClient() const { return true; } - - virtual void scroll(int dx, int dy, const QRect&); - virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); - virtual bool inputMethodEnabled() const; -#if QT_VERSION >= 0x040600 - virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); -#endif - -#ifndef QT_NO_CURSOR - virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); -#endif - - virtual QPalette palette() const; - virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; - virtual QRect geometryRelativeToOwnerWidget() const; - - virtual QObject* pluginParent() const; - - virtual QStyle* style() const; - - QWidget* view; -}; - -void QWebPageWidgetClient::scroll(int dx, int dy, const QRect& rectToScroll) -{ - view->scroll(qreal(dx), qreal(dy), rectToScroll); -} - -void QWebPageWidgetClient::update(const QRect & dirtyRect) -{ - view->update(dirtyRect); -} - -void QWebPageWidgetClient::setInputMethodEnabled(bool enable) -{ - view->setAttribute(Qt::WA_InputMethodEnabled, enable); -} - -bool QWebPageWidgetClient::inputMethodEnabled() const -{ - return view->testAttribute(Qt::WA_InputMethodEnabled); -} - -#if QT_VERSION >= 0x040600 -void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable) -{ - if (enable) - view->setInputMethodHints(view->inputMethodHints() | hint); - else - view->setInputMethodHints(view->inputMethodHints() & ~hint); -} -#endif -#ifndef QT_NO_CURSOR -QCursor QWebPageWidgetClient::cursor() const -{ - return view->cursor(); -} - -void QWebPageWidgetClient::updateCursor(const QCursor& cursor) -{ - view->setCursor(cursor); -} -#endif - -QPalette QWebPageWidgetClient::palette() const -{ - return view->palette(); -} - -int QWebPageWidgetClient::screenNumber() const -{ -#if defined(Q_WS_X11) - return view->x11Info().screen(); -#endif - return 0; -} - -QWidget* QWebPageWidgetClient::ownerWidget() const -{ - return view; -} - -QRect QWebPageWidgetClient::geometryRelativeToOwnerWidget() const -{ - return view->geometry(); -} - -QObject* QWebPageWidgetClient::pluginParent() const -{ - return view; -} - -QStyle* QWebPageWidgetClient::style() const -{ - return view->style(); -} - // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -382,6 +265,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) { WebCore::InitializeLoggingChannelsIfNecessary(); JSC::initializeThreading(); + WTF::initializeMainThread(); WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); chromeClient = new ChromeClientQt(q); @@ -406,7 +290,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) #ifndef QT_NO_CONTEXTMENU currentContextMenu = 0; #endif - smartInsertDeleteEnabled = false; + smartInsertDeleteEnabled = true; selectTrailingWhitespaceEnabled = false; history.d = new QWebHistoryPrivate(page->backForwardList()); @@ -1054,10 +938,6 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) handled = frame->eventHandler()->keyEvent(ev); if (!handled) { handled = true; - QFont defaultFont; - if (client) - defaultFont = client->ownerWidget()->font(); - QFontMetrics fm(defaultFont); if (!handleScrolling(ev, frame)) { switch (ev->key()) { case Qt::Key_Back: @@ -1248,6 +1128,9 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) { WebCore::Frame *frame = page->focusController()->focusedOrMainFrame(); WebCore::Editor *editor = frame->editor(); +#if QT_VERSION >= 0x040600 + QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, 0, 0, QVariant()); +#endif if (!editor->canEdit()) { ev->ignore(); @@ -1264,6 +1147,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) renderTextControl = toRenderTextControl(renderer); Vector<CompositionUnderline> underlines; + bool hasSelection = false; for (int i = 0; i < ev->attributes().size(); ++i) { const QInputMethodEvent::Attribute& a = ev->attributes().at(i); @@ -1287,10 +1171,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) } #if QT_VERSION >= 0x040600 case QInputMethodEvent::Selection: { - if (renderTextControl) { - renderTextControl->setSelectionStart(qMin(a.start, (a.start + a.length))); - renderTextControl->setSelectionEnd(qMax(a.start, (a.start + a.length))); - } + selection = a; + hasSelection = true; break; } #endif @@ -1299,13 +1181,48 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) if (!ev->commitString().isEmpty()) editor->confirmComposition(ev->commitString()); - else if (!ev->preeditString().isEmpty()) { + else { + // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition + // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text + // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text + // 4. otherwise event is updating supplied pre-edit text QString preedit = ev->preeditString(); - editor->setComposition(preedit, underlines, preedit.length(), 0); +#if QT_VERSION >= 0x040600 + if (hasSelection) { + QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString(); + if (preedit.isEmpty() && selection.start + selection.length > 0) + preedit = text; + editor->setComposition(preedit, underlines, + (selection.length < 0) ? selection.start + selection.length : selection.start, + (selection.length < 0) ? selection.start : selection.start + selection.length); + } else +#endif + editor->setComposition(preedit, underlines, preedit.length(), 0); } + ev->accept(); } +void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) +{ + if (event->propertyName() == "_q_viewMode") { + QString mode = q->property("_q_viewMode").toString(); + if (mode != viewMode) { + viewMode = mode; + WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame()); + WebCore::FrameView* view = frame->view(); + frame->document()->updateStyleSelector(); + view->layout(); + } + } else if (event->propertyName() == "_q_HTMLTokenizerChunkSize") { + int chunkSize = q->property("_q_HTMLTokenizerChunkSize").toInt(); + q->handle()->page->setCustomHTMLTokenizerChunkSize(chunkSize); + } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") { + double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble(); + q->handle()->page->setCustomHTMLTokenizerTimeDelay(timeDelay); + } +} + void QWebPagePrivate::shortcutOverrideEvent(QKeyEvent* event) { WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); @@ -1437,7 +1354,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const // We can't access absoluteCaretBounds() while the view needs to layout. return QVariant(); } - return QVariant(frame->selection()->absoluteCaretBounds()); + return QVariant(view->contentsToWindow(frame->selection()->absoluteCaretBounds())); } case Qt::ImFont: { if (renderTextControl) { @@ -1854,12 +1771,12 @@ void QWebPage::setView(QWidget* view) if (d->client) { if (d->client->isQWidgetClient()) - static_cast<QWebPageWidgetClient*>(d->client)->view = view; + static_cast<PageClientQWidget*>(d->client)->view = view; return; } if (view) - d->client = new QWebPageWidgetClient(view); + d->client = new PageClientQWidget(view); } /*! @@ -1993,9 +1910,9 @@ QWebPage *QWebPage::createWindow(WebWindowType type) } /*! - This function is called whenever WebKit encounters a HTML object element with type "application/x-qt-plugin". - The \a classid, \a url, \a paramNames and \a paramValues correspond to the HTML object element attributes and - child elements to configure the embeddable object. + This function is called whenever WebKit encounters a HTML object element with type "application/x-qt-plugin". It is + called regardless of the value of QWebSettings::PluginsEnabled. The \a classid, \a url, \a paramNames and \a paramValues + correspond to the HTML object element attributes and child elements to configure the embeddable object. */ QObject *QWebPage::createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) { @@ -2153,7 +2070,6 @@ void QWebPage::setViewportSize(const QSize &size) const if (frame->d->frame && frame->d->frame->view()) { WebCore::FrameView* view = frame->d->frame->view(); view->setFrameRect(QRect(QPoint(0, 0), size)); - view->forceLayout(); view->adjustViewSize(); } } @@ -2190,10 +2106,10 @@ void QWebPage::setPreferredContentsSize(const QSize &size) const if (size.isValid()) { view->setUseFixedLayout(true); view->setFixedLayoutSize(size); - view->forceLayout(); + view->layout(); } else if (view->useFixedLayout()) { view->setUseFixedLayout(false); - view->forceLayout(); + view->layout(); } } } @@ -2654,6 +2570,9 @@ bool QWebPage::event(QEvent *ev) d->touchEvent(static_cast<QTouchEvent*>(ev)); break; #endif + case QEvent::DynamicPropertyChange: + d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev)); + break; default: return QObject::event(ev); } @@ -3137,233 +3056,255 @@ QWebPluginFactory *QWebPage::pluginFactory() const \o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. \endlist */ -QString QWebPage::userAgentForUrl(const QUrl& url) const +QString QWebPage::userAgentForUrl(const QUrl&) const { - Q_UNUSED(url) - QString ua = QLatin1String("Mozilla/5.0 (" + // splitting the string in three and user QStringBuilder is better than using QString::arg() + static QString firstPart; + static QString secondPart; + static QString thirdPart; + + if (firstPart.isNull() || secondPart.isNull() || thirdPart.isNull()) { + QString firstPartTemp; + firstPartTemp.reserve(150); + firstPartTemp += QString::fromLatin1("Mozilla/5.0 (" // Platform #ifdef Q_WS_MAC - "Macintosh" + "Macintosh" #elif defined Q_WS_QWS - "QtEmbedded" + "QtEmbedded" #elif defined Q_WS_WIN - "Windows" + "Windows" #elif defined Q_WS_X11 - "X11" + "X11" #elif defined Q_OS_SYMBIAN - "SymbianOS" + "SymbianOS" #else - "Unknown" + "Unknown" #endif - // Placeholder for Platform Version - "%1; " + ); - // Placeholder for security strength (N or U) - "%2; " + firstPartTemp += QString::fromLatin1("; "); + + // SSL support +#if !defined(QT_NO_OPENSSL) + // we could check QSslSocket::supportsSsl() here, but this makes + // OpenSSL, certificates etc being loaded in all cases were QWebPage + // is used. This loading is not needed for non-https. + firstPartTemp += QString::fromLatin1("U; "); + // this may lead to a false positive: We indicate SSL since it is + // compiled in even though supportsSsl() might return false +#else + firstPartTemp += QString::fromLatin1("N; "); +#endif - // Subplatform" + // Operating system #ifdef Q_OS_AIX - "AIX" + firstPartTemp += QString::fromLatin1("AIX"); #elif defined Q_OS_WIN32 - "%3" + + switch (QSysInfo::WindowsVersion) { + case QSysInfo::WV_32s: + firstPartTemp += QString::fromLatin1("Windows 3.1"); + break; + case QSysInfo::WV_95: + firstPartTemp += QString::fromLatin1("Windows 95"); + break; + case QSysInfo::WV_98: + firstPartTemp += QString::fromLatin1("Windows 98"); + break; + case QSysInfo::WV_Me: + firstPartTemp += QString::fromLatin1("Windows 98; Win 9x 4.90"); + break; + case QSysInfo::WV_NT: + firstPartTemp += QString::fromLatin1("WinNT4.0"); + break; + case QSysInfo::WV_2000: + firstPartTemp += QString::fromLatin1("Windows NT 5.0"); + break; + case QSysInfo::WV_XP: + firstPartTemp += QString::fromLatin1("Windows NT 5.1"); + break; + case QSysInfo::WV_2003: + firstPartTemp += QString::fromLatin1("Windows NT 5.2"); + break; + case QSysInfo::WV_VISTA: + firstPartTemp += QString::fromLatin1("Windows NT 6.0"); + break; + case QSysInfo::WV_WINDOWS7: + firstPartTemp += QString::fromLatin1("Windows NT 6.1"); + break; + case QSysInfo::WV_CE: + firstPartTemp += QString::fromLatin1("Windows CE"); + break; + case QSysInfo::WV_CENET: + firstPartTemp += QString::fromLatin1("Windows CE .NET"); + break; + case QSysInfo::WV_CE_5: + firstPartTemp += QString::fromLatin1("Windows CE 5.x"); + break; + case QSysInfo::WV_CE_6: + firstPartTemp += QString::fromLatin1("Windows CE 6.x"); + break; + } + #elif defined Q_OS_DARWIN #ifdef __i386__ || __x86_64__ - "Intel Mac OS X" + firstPartTemp += QString::fromLatin1("Intel Mac OS X"); #else - "PPC Mac OS X" + firstPartTemp += QString::fromLatin1("PPC Mac OS X"); #endif #elif defined Q_OS_BSDI - "BSD" + firstPartTemp += QString::fromLatin1("BSD"); #elif defined Q_OS_BSD4 - "BSD Four" + firstPartTemp += QString::fromLatin1("BSD Four"); #elif defined Q_OS_CYGWIN - "Cygwin" + firstPartTemp += QString::fromLatin1("Cygwin"); #elif defined Q_OS_DGUX - "DG/UX" + firstPartTemp += QString::fromLatin1("DG/UX"); #elif defined Q_OS_DYNIX - "DYNIX/ptx" + firstPartTemp += QString::fromLatin1("DYNIX/ptx"); #elif defined Q_OS_FREEBSD - "FreeBSD" + firstPartTemp += QString::fromLatin1("FreeBSD"); #elif defined Q_OS_HPUX - "HP-UX" + firstPartTemp += QString::fromLatin1("HP-UX"); #elif defined Q_OS_HURD - "GNU Hurd" + firstPartTemp += QString::fromLatin1("GNU Hurd"); #elif defined Q_OS_IRIX - "SGI Irix" + firstPartTemp += QString::fromLatin1("SGI Irix"); #elif defined Q_OS_LINUX - "Linux" + +#if defined(__x86_64__) + firstPartTemp += QString::fromLatin1("Linux x86_64"); +#elif defined(__i386__) + firstPartTemp += QString::fromLatin1("Linux i686"); +#else + firstPartTemp += QString::fromLatin1("Linux"); +#endif + #elif defined Q_OS_LYNX - "LynxOS" + firstPartTemp += QString::fromLatin1("LynxOS"); #elif defined Q_OS_NETBSD - "NetBSD" + firstPartTemp += QString::fromLatin1("NetBSD"); #elif defined Q_OS_OS2 - "OS/2" + firstPartTemp += QString::fromLatin1("OS/2"); #elif defined Q_OS_OPENBSD - "OpenBSD" + firstPartTemp += QString::fromLatin1("OpenBSD"); #elif defined Q_OS_OS2EMX - "OS/2" + firstPartTemp += QString::fromLatin1("OS/2"); #elif defined Q_OS_OSF - "HP Tru64 UNIX" + firstPartTemp += QString::fromLatin1("HP Tru64 UNIX"); #elif defined Q_OS_QNX6 - "QNX RTP Six" + firstPartTemp += QString::fromLatin1("QNX RTP Six"); #elif defined Q_OS_QNX - "QNX" + firstPartTemp += QString::fromLatin1("QNX"); #elif defined Q_OS_RELIANT - "Reliant UNIX" + firstPartTemp += QString::fromLatin1("Reliant UNIX"); #elif defined Q_OS_SCO - "SCO OpenServer" + firstPartTemp += QString::fromLatin1("SCO OpenServer"); #elif defined Q_OS_SOLARIS - "Sun Solaris" + firstPartTemp += QString::fromLatin1("Sun Solaris"); #elif defined Q_OS_ULTRIX - "DEC Ultrix" -#elif defined Q_WS_S60 - "Series60" -#elif defined Q_OS_UNIX - "UNIX BSD/SYSV system" -#elif defined Q_OS_UNIXWARE - "UnixWare Seven, Open UNIX Eight" -#else - "Unknown" -#endif - // Placeholder for SubPlatform Version - "%4; "); - - // Platform Version - QString osVer; -#ifdef Q_OS_SYMBIAN - QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); - switch (symbianVersion) { - case QSysInfo::SV_9_2: - osVer = "/9.2"; - break; - case QSysInfo::SV_9_3: - osVer = "/9.3"; - break; - case QSysInfo::SV_9_4: - osVer = "/9.4"; - break; - default: - osVer = "Unknown"; - } -#endif - ua = ua.arg(osVer); - - QChar securityStrength(QLatin1Char('N')); -#if !defined(QT_NO_OPENSSL) - // we could check QSslSocket::supportsSsl() here, but this makes - // OpenSSL, certificates etc being loaded in all cases were QWebPage - // is used. This loading is not needed for non-https. - securityStrength = QLatin1Char('U'); - // this may lead to a false positive: We indicate SSL since it is - // compiled in even though supportsSsl() might return false -#endif - ua = ua.arg(securityStrength); - -#if defined Q_OS_WIN32 - QString ver; - switch (QSysInfo::WindowsVersion) { - case QSysInfo::WV_32s: - ver = "Windows 3.1"; - break; - case QSysInfo::WV_95: - ver = "Windows 95"; - break; - case QSysInfo::WV_98: - ver = "Windows 98"; - break; - case QSysInfo::WV_Me: - ver = "Windows 98; Win 9x 4.90"; - break; - case QSysInfo::WV_NT: - ver = "WinNT4.0"; + firstPartTemp += QString::fromLatin1("DEC Ultrix"); +#elif defined Q_OS_SYMBIAN + firstPartTemp += QString::fromLatin1("SymbianOS"); + QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); + switch (symbianVersion) { + case QSysInfo::SV_9_2: + firstPartTemp += QString::fromLatin1("/9.2"); break; - case QSysInfo::WV_2000: - ver = "Windows NT 5.0"; + case QSysInfo::SV_9_3: + firstPartTemp += QString::fromLatin1("/9.3"); break; - case QSysInfo::WV_XP: - ver = "Windows NT 5.1"; + case QSysInfo::SV_9_4: + firstPartTemp += QString::fromLatin1("/9.4"); break; - case QSysInfo::WV_2003: - ver = "Windows NT 5.2"; + default: + firstPartTemp += QString::fromLatin1("/Unknown"); + } + +#if defined Q_WS_S60 + firstPartTemp += QLatin1Char(' '); + firstPartTemp += QString::fromLatin1("Series60"); + QSysInfo::S60Version s60Version = QSysInfo::s60Version(); + switch (s60Version) { + case QSysInfo::SV_S60_3_1: + firstPartTemp += QString::fromLatin1("/3.1"); break; - case QSysInfo::WV_VISTA: - ver = "Windows NT 6.0"; + case QSysInfo::SV_S60_3_2: + firstPartTemp += QString::fromLatin1("/3.2"); break; -#if QT_VERSION > 0x040500 - case QSysInfo::WV_WINDOWS7: - ver = "Windows NT 6.1"; + case QSysInfo::SV_S60_5_0: + firstPartTemp += QString::fromLatin1("/5.0"); break; + default: + firstPartTemp += QString::fromLatin1("/Unknown"); + } #endif - case QSysInfo::WV_CE: - ver = "Windows CE"; - break; - case QSysInfo::WV_CENET: - ver = "Windows CE .NET"; - break; - case QSysInfo::WV_CE_5: - ver = "Windows CE 5.x"; - break; - case QSysInfo::WV_CE_6: - ver = "Windows CE 6.x"; - break; - } - ua = QString(ua).arg(ver); + +#elif defined Q_OS_UNIX + firstPartTemp += QString::fromLatin1("UNIX BSD/SYSV system"); +#elif defined Q_OS_UNIXWARE + firstPartTemp += QString::fromLatin1("UnixWare Seven, Open UNIX Eight"); +#else + firstPartTemp += QString::fromLatin1("Unknown"); #endif - // SubPlatform Version - QString subPlatformVer; -#ifdef Q_OS_SYMBIAN - QSysInfo::S60Version s60Version = QSysInfo::s60Version(); - switch (s60Version) { - case QSysInfo::SV_S60_3_1: - subPlatformVer = "/3.1"; - break; - case QSysInfo::SV_S60_3_2: - subPlatformVer = "/3.2"; - break; - case QSysInfo::SV_S60_5_0: - subPlatformVer = "/5.0"; - break; - default: - subPlatformVer = " Unknown"; - } + // language is the split + firstPartTemp += QString::fromLatin1("; "); + firstPartTemp.squeeze(); + firstPart = firstPartTemp; + + QString secondPartTemp; + secondPartTemp.reserve(150); + secondPartTemp += QString::fromLatin1(") "); + + // webkit/qt version + secondPartTemp += QString::fromLatin1("AppleWebKit/"); + secondPartTemp += qWebKitVersion(); + secondPartTemp += QString::fromLatin1(" (KHTML, like Gecko) "); + + + // Application name split the third part + secondPartTemp.squeeze(); + secondPart = secondPartTemp; + + QString thirdPartTemp; + thirdPartTemp.reserve(150); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + thirdPartTemp + QLatin1String(" Mobile Safari/"); +#else + thirdPartTemp += QLatin1String(" Safari/"); #endif - ua = ua.arg(subPlatformVer); + thirdPartTemp += qWebKitVersion(); + thirdPartTemp.squeeze(); + thirdPart = thirdPartTemp; + Q_ASSERT(!firstPart.isNull()); + Q_ASSERT(!secondPart.isNull()); + Q_ASSERT(!thirdPart.isNull()); + } // Language - QLocale locale; + QString languageName; if (d->client && d->client->ownerWidget()) - locale = d->client->ownerWidget()->locale(); - QString name = locale.name(); - name[2] = QLatin1Char('-'); - ua.append(name); - ua.append(QLatin1String(") ")); - - // webkit/qt version - ua.append(QString(QLatin1String("AppleWebKit/%1 (KHTML, like Gecko) ")) - .arg(QString(qWebKitVersion()))); + languageName = d->client->ownerWidget()->locale().name(); + else + languageName = QLocale().name(); + languageName[2] = QLatin1Char('-'); // Application name/version QString appName = QCoreApplication::applicationName(); if (!appName.isEmpty()) { - ua.append(appName); QString appVer = QCoreApplication::applicationVersion(); if (!appVer.isEmpty()) - ua.append(QLatin1Char('/') + appVer); + appName.append(QLatin1Char('/') + appVer); } else { // Qt version - ua.append(QLatin1String("Qt/")); - ua.append(QLatin1String(qVersion())); + appName = QString::fromLatin1("Qt/") + QString::fromLatin1(qVersion()); } -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - ua.append(QString(QLatin1String(" Mobile Safari/%1")).arg(qWebKitVersion())); -#else - ua.append(QString(QLatin1String(" Safari/%1")).arg(qWebKitVersion())); -#endif - return ua; + return firstPart + languageName + secondPart + appName + thirdPart; } diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index f40053b..7414716 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -113,6 +113,8 @@ public: void inputMethodEvent(QInputMethodEvent*); + void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*); + void shortcutOverrideEvent(QKeyEvent*); void leaveEvent(QEvent*); void handleClipboard(QEvent*, Qt::MouseButton); diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index 1dff037..99fd812 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -48,9 +48,7 @@ #include <QUrl> #include <QFileInfo> -#if ENABLE(QT_BEARER) #include "NetworkStateNotifier.h" -#endif void QWEBKIT_EXPORT qt_networkAccessAllowed(bool isAllowed) { @@ -74,7 +72,6 @@ public: QString localStoragePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; - QUrl inspectorLocation; void apply(); WebCore::Settings* settings; @@ -187,8 +184,8 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::SpatialNavigationEnabled)); settings->setSpatialNavigationEnabled(value); - value = attributes.value(QWebSettings::JavascriptCanAccessClipboard, - global->attributes.value(QWebSettings::JavascriptCanAccessClipboard)); + value = attributes.value(QWebSettings::DOMPasteAllowed, + global->attributes.value(QWebSettings::DOMPasteAllowed)); settings->setDOMPasteAllowed(value); value = attributes.value(QWebSettings::DeveloperExtrasEnabled, @@ -238,6 +235,10 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls)); settings->setAllowFileAccessFromFileURLs(value); + value = attributes.value(QWebSettings::JavaScriptCanAccessClipboard, + global->attributes.value(QWebSettings::JavaScriptCanAccessClipboard)); + settings->setJavaScriptCanAccessClipboard(value); + value = attributes.value(QWebSettings::XSSAuditingEnabled, global->attributes.value(QWebSettings::XSSAuditingEnabled)); settings->setXSSAuditorEnabled(value); @@ -298,7 +299,9 @@ QWebSettings* QWebSettings::globalSettings() Support for browser plugins can enabled by setting the \l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications, this attribute is enabled for all pages by setting it on the - \l{globalSettings()}{global settings object}. + \l{globalSettings()}{global settings object}. QtWebKit will always ignore this setting + \when processing Qt plugins. The decision to allow a Qt plugin is made by the client + \in its reimplementation of QWebPage::createPlugin. \section1 Web Application Support @@ -367,13 +370,14 @@ QWebSettings* QWebSettings::globalSettings() programs. \value JavaEnabled Enables or disables Java applets. Currently Java applets are not supported. - \value PluginsEnabled Enables or disables plugins in Web pages. + \value PluginsEnabled Enables or disables plugins in Web pages. Qt plugins + with a mimetype such as "application/x-qt-plugin" are not affected by this setting. \value PrivateBrowsingEnabled Private browsing prevents WebKit from recording visited pages in the history and storing web page icons. \value JavascriptCanOpenWindows Specifies whether JavaScript programs can open new windows. - \value JavascriptCanAccessClipboard Specifies whether JavaScript programs - can read or write to the clipboard. + \value DOMPasteAllowed Specifies whether JavaScript programs can + read clipboard contents. \value DeveloperExtrasEnabled Enables extra tools for Web developers. Currently this enables the "Inspect" element in the context menu as well as the use of QWebInspector which controls the WebKit WebInspector @@ -401,6 +405,7 @@ QWebSettings* QWebSettings::globalSettings() QWebSettings::LocalStorageEnabled instead. \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls. \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are allowed to access other local urls. + \value JavaScriptCanAccessClipboard Specifies whether JavaScript can access the clipboard. \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site scripting attempts. \value AcceleratedCompositingEnabled This feature, when used in conjunction with QGraphicsWebView, accelerates animations of web content. CSS animations of the transform and @@ -998,31 +1003,6 @@ void QWebSettings::setLocalStoragePath(const QString& path) } /*! - \since 4.7 - - Specifies the \a location of a frontend to load with each web page when using Web Inspector. - - \sa inspectorUrl() -*/ -void QWebSettings::setInspectorUrl(const QUrl& location) -{ - d->inspectorLocation = location; - d->apply(); -} - -/*! - \since 4.7 - - Returns the location of the Web Inspector frontend. - - \sa setInspectorUrl() -*/ -QUrl QWebSettings::inspectorUrl() const -{ - return d->inspectorLocation; -} - -/*! \since 4.6 \relates QWebSettings diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index bd728d8..7355e33 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -55,7 +55,7 @@ public: PluginsEnabled, PrivateBrowsingEnabled, JavascriptCanOpenWindows, - JavascriptCanAccessClipboard, + DOMPasteAllowed, DeveloperExtrasEnabled, LinksIncludedInFocusChain, ZoomTextOnly, @@ -68,13 +68,14 @@ public: #endif LocalContentCanAccessRemoteUrls, DnsPrefetchEnabled, + JavaScriptCanAccessClipboard, XSSAuditingEnabled, AcceleratedCompositingEnabled, - WebGLEnabled, SpatialNavigationEnabled, LocalContentCanAccessFileUrls, TiledBackingStoreEnabled, - FrameFlatteningEnabled + FrameFlatteningEnabled, + WebGLEnabled }; enum WebGraphic { MissingImageGraphic, @@ -137,9 +138,6 @@ public: void setLocalStoragePath(const QString& path); QString localStoragePath() const; - void setInspectorUrl(const QUrl &location); - QUrl inspectorUrl() const; - static void clearMemoryCaches(); static void enablePersistentStorage(const QString& path = QString()); diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 54f5f65..0ed6300 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,534 @@ +2010-05-07 Simon Hausmann <simon.hausmann@nokia.com> + + Symbian build fix. + + [Qt] Updated the def file with absent exports. + + * symbian/eabi/QtWebKitu.def: + +2010-05-06 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Patch to fix compilation warnings for QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=37428 + + Patch by Alexis Menard <alexis.menard@nokia.com> + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::itemChange): + +2010-05-06 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Replace public inspector url with private property for QtLauncher + https://bugs.webkit.org/show_bug.cgi?id=35340 + + Replace the public API with a private dynamic property until this feature + is ready. + + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::openInspectorFrontend): + * symbian/bwins/QtWebKitu.def: + * symbian/eabi/QtWebKitu.def: + +2010-05-04 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QWebPage viewMode property + https://bugs.webkit.org/show_bug.cgi?id=38119 + + Rename the property from wrt_viewMode to _q_viewMode. + + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::viewModes): + +2010-05-04 Simon Hausmann <simon.hausmann@nokia.com> + + Rubber-stamped by Tor Arne Vestbø. + + [Qt] Preserve binary compatibility with qtwebkit-2.0 branch + + Moved the WebGL attribute in QWebSettings to the end of the enum, + to ensure that the numeric values of the enum values following it + are the same as in the release branch. + + * Api/qwebsettings.h: + +2010-05-03 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Expose HTMLTokenizer yielding parameters + https://bugs.webkit.org/show_bug.cgi?id=37023 + + Enables to set TimeDelay and ChunkSize for + HTMLTokenizer. + + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + +2010-05-03 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * WebCoreSupport/FrameLoaderClientQt.h: + (WebCore::FrameLoaderClientQt::dispatchWillSendSubmitEvent): + +2010-05-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Prune dead code in QWebPage + + * Api/qwebpage.cpp: + +2010-05-02 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with QT_NO_BEARERMANAGEMENT + https://bugs.webkit.org/show_bug.cgi?id=38324 + + * Api/qwebsettings.cpp: + +2010-04-29 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] QtWebKit versioning added + https://bugs.webkit.org/show_bug.cgi?id=37207 + + QtWebkit releases separated from Qt release cycle. + + * qtwebkit_version.pri: Added. + +2010-05-02 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QWebPage::userAgentForUrl is terrible API + https://bugs.webkit.org/show_bug.cgi?id=33875 + + Simplify the creation of the user agent string to avoid some + overhead for each loaded url. + + The static part of the user agent is cached so it only have + to be made once. + This creation has been made in order to simplify the code. + + The two variable: application name and current language are + set dynamically when needed. + The default locale is non longer created if the widget locale + is used. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::userAgentApplicationName): + (tst_QWebPage::userAgentLocaleChange): + +2010-05-02 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] GraphicsLayer: animation incorrect when scrolling + https://bugs.webkit.org/show_bug.cgi?id=38371 + + This is a regression introduced with the invalidate-on-scroll code path, that uses QGraphicsWebViewPrivate::update() + instead of QGraphicsWebViewPrivate::scroll(). The patch makes sure that the scrolling position is correct on + each content update - this shouldn't have a performance impact - the only overhead is an additional value-test on each update. + + Tested by http://www.the-art-of-web.com/css/css-animation/ + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::update): + +2010-05-01 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Add smart paste support + + https://bugs.webkit.org/show_bug.cgi?id=38136 + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): Enable smart paste support by default. + +2010-04-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Reinstate qt_drt_ symbol exports as of QtWebKit 4.6 release + https://bugs.webkit.org/show_bug.cgi?id=38304 + + This change provides backward compatibility with some previously + exported private symbols. No new functionality introduced. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (qt_resumeActiveDOMObjects): + (qt_suspendActiveDOMObjects): + (qt_drt_clearFrameName): + (qt_drt_garbageCollector_collect): + (qt_drt_garbageCollector_collectOnAlternateThread): + (qt_drt_javaScriptObjectsCount): + (qt_drt_numberOfActiveAnimations): + (qt_drt_overwritePluginDirectories): + (qt_drt_pauseAnimation): + (qt_drt_pauseTransitionOfProperty): + (qt_drt_resetOriginAccessWhiteLists): + (qt_drt_run): + (qt_drt_setJavaScriptProfilingEnabled): + (qt_drt_whiteListAccessFromOrigin): + (qt_webpage_groupName): + (qt_webpage_setGroupName): + +2010-04-29 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Get rid of forceLayout() on FrameView + https://bugs.webkit.org/show_bug.cgi?id=38199 + + The function FrameView::forceLayout() is missleading + because it does not actually force the layout, the call is + equivalent to layout(). + + This patch replace the call to forceLayout() by layout() in Qt + to avoid the misunderstanding/improve readability. + + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + (QWebPage::setPreferredContentsSize): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setMediaType): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::forceLayout): + +2010-04-29 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Simon Hausmann. + + Remove unnecessary call to FrameView::forceLayout() in setViewportSize() + This prevents a double relayout on resize. + + https://bugs.webkit.org/show_bug.cgi?id=38179 + + Thanks to Nate Whetsell <nathan.whetsell@gmail.com> for spotting this. + + * Api/qwebpage.cpp: + (QWebPage::setViewportSize): + +2010-04-29 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] REGRESSION(r57982): tst_qwebpage::showModalDialog() crashes + https://bugs.webkit.org/show_bug.cgi?id=38314 + + Make sure that there's always a main frame when returning from createWindow() + to the caller in WebCore. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::createWindow): + +2010-04-28 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed, Qt build fix. + + [Qt] Guard the body of the function instead of the function for + exported functions. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::webInspectorExecuteScript): + (DumpRenderTreeSupportQt::webInspectorClose): + (DumpRenderTreeSupportQt::webInspectorShow): + (DumpRenderTreeSupportQt::setTimelineProfilingEnabled): + +2010-04-28 Antonio Gomes <tonikitoo@webkit.org>, Yi Shen <yi.4.shen@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] tst_QWebHistoryInterface::visitedLinks() fails + https://bugs.webkit.org/show_bug.cgi?id=37323 + + Patch fixes styleProperty method of QWebElement to make use of + CSSComputedStyleDeclaration::computedStyle 'allowVisitedStyle' parameter + and the corresponding failing QWebHistoryInterface::visitedLinks method. + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + * tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp: + (tst_QWebHistoryInterface::visitedLinks): + +2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QWebPage viewMode property + https://bugs.webkit.org/show_bug.cgi?id=38119 + + Replacing method qt_wrt_setViewMode by wrt_viewMode property. + + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + (QWebPage::event): + * Api/qwebpage_p.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::wrt_viewModes): + +2010-04-28 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] WINS DEF file freeze + + Updated WINSCW def file with added and removed symbols. + + * symbian/bwins/QtWebKitu.def: + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): Add call to initializeMainThread. + +2010-04-26 Thiago Macieira <thiago.macieira@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix the include header <qstring.h> -> <QtCore/qstring.h> + + The module/header.h style inclusion removes the need to have -I$QTDIR/include/depending-module + in the include search path for the application. + + * Api/qwebkitversion.h: + +2010-04-26 Bruno Schmidt <bruno.schmidt@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Exposing an QVariantMap containing QObjectStar to Javascript + causes Segmentation Fault + https://bugs.webkit.org/show_bug.cgi?id=34729 + + If an QVariantMap containing QObjectStar is added to the to QtWebkit + Javascript, it's use causes Segmentation Fault. + It happens because, in the case QMetaType::QVariantMap, the "root" + object that is inside of a PassRefPtr is passed recursively inside a + loop to recover the content of the map, but the PassRefPtr semantics + prohibit its use inside a loop, so the "root" object mus be passed + using the method "PassRefPtr::get" in order to keep the current + reference. + + * tests/qwebframe/tst_qwebframe.cpp: + (MyQObject::MyQObject): new property variantMapProperty + (MyQObject::variantMapProperty): read variantMapProperty + (MyQObject::setVariantMapProperty): write variantMapProperty + +2010-04-25 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Simon Hausmann. + + [Qt] layoutTestController.counterValueForElementById crashes for a nonexistent ID + https://bugs.webkit.org/show_bug.cgi?id=34573 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::counterValueForElementById): + +2010-04-20 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Add more support for textInputController + + Add support for selectedRange(), setMarkedText(), insertText(), + and firstRectForCharacterRange(). + + https://bugs.webkit.org/show_bug.cgi?id=35702 + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::selectedRange): + (DumpRenderTreeSupportQt::firstRectForCharacterRange): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2010-04-22 John Pavan <john.pavan@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] inputMethodQuery returns coordinates in web page coordinates rather than in item coordinates. + https://bugs.webkit.org/show_bug.cgi?id=37163 + + + QWebPage::inputMethodQuery is modified so that it + returns coordinates in the widget's coordinate system. + Tests are added for QGraphicsWebView and QWebView + to verify that this behavior is correct after the webpage + has been scrolled. + + * Api/qwebpage.cpp: + (QWebPage::inputMethodQuery): + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::microFocusCoordinates): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::microFocusCoordinates): + +2010-04-22 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Fix createPlugin() tests in tst_qwebpage to match behaviour of Qt plugins + when PluginsEnabled is false. + + tst_qwebpage should have been updated as part of r56662. + (See https://bugs.webkit.org/show_bug.cgi?id=32196) + + Updated documentation of QWebPage::createPlugin and QWebSetting::pluginsEnabled + to match the new behaviour. + + * Api/qwebpage.cpp: Update docs. + * Api/qwebsettings.cpp: Update docs. + * tests/qwebpage/tst_qwebpage.cpp: + (createPlugin): + (tst_QWebPage::createPluginWithPluginsEnabled): + (tst_QWebPage::createPluginWithPluginsDisabled): + +2010-04-22 Dave Moore <davemoore@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added notification when the favicons for a page are changed + from a script. + The Document object will notify the frame loader, which will + notify the client. Implementations of FrameLoaderClient will + have to add one method; dispatchDidChangeIcons(). + + https://bugs.webkit.org/show_bug.cgi?id=33812 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidChangeIcons): + (WebCore::FrameLoaderClientQt::didChangeTitle): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-04-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove translatable strings from the hybridPixmap test. + https://bugs.webkit.org/show_bug.cgi?id=37867 + + * tests/hybridPixmap/widget.ui: + +2010-04-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix autotests .qrc file paths when built in Qt. + + Compiling auto-tests from qt/tests/auto/qweb* produced + failing tests since these .pro files include the + ones in WebKit/qt/tests and the .qrc file was + not added to RESOURCES + + * tests/benchmarks/loading/loading.pro: + * tests/benchmarks/painting/painting.pro: + * tests/qgraphicswebview/qgraphicswebview.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebinspector/qwebinspector.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + * tests/qwebview/qwebview.pro: + * tests/tests.pri: + +2010-04-22 Adam Barth <abarth@webkit.org> + + Unreviewed, rolling out r58069. + http://trac.webkit.org/changeset/58069 + https://bugs.webkit.org/show_bug.cgi?id=27751 + + Broke compile on Windows. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-04-22 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-04-21 Jesus Sanchez-Palencia <jesus@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Add PageClientQWidget implementation based on the old + QWebPageWidgetClient to PageClientQt files. Also fix + QWebPage::setView() to use PageClientQWidget. + + [Qt] PageClientQt specific implementation for QWidget + https://bugs.webkit.org/show_bug.cgi?id=37858 + + * Api/qwebpage.cpp: + (QWebPage::setView): + * WebCoreSupport/PageClientQt.cpp: Added. + (WebCore::PageClientQWidget::scroll): + (WebCore::PageClientQWidget::update): + (WebCore::PageClientQWidget::setInputMethodEnabled): + (WebCore::PageClientQWidget::inputMethodEnabled): + (WebCore::PageClientQWidget::setInputMethodHint): + (WebCore::PageClientQWidget::cursor): + (WebCore::PageClientQWidget::updateCursor): + (WebCore::PageClientQWidget::palette): + (WebCore::PageClientQWidget::screenNumber): + (WebCore::PageClientQWidget::ownerWidget): + (WebCore::PageClientQWidget::geometryRelativeToOwnerWidget): + (WebCore::PageClientQWidget::pluginParent): + (WebCore::PageClientQWidget::style): + * WebCoreSupport/PageClientQt.h: Added. + (WebCore::PageClientQWidget::PageClientQWidget): + (WebCore::PageClientQWidget::isQWidgetClient): + 2010-04-21 Jakub Wieczorek <jwieczorek@webkit.org> Reviewed by Darin Adler. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 5ea072d..cf100f7 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -167,8 +167,12 @@ Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, cons if (!newPage) return 0; + // A call to QWebPage::mainFrame() implicitly creates the main frame. + // Make sure it exists, as WebCore expects it when returning from this call. + QWebFrame* mainFrame = newPage->mainFrame(); + if (!request.isEmpty()) - newPage->mainFrame()->load(request.resourceRequest().url()); + mainFrame->load(request.resourceRequest().url()); return newPage->d->page; } diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 3f2e221..935be85 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -44,6 +44,7 @@ #if ENABLE(SVG) #include "SVGSMILElement.h" #endif +#include "TextIterator.h" #include "WorkerThread.h" #include "qwebframe.h" @@ -102,30 +103,36 @@ QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page) return page->handle()->page->groupName(); } -#if ENABLE(INSPECTOR) void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script) { +#if ENABLE(INSPECTOR) if (!page->handle()->page->inspectorController()) return; page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script); +#endif } void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page) { +#if ENABLE(INSPECTOR) if (!page->handle()->page->inspectorController()) return; page->handle()->page->inspectorController()->close(); +#endif } void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page) { +#if ENABLE(INSPECTOR) if (!page->handle()->page->inspectorController()) return; page->handle()->page->inspectorController()->show(); +#endif } void DumpRenderTreeSupportQt::setTimelineProfilingEnabled(QWebPage* page, bool enabled) { +#if ENABLE(INSPECTOR) InspectorController* controller = page->handle()->page->inspectorController(); if (!controller) return; @@ -133,9 +140,8 @@ void DumpRenderTreeSupportQt::setTimelineProfilingEnabled(QWebPage* page, bool e controller->startTimelineProfiler(); else controller->stopTimelineProfiler(); -} - #endif +} bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame) { @@ -264,8 +270,8 @@ QString DumpRenderTreeSupportQt::counterValueForElementById(QWebFrame* frame, co { Frame* coreFrame = QWebFramePrivate::core(frame); if (Document* document = coreFrame->document()) { - Element* element = document->getElementById(id); - return WebCore::counterValueForElement(element); + if (Element* element = document->getElementById(id)) + return WebCore::counterValueForElement(element); } return QString(); } @@ -341,7 +347,7 @@ void DumpRenderTreeSupportQt::setMediaType(QWebFrame* frame, const QString& type WebCore::FrameView* view = coreFrame->view(); view->setMediaType(type); coreFrame->document()->updateStyleSelector(); - view->forceLayout(); + view->layout(); } void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled) @@ -370,3 +376,129 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt { return WebCore::markerTextForListItem(listItem.m_element); } + +QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page) +{ + WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); + QVariantList selectedRange; + RefPtr<Range> range = frame->selection()->toNormalizedRange().get(); + + Element* selectionRoot = frame->selection()->rootEditableElement(); + Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement(); + + RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); + ASSERT(testRange->startContainer() == scope); + int startPosition = TextIterator::rangeLength(testRange.get()); + + ExceptionCode ec; + testRange->setEnd(range->endContainer(), range->endOffset(), ec); + ASSERT(testRange->startContainer() == scope); + int endPosition = TextIterator::rangeLength(testRange.get()); + + selectedRange << startPosition << (endPosition - startPosition); + + return selectedRange; + +} + +QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, int location, int length) +{ + WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); + QVariantList rect; + + if ((location + length < location) && (location + length != 0)) + length = 0; + + Element* selectionRoot = frame->selection()->rootEditableElement(); + Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement(); + RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(scope, location, length); + + if (!range) + return QVariantList(); + + QRect resultRect = frame->firstRectForRange(range.get()); + rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height(); + return rect; +} + +// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release + +void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame) +{ + DumpRenderTreeSupportQt::resumeActiveDOMObjects(frame); +} + +void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* frame) +{ + DumpRenderTreeSupportQt::suspendActiveDOMObjects(frame); +} + +void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* frame) +{ + DumpRenderTreeSupportQt::clearFrameName(frame); +} + +void QWEBKIT_EXPORT qt_drt_garbageCollector_collect() +{ + DumpRenderTreeSupportQt::garbageCollectorCollect(); +} + +void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone) +{ + DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone); +} + +int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount() +{ + return DumpRenderTreeSupportQt::javaScriptObjectsCount(); +} + +int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame* frame) +{ + return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame); +} + +void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories() +{ + DumpRenderTreeSupportQt::overwritePluginDirectories(); +} + +bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame* frame, const QString& animationName, double time, const QString& elementId) +{ + return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId); +} + +bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame* frame, const QString& propertyName, double time, const QString &elementId) +{ + return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId); +} + +void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists() +{ + DumpRenderTreeSupportQt::resetOriginAccessWhiteLists(); +} + +void QWEBKIT_EXPORT qt_drt_run(bool b) +{ + DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b); +} + +void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled) +{ + DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(frame, enabled); +} + +void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +{ + DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) +{ + return DumpRenderTreeSupportQt::webPageGroupName(page); +} + +void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName) +{ + DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName); +} diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index b92b86a..c0187df 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -24,6 +24,7 @@ #define DumpRenderTreeSupportQt_h #include "qwebkitglobal.h" +#include <QVariant> #include "qwebelement.h" @@ -42,6 +43,8 @@ public: static bool isCommandEnabled(QWebPage* page, const QString& name); static void setSmartInsertDeleteEnabled(QWebPage* page, bool enabled); static void setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled); + static QVariantList selectedRange(QWebPage* page); + static QVariantList firstRectForCharacterRange(QWebPage* page, int location, int length); static bool pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId); static bool pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index f93b1cc..a0b06fb 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -258,7 +258,7 @@ void FrameLoaderClientQt::forceLayout() { FrameView* view = m_frame->view(); if (view) - view->forceLayout(true); + view->layout(true); } @@ -381,6 +381,19 @@ void FrameLoaderClientQt::dispatchDidReceiveTitle(const String& title) } +void FrameLoaderClientQt::dispatchDidChangeIcons() +{ + if (dumpFrameLoaderCallbacks) + printf("%s - didChangeIcons\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); + + if (!m_webFrame) + return; + + // FIXME: To be notified of changing icon URLS add notification + // emit iconsChanged(); +} + + void FrameLoaderClientQt::dispatchDidCommitLoad() { if (dumpFrameLoaderCallbacks) @@ -525,7 +538,7 @@ void FrameLoaderClientQt::willChangeTitle(DocumentLoader*) } -void FrameLoaderClientQt::didChangeTitle(DocumentLoader *) +void FrameLoaderClientQt::didChangeTitle(DocumentLoader*) { // no need for, dispatchDidReceiveTitle is the right callback } diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 2756871..9c968a0 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -109,6 +109,7 @@ namespace WebCore { virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); virtual void dispatchDidReceiveTitle(const String& title); + virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const ResourceError&); virtual void dispatchDidFailLoad(const WebCore::ResourceError&); @@ -127,6 +128,7 @@ namespace WebCore { virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { } virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>); virtual void dispatchDidLoadMainResource(DocumentLoader*); diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 7fabbda..a3dd9dd 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -88,12 +88,13 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); inspectorView->setPage(inspectorPage); - QUrl inspectorUrl = m_inspectedWebPage->settings()->inspectorUrl(); + QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector(); + QUrl inspectorUrl = inspector->property("_q_inspectorUrl").toUrl(); if (!inspectorUrl.isValid()) inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html"); inspectorView->page()->mainFrame()->load(inspectorUrl); m_inspectedWebPage->d->inspectorFrontend = inspectorView; - m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(inspectorView); + inspector->d->setFrontend(inspectorView); inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView)); } diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp new file mode 100644 index 0000000..611bab7 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#include "PageClientQt.h" + +#if defined(Q_WS_X11) +#include <QX11Info> +#endif + +namespace WebCore { + +void PageClientQWidget::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void PageClientQWidget::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +void PageClientQWidget::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} + +bool PageClientQWidget::inputMethodEnabled() const +{ + return view->testAttribute(Qt::WA_InputMethodEnabled); +} + +#if QT_VERSION >= 0x040600 +void PageClientQWidget::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif + +#ifndef QT_NO_CURSOR +QCursor PageClientQWidget::cursor() const +{ + return view->cursor(); +} + +void PageClientQWidget::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} +#endif + +QPalette PageClientQWidget::palette() const +{ + return view->palette(); +} + +int PageClientQWidget::screenNumber() const +{ +#if defined(Q_WS_X11) + return view->x11Info().screen(); +#endif + return 0; +} + +QWidget* PageClientQWidget::ownerWidget() const +{ + return view; +} + +QRect PageClientQWidget::geometryRelativeToOwnerWidget() const +{ + return view->geometry(); +} + +QObject* PageClientQWidget::pluginParent() const +{ + return view; +} + +QStyle* PageClientQWidget::style() const +{ + return view->style(); +} + +} diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h new file mode 100644 index 0000000..3f09564 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PageClientQt_h +#define PageClientQt_h + +#include "QWebPageClient.h" + +#include <QtGui/qwidget.h> + + +namespace WebCore { + +class PageClientQWidget : public QWebPageClient { +public: + PageClientQWidget(QWidget* view) + : view(view) + { + Q_ASSERT(view); + } + + virtual bool isQWidgetClient() const { return true; } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); + virtual bool inputMethodEnabled() const; +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif + +#ifndef QT_NO_CURSOR + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); +#endif + + virtual QPalette palette() const; + virtual int screenNumber() const; + virtual QWidget* ownerWidget() const; + virtual QRect geometryRelativeToOwnerWidget() const; + + virtual QObject* pluginParent() const; + + virtual QStyle* style() const; + + QWidget* view; +}; + +} +#endif // PageClientQt diff --git a/WebKit/qt/qtwebkit_version.pri b/WebKit/qt/qtwebkit_version.pri new file mode 100644 index 0000000..1656f2d --- /dev/null +++ b/WebKit/qt/qtwebkit_version.pri @@ -0,0 +1,4 @@ +QT_WEBKIT_VERSION = 4.8.0 +QT_WEBKIT_MAJOR_VERSION = 4 +QT_WEBKIT_MINOR_VERSION = 8 +QT_WEBKIT_PATCH_VERSION = 0 diff --git a/WebKit/qt/symbian/bwins/QtWebKitu.def b/WebKit/qt/symbian/bwins/QtWebKitu.def index 086e986..729b97c 100644 --- a/WebKit/qt/symbian/bwins/QtWebKitu.def +++ b/WebKit/qt/symbian/bwins/QtWebKitu.def @@ -623,5 +623,30 @@ EXPORTS ?qt_networkAccessAllowed@@YAX_N@Z @ 622 NONAME ; void qt_networkAccessAllowed(bool) ?qt_resumeActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 623 NONAME ; void qt_resumeActiveDOMObjects(class QWebFrame *) ?qt_suspendActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 624 NONAME ; void qt_suspendActiveDOMObjects(class QWebFrame *) - ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) + ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ABSENT ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) + ?closeEvent@QWebInspector@@MAEXPAVQCloseEvent@@@Z @ 626 NONAME ; void QWebInspector::closeEvent(class QCloseEvent *) + ?inspectorUrl@QWebSettings@@QBE?AVQUrl@@XZ @ 627 NONAME ABSENT ; class QUrl QWebSettings::inspectorUrl(void) const + ?isTiledBackingStoreFrozen@QGraphicsWebView@@QBE_NXZ @ 628 NONAME ; bool QGraphicsWebView::isTiledBackingStoreFrozen(void) const + ?pageChanged@QWebFrame@@IAEXXZ @ 629 NONAME ; void QWebFrame::pageChanged(void) + ?qt_drt_enableCaretBrowsing@@YAXPAVQWebPage@@_N@Z @ 630 NONAME ; void qt_drt_enableCaretBrowsing(class QWebPage *, bool) + ?qt_drt_evaluateScriptInIsolatedWorld@@YAXPAVQWebFrame@@HABVQString@@@Z @ 631 NONAME ; void qt_drt_evaluateScriptInIsolatedWorld(class QWebFrame *, int, class QString const &) + ?qt_drt_hasDocumentElement@@YA_NPAVQWebFrame@@@Z @ 632 NONAME ; bool qt_drt_hasDocumentElement(class QWebFrame *) + ?qt_drt_numberOfPages@@YAHPAVQWebFrame@@MM@Z @ 633 NONAME ; int qt_drt_numberOfPages(class QWebFrame *, float, float) + ?qt_drt_pageNumberForElementById@@YAHPAVQWebFrame@@ABVQString@@MM@Z @ 634 NONAME ; int qt_drt_pageNumberForElementById(class QWebFrame *, class QString const &, float, float) + ?qt_drt_pauseSVGAnimation@@YA_NPAVQWebFrame@@ABVQString@@N1@Z @ 635 NONAME ; bool qt_drt_pauseSVGAnimation(class QWebFrame *, class QString const &, double, class QString const &) + ?qt_drt_setDomainRelaxationForbiddenForURLScheme@@YAX_NABVQString@@@Z @ 636 NONAME ; void qt_drt_setDomainRelaxationForbiddenForURLScheme(bool, class QString const &) + ?qt_drt_setFrameFlatteningEnabled@@YAXPAVQWebPage@@_N@Z @ 637 NONAME ; void qt_drt_setFrameFlatteningEnabled(class QWebPage *, bool) + ?qt_drt_setMediaType@@YAXPAVQWebFrame@@ABVQString@@@Z @ 638 NONAME ; void qt_drt_setMediaType(class QWebFrame *, class QString const &) + ?qt_drt_setTimelineProfilingEnabled@@YAXPAVQWebPage@@_N@Z @ 639 NONAME ; void qt_drt_setTimelineProfilingEnabled(class QWebPage *, bool) + ?qt_drt_webinspector_close@@YAXPAVQWebPage@@@Z @ 640 NONAME ; void qt_drt_webinspector_close(class QWebPage *) + ?qt_drt_webinspector_executeScript@@YAXPAVQWebPage@@JABVQString@@@Z @ 641 NONAME ; void qt_drt_webinspector_executeScript(class QWebPage *, long, class QString const &) + ?qt_drt_webinspector_show@@YAXPAVQWebPage@@@Z @ 642 NONAME ; void qt_drt_webinspector_show(class QWebPage *) + ?qt_drt_workerThreadCount@@YAHXZ @ 643 NONAME ; int qt_drt_workerThreadCount(void) + ?qt_wrt_setViewMode@@YAXPAVQWebPage@@ABVQString@@@Z @ 644 NONAME ; void qt_wrt_setViewMode(class QWebPage *, class QString const &) + ?qtwebkit_webframe_scrollRecursively@@YAXPAVQWebFrame@@HHABVQPoint@@@Z @ 645 NONAME ; void qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int, class QPoint const &) + ?resizesToContents@QGraphicsWebView@@QBE_NXZ @ 646 NONAME ; bool QGraphicsWebView::resizesToContents(void) const + ?scrollToAnchor@QWebFrame@@QAEXABVQString@@@Z @ 647 NONAME ; void QWebFrame::scrollToAnchor(class QString const &) + ?setInspectorUrl@QWebSettings@@QAEXABVQUrl@@@Z @ 648 NONAME ABSENT ; void QWebSettings::setInspectorUrl(class QUrl const &) + ?setResizesToContents@QGraphicsWebView@@QAEX_N@Z @ 649 NONAME ; void QGraphicsWebView::setResizesToContents(bool) + ?setTiledBackingStoreFrozen@QGraphicsWebView@@QAEX_N@Z @ 650 NONAME ; void QGraphicsWebView::setTiledBackingStoreFrozen(bool) diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index 145fe0b..6ccaaa7 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -650,7 +650,7 @@ EXPORTS _ZlsR11QDataStreamRK11QWebHistory @ 649 NONAME _ZrsR11QDataStreamR11QWebHistory @ 650 NONAME _Z32qt_drt_whiteListAccessFromOriginRK7QStringS1_S1_b @ 651 NONAME - _Z33qt_drt_counterValueForElementByIdP9QWebFrameRK7QString @ 652 NONAME + _Z33qt_drt_counterValueForElementByIdP9QWebFrameRK7QString @ 652 NONAME ABSENT _Z34qt_drt_resetOriginAccessWhiteListsv @ 653 NONAME _ZN11QWebElement17removeAllChildrenEv @ 654 NONAME _ZN11QWebElement6renderEP8QPainter @ 655 NONAME @@ -698,25 +698,25 @@ EXPORTS _ZN9QWebFrame17scrollRecursivelyEii @ 697 NONAME ABSENT _ZN16QGraphicsWebView20setResizesToContentsEb @ 698 NONAME _ZNK16QGraphicsWebView17resizesToContentsEv @ 699 NONAME - _Z20qt_drt_numberOfPagesP9QWebFrameff @ 700 NONAME - _Z24qt_drt_pauseSVGAnimationP9QWebFrameRK7QStringdS3_ @ 701 NONAME - _Z24qt_drt_webinspector_showP8QWebPage @ 702 NONAME - _Z24qt_drt_workerThreadCountv @ 703 NONAME - _Z25qt_drt_hasDocumentElementP9QWebFrame @ 704 NONAME - _Z25qt_drt_webinspector_closeP8QWebPage @ 705 NONAME - _Z31qt_drt_pageNumberForElementByIdP9QWebFrameRK7QStringff @ 706 NONAME - _Z33qt_drt_webinspector_executeScriptP8QWebPagelRK7QString @ 707 NONAME - _Z34qt_drt_setTimelineProfilingEnabledP8QWebPageb @ 708 NONAME - _Z32qt_drt_setFrameFlatteningEnabledP8QWebPageb @ 709 NONAME - _Z36qt_drt_evaluateScriptInIsolatedWorldP9QWebFrameiRK7QString @ 710 NONAME - _Z47qt_drt_setDomainRelaxationForbiddenForURLSchemebRK7QString @ 711 NONAME + _Z20qt_drt_numberOfPagesP9QWebFrameff @ 700 NONAME ABSENT + _Z24qt_drt_pauseSVGAnimationP9QWebFrameRK7QStringdS3_ @ 701 NONAME ABSENT + _Z24qt_drt_webinspector_showP8QWebPage @ 702 NONAME ABSENT + _Z24qt_drt_workerThreadCountv @ 703 NONAME ABSENT + _Z25qt_drt_hasDocumentElementP9QWebFrame @ 704 NONAME ABSENT + _Z25qt_drt_webinspector_closeP8QWebPage @ 705 NONAME ABSENT + _Z31qt_drt_pageNumberForElementByIdP9QWebFrameRK7QStringff @ 706 NONAME ABSENT + _Z33qt_drt_webinspector_executeScriptP8QWebPagelRK7QString @ 707 NONAME ABSENT + _Z34qt_drt_setTimelineProfilingEnabledP8QWebPageb @ 708 NONAME ABSENT + _Z32qt_drt_setFrameFlatteningEnabledP8QWebPageb @ 709 NONAME ABSENT + _Z36qt_drt_evaluateScriptInIsolatedWorldP9QWebFrameiRK7QString @ 710 NONAME ABSENT + _Z47qt_drt_setDomainRelaxationForbiddenForURLSchemebRK7QString @ 711 NONAME ABSENT _ZN9QWebFrame11pageChangedEv @ 712 NONAME _ZN9QWebFrame14scrollToAnchorERK7QString @ 713 NONAME - _ZN12QWebSettings15setInspectorUrlERK4QUrl @ 714 NONAME + _ZN12QWebSettings15setInspectorUrlERK4QUrl @ 714 NONAME ABSENT _ZN13QWebInspector10closeEventEP11QCloseEvent @ 715 NONAME _ZN16QGraphicsWebView26setTiledBackingStoreFrozenEb @ 716 NONAME _ZNK16QGraphicsWebView25isTiledBackingStoreFrozenEv @ 717 NONAME - _Z18qt_wrt_setViewModeP8QWebPageRK7QString @ 718 NONAME - _Z19qt_drt_setMediaTypeP9QWebFrameRK7QString @ 719 NONAME - _Z26qt_drt_enableCaretBrowsingP8QWebPageb @ 720 NONAME - _ZNK12QWebSettings12inspectorUrlEv @ 721 NONAME + _Z18qt_wrt_setViewModeP8QWebPageRK7QString @ 718 NONAME ABSENT + _Z19qt_drt_setMediaTypeP9QWebFrameRK7QString @ 719 NONAME ABSENT + _Z26qt_drt_enableCaretBrowsingP8QWebPageb @ 720 NONAME ABSENT + _ZNK12QWebSettings12inspectorUrlEv @ 721 NONAME ABSENT diff --git a/WebKit/qt/tests/benchmarks/loading/loading.pro b/WebKit/qt/tests/benchmarks/loading/loading.pro index 024211f..99c64a5 100644 --- a/WebKit/qt/tests/benchmarks/loading/loading.pro +++ b/WebKit/qt/tests/benchmarks/loading/loading.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../../.. include(../../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/benchmarks/painting/painting.pro b/WebKit/qt/tests/benchmarks/painting/painting.pro index b4fc56a..99c64a5 100644 --- a/WebKit/qt/tests/benchmarks/painting/painting.pro +++ b/WebKit/qt/tests/benchmarks/painting/painting.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../../.. -include(../../tests.pri)
\ No newline at end of file +include(../../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/hybridPixmap/widget.ui b/WebKit/qt/tests/hybridPixmap/widget.ui index 4f2b3b8..272d6a7 100644 --- a/WebKit/qt/tests/hybridPixmap/widget.ui +++ b/WebKit/qt/tests/hybridPixmap/widget.ui @@ -11,14 +11,14 @@ </rect> </property> <property name="windowTitle"> - <string>Widget</string> + <string notr="true">Widget</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="WebView" name="webView" native="true"> <property name="url" stdset="0"> <url> - <string>about:blank</string> + <string notr="true">about:blank</string> </url> </property> </widget> @@ -28,7 +28,7 @@ <item> <widget class="QLabel" name="lbl1"> <property name="text"> - <string/> + <string notr="true"/> </property> </widget> </item> @@ -47,21 +47,21 @@ </size> </property> <property name="text"> - <string>Image from Qt to HTML</string> + <string notr="true">Image from Qt to HTML</string> </property> </widget> </item> <item> <widget class="QLabel" name="lbl3"> <property name="text"> - <string>Pixmap from Qt to HTML</string> + <string notr="true">Pixmap from Qt to HTML</string> </property> </widget> </item> <item> <widget class="QLabel" name="lbl4"> <property name="text"> - <string/> + <string notr="true"/> </property> </widget> </item> diff --git a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro index d056014..e915d60 100644 --- a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro +++ b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. -include(../tests.pri)
\ No newline at end of file +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index 657e09f..14f5820 100644 --- a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -31,6 +31,7 @@ class tst_QGraphicsWebView : public QObject private slots: void qgraphicswebview(); void crashOnViewlessWebPages(); + void microFocusCoordinates(); }; void tst_QGraphicsWebView::qgraphicswebview() @@ -102,6 +103,40 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages() QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); } +void tst_QGraphicsWebView::microFocusCoordinates() +{ + QWebPage* page = new QWebPage; + QGraphicsWebView* webView = new QGraphicsWebView; + webView->setPage( page ); + QGraphicsView* view = new QGraphicsView; + QGraphicsScene* scene = new QGraphicsScene(view); + view->setScene(scene); + scene->addItem(webView); + view->setGeometry(QRect(0,0,500,500)); + + page->mainFrame()->setHtml("<html><body>" \ + "<input type='text' id='input1' style='font--family: serif' value='' maxlength='20'/><br>" \ + "<canvas id='canvas1' width='500' height='500'/>" \ + "<input type='password'/><br>" \ + "<canvas id='canvas2' width='500' height='500'/>" \ + "</body></html>"); + + page->mainFrame()->setFocus(); + + QVariant initialMicroFocus = page->inputMethodQuery(Qt::ImMicroFocus); + QVERIFY(initialMicroFocus.isValid()); + + page->mainFrame()->scroll(0,300); + + QVariant currentMicroFocus = page->inputMethodQuery(Qt::ImMicroFocus); + QVERIFY(currentMicroFocus.isValid()); + + QCOMPARE(initialMicroFocus.toRect().translated(QPoint(0,-300)), currentMicroFocus.toRect()); + + delete view; +} + + QTEST_MAIN(tst_QGraphicsWebView) #include "tst_qgraphicswebview.moc" diff --git a/WebKit/qt/tests/qwebelement/qwebelement.pro b/WebKit/qt/tests/qwebelement/qwebelement.pro index d056014..e915d60 100644 --- a/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. -include(../tests.pri)
\ No newline at end of file +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebframe/qwebframe.pro b/WebKit/qt/tests/qwebframe/qwebframe.pro index d056014..e915d60 100644 --- a/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. -include(../tests.pri)
\ No newline at end of file +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 5f5a2f2..bea7a67 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -57,6 +57,7 @@ class MyQObject : public QObject Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty) Q_PROPERTY(QVariantList variantListProperty READ variantListProperty WRITE setVariantListProperty) + Q_PROPERTY(QVariantMap variantMapProperty READ variantMapProperty WRITE setVariantMapProperty) Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) Q_PROPERTY(QStringList stringListProperty READ stringListProperty WRITE setStringListProperty) Q_PROPERTY(QByteArray byteArrayProperty READ byteArrayProperty WRITE setByteArrayProperty) @@ -106,7 +107,12 @@ public: m_writeOnlyValue(789), m_readOnlyValue(987), m_objectStar(0), - m_qtFunctionInvoked(-1) { } + m_qtFunctionInvoked(-1) + { + m_variantMapValue.insert("a", QVariant(123)); + m_variantMapValue.insert("b", QVariant(QLatin1String("foo"))); + m_variantMapValue.insert("c", QVariant::fromValue<QObject*>(this)); + } ~MyQObject() { } @@ -131,6 +137,13 @@ public: m_variantListValue = value; } + QVariantMap variantMapProperty() const { + return m_variantMapValue; + } + void setVariantMapProperty(const QVariantMap &value) { + m_variantMapValue = value; + } + QString stringProperty() const { return m_stringValue; } @@ -483,6 +496,7 @@ private: int m_intValue; QVariant m_variantValue; QVariantList m_variantListValue; + QVariantMap m_variantMapValue; QString m_stringValue; QStringList m_stringListValue; QByteArray m_byteArrayValue; @@ -759,6 +773,21 @@ void tst_QWebFrame::getSetStaticProperty() { QString type; + QVariant ret = evalJSV("myObject.variantMapProperty", type); + QCOMPARE(type, sObject); + QCOMPARE(ret.type(), QVariant::Map); + QVariantMap vm = ret.value<QVariantMap>(); + QCOMPARE(vm.size(), 3); + QCOMPARE(vm.value("a").toInt(), 123); + QCOMPARE(vm.value("b").toString(), QLatin1String("foo")); + QCOMPARE(vm.value("c").value<QObject*>(), m_myObject); + } + QCOMPARE(evalJS("myObject.variantMapProperty.a === 123"), sTrue); + QCOMPARE(evalJS("myObject.variantMapProperty.b === 'foo'"), sTrue); + QCOMPARE(evalJS("myObject.variantMapProperty.c.variantMapProperty.b === 'foo'"), sTrue); + + { + QString type; QVariant ret = evalJSV("myObject.stringListProperty", type); QCOMPARE(type, sArray); QCOMPARE(ret.type(), QVariant::List); diff --git a/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/WebKit/qt/tests/qwebhistory/qwebhistory.pro index d056014..e915d60 100644 --- a/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. -include(../tests.pri)
\ No newline at end of file +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index d056014..e915d60 100644 --- a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. -include(../tests.pri)
\ No newline at end of file +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp b/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp index 435cada..84b12d2 100644 --- a/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp +++ b/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp @@ -23,6 +23,7 @@ #include <qwebpage.h> #include <qwebview.h> #include <qwebframe.h> +#include <qwebelement.h> #include <qwebhistoryinterface.h> #include <QDebug> @@ -85,9 +86,10 @@ public: void tst_QWebHistoryInterface::visitedLinks() { QWebHistoryInterface::setDefaultInterface(new FakeHistoryImplementation); - m_view->setHtml("<html><body><a href='http://www.trolltech.com'>Trolltech</a></body></html>"); - QCOMPARE(m_page->mainFrame()->evaluateJavaScript("document.querySelectorAll(':visited').length;").toString(), - QString::fromLatin1("1")); + m_view->setHtml("<html><style>:link{color:green}:visited{color:red}</style><body><a href='http://www.trolltech.com' id='vlink'>Trolltech</a></body></html>"); + QWebElement anchor = m_view->page()->mainFrame()->findFirstElement("a[id=vlink]"); + QString linkColor = anchor.styleProperty("color", QWebElement::ComputedStyle); + QCOMPARE(linkColor, QString::fromLatin1("rgb(255, 0, 0)")); } QTEST_MAIN(tst_QWebHistoryInterface) diff --git a/WebKit/qt/tests/qwebinspector/qwebinspector.pro b/WebKit/qt/tests/qwebinspector/qwebinspector.pro index ac51929..e915d60 100644 --- a/WebKit/qt/tests/qwebinspector/qwebinspector.pro +++ b/WebKit/qt/tests/qwebinspector/qwebinspector.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebpage/qwebpage.pro b/WebKit/qt/tests/qwebpage/qwebpage.pro index d056014..e915d60 100644 --- a/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. -include(../tests.pri)
\ No newline at end of file +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index c857b00..795216d 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -24,6 +24,7 @@ #include <QDir> #include <QGraphicsWidget> #include <QLineEdit> +#include <QLocale> #include <QMenu> #include <QPushButton> #include <QtTest/QtTest> @@ -81,7 +82,8 @@ private slots: void modified(); void contextMenuCrash(); void database(); - void createPlugin(); + void createPluginWithPluginsEnabled(); + void createPluginWithPluginsDisabled(); void destroyPlugin_data(); void destroyPlugin(); void createViewlessPlugin_data(); @@ -106,6 +108,10 @@ private slots: void errorPageExtension(); void errorPageExtensionInIFrames(); void errorPageExtensionInFrameset(); + void userAgentApplicationName(); + void userAgentLocaleChange(); + + void viewModes(); void crashTests_LazyInitializationOfMainFrame(); @@ -354,6 +360,21 @@ void tst_QWebPage::userStyleSheet() QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png")); } +void tst_QWebPage::viewModes() +{ + m_view->setHtml("<body></body>"); + m_page->setProperty("_q_viewMode", "minimized"); + + QVariant empty = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode)\")"); + QVERIFY(empty.type() == QVariant::Bool && empty.toBool()); + + QVariant minimized = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode: minimized)\")"); + QVERIFY(minimized.type() == QVariant::Bool && minimized.toBool()); + + QVariant maximized = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode: maximized)\")"); + QVERIFY(maximized.type() == QVariant::Bool && !maximized.toBool()); +} + void tst_QWebPage::modified() { m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>blub")); @@ -519,27 +540,20 @@ protected: } }; -void tst_QWebPage::createPlugin() +static void createPlugin(QWebView *view) { - QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool))); + QSignalSpy loadSpy(view, SIGNAL(loadFinished(bool))); - PluginPage* newPage = new PluginPage(m_view); - m_view->setPage(newPage); + PluginPage* newPage = new PluginPage(view); + view->setPage(newPage); - // plugins not enabled by default, so the plugin shouldn't be loaded - m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>")); + // type has to be application/x-qt-plugin + view->setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='pushbutton' id='mybutton'/></body></html>")); QTRY_COMPARE(loadSpy.count(), 1); QCOMPARE(newPage->calls.count(), 0); - m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true); - - // type has to be application/x-qt-plugin - m_view->setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='pushbutton' id='mybutton'/></body></html>")); + view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>")); QTRY_COMPARE(loadSpy.count(), 2); - QCOMPARE(newPage->calls.count(), 0); - - m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>")); - QTRY_COMPARE(loadSpy.count(), 3); QCOMPARE(newPage->calls.count(), 1); { PluginPage::CallInfo ci = newPage->calls.takeFirst(); @@ -570,11 +584,11 @@ void tst_QWebPage::createPlugin() QCOMPARE(newPage->mainFrame()->evaluateJavaScript("mybutton.clicked.toString()").toString(), QString::fromLatin1("function clicked() {\n [native code]\n}")); - m_view->setHtml(QString("<html><body><table>" + view->setHtml(QString("<html><body><table>" "<tr><object type='application/x-qt-plugin' classid='lineedit' id='myedit'/></tr>" "<tr><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></tr>" "</table></body></html>"), QUrl("http://foo.bar.baz")); - QTRY_COMPARE(loadSpy.count(), 4); + QTRY_COMPARE(loadSpy.count(), 3); QCOMPARE(newPage->calls.count(), 2); { PluginPage::CallInfo ci = newPage->calls.takeFirst(); @@ -606,14 +620,22 @@ void tst_QWebPage::createPlugin() QVERIFY(ci.returnValue != 0); QVERIFY(ci.returnValue->inherits("QPushButton")); } +} - m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, false); - - m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>")); - QTRY_COMPARE(loadSpy.count(), 5); - QCOMPARE(newPage->calls.count(), 0); +void tst_QWebPage::createPluginWithPluginsEnabled() +{ + m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + createPlugin(m_view); } +void tst_QWebPage::createPluginWithPluginsDisabled() +{ + // Qt Plugins should be loaded by QtWebKit even when PluginsEnabled is + // false. The client decides whether a Qt plugin is enabled or not when + // it decides whether or not to instantiate it. + m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, false); + createPlugin(m_view); +} // Standard base class for template PluginTracerPage. In tests it is used as interface. class PluginCounterPage : public QWebPage { @@ -1404,11 +1426,16 @@ void tst_QWebPage::inputMethods() QString selectionValue = variant.value<QString>(); QCOMPARE(selectionValue, QString("eb")); - //Set selection with negative length - inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant()); + //Cancel current composition first + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant()); QInputMethodEvent eventSelection2("",inputAttributes); page->event(&eventSelection2); + //Set selection with negative length + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant()); + QInputMethodEvent eventSelection3("",inputAttributes); + page->event(&eventSelection3); + //ImAnchorPosition variant = page->inputMethodQuery(Qt::ImAnchorPosition); anchorPosition = variant.toInt(); @@ -1741,6 +1768,38 @@ void tst_QWebPage::errorPageExtensionInFrameset() m_view->setPage(0); } +class FriendlyWebPage : public QWebPage +{ +public: + friend class tst_QWebPage; +}; + +void tst_QWebPage::userAgentApplicationName() +{ + const QString oldApplicationName = QCoreApplication::applicationName(); + FriendlyWebPage page; + + const QString applicationNameMarker = QString::fromUtf8("StrangeName\342\210\236"); + QCoreApplication::setApplicationName(applicationNameMarker); + QVERIFY(page.userAgentForUrl(QUrl()).contains(applicationNameMarker)); + + QCoreApplication::setApplicationName(oldApplicationName); +} + +void tst_QWebPage::userAgentLocaleChange() +{ + FriendlyWebPage page; + m_view->setPage(&page); + + const QString markerString = QString::fromLatin1(" nn-NO)"); + + if (page.userAgentForUrl(QUrl()).contains(markerString)) + QSKIP("marker string already present", SkipSingle); + + m_view->setLocale(QLocale(QString::fromLatin1("nn_NO"))); + QVERIFY(page.userAgentForUrl(QUrl()).contains(markerString)); +} + void tst_QWebPage::crashTests_LazyInitializationOfMainFrame() { { diff --git a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index ac51929..e915d60 100644 --- a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -1,2 +1,3 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebview/qwebview.pro b/WebKit/qt/tests/qwebview/qwebview.pro index 4ca2bf6..e915d60 100644 --- a/WebKit/qt/tests/qwebview/qwebview.pro +++ b/WebKit/qt/tests/qwebview/qwebview.pro @@ -1 +1,3 @@ -include(../tests.pri)
\ No newline at end of file +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. +include(../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp index ebcf4bb..100399e 100644 --- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -48,6 +48,7 @@ private slots: void reusePage_data(); void reusePage(); + void microFocusCoordinates(); void crashTests(); }; @@ -203,6 +204,31 @@ void tst_QWebView::crashTests() QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed. } +void tst_QWebView::microFocusCoordinates() +{ + QWebPage* page = new QWebPage; + QWebView* webView = new QWebView; + webView->setPage( page ); + + page->mainFrame()->setHtml("<html><body>" \ + "<input type='text' id='input1' style='font--family: serif' value='' maxlength='20'/><br>" \ + "<canvas id='canvas1' width='500' height='500'/>" \ + "<input type='password'/><br>" \ + "<canvas id='canvas2' width='500' height='500'/>" \ + "</body></html>"); + + page->mainFrame()->setFocus(); + + QVariant initialMicroFocus = page->inputMethodQuery(Qt::ImMicroFocus); + QVERIFY(initialMicroFocus.isValid()); + + page->mainFrame()->scroll(0,50); + + QVariant currentMicroFocus = page->inputMethodQuery(Qt::ImMicroFocus); + QVERIFY(currentMicroFocus.isValid()); + + QCOMPARE(initialMicroFocus.toRect().translated(QPoint(0,-50)), currentMicroFocus.toRect()); +} QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/WebKit/qt/tests/tests.pri b/WebKit/qt/tests/tests.pri index 0bdf6f6..525e662 100644 --- a/WebKit/qt/tests/tests.pri +++ b/WebKit/qt/tests/tests.pri @@ -2,14 +2,13 @@ TEMPLATE = app CONFIG -= app_bundle VPATH += $$_PRO_FILE_PWD_ +# Add the tst_ prefix, In QTDIR_build it's done by qttest_p4.prf !CONFIG(QTDIR_build):TARGET = tst_$$TARGET SOURCES += $${TARGET}.cpp INCLUDEPATH += \ $$PWD \ $$PWD/../Api -exists($$_PRO_FILE_PWD_/$${TARGET}.qrc):RESOURCES += $$_PRO_FILE_PWD_/$${TARGET}.qrc - include(../../../WebKit.pri) QT += testlib network |