diff options
Diffstat (limited to 'WebKit/qt')
-rw-r--r-- | WebKit/qt/Api/qwebdatabase.h | 2 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe.cpp | 145 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe.h | 3 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe_p.h | 1 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage.cpp | 141 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage.h | 3 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage_p.h | 3 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsecurityorigin.h | 2 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsettings.cpp | 35 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsettings.h | 6 | ||||
-rw-r--r-- | WebKit/qt/ChangeLog | 479 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 3 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 44 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 7 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 6 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/InspectorClientQt.h | 2 | ||||
-rw-r--r-- | WebKit/qt/WebKit_pch.h | 2 | ||||
-rw-r--r-- | WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 95 | ||||
-rw-r--r-- | WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 11 |
19 files changed, 854 insertions, 136 deletions
diff --git a/WebKit/qt/Api/qwebdatabase.h b/WebKit/qt/Api/qwebdatabase.h index f4c368a..4e832bb 100644 --- a/WebKit/qt/Api/qwebdatabase.h +++ b/WebKit/qt/Api/qwebdatabase.h @@ -26,7 +26,7 @@ namespace WebCore { class DatabaseDetails; -}; +} class QWebDatabasePrivate; class QWebSecurityOrigin; diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 4e82d54..725a880 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2008,2009 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2007 Staikos Computing Services Inc. This library is free software; you can redistribute it and/or @@ -106,6 +106,63 @@ void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* qframe, bool controller->disableProfiler(); } +// Pause a given CSS animation or transition on the target node at a specific time. +// If the animation or transition is already paused, it will update its pause time. +// This method is only intended to be used for testing the CSS animation and transition system. +bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame *qframe, const QString &animationName, double time, const QString &elementId) +{ + Frame* frame = QWebFramePrivate::core(qframe); + if (!frame) + return false; + + AnimationController* controller = frame->animation(); + if (!controller) + return false; + + Document* doc = frame->document(); + Q_ASSERT(doc); + + Node* coreNode = doc->getElementById(elementId); + if (!coreNode || !coreNode->renderer()) + return false; + + return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time); +} + +bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame *qframe, const QString &propertyName, double time, const QString &elementId) +{ + Frame* frame = QWebFramePrivate::core(qframe); + if (!frame) + return false; + + AnimationController* controller = frame->animation(); + if (!controller) + return false; + + Document* doc = frame->document(); + Q_ASSERT(doc); + + Node* coreNode = doc->getElementById(elementId); + if (!coreNode || !coreNode->renderer()) + return false; + + return controller->pauseTransitionAtTime(coreNode->renderer(), propertyName, time); +} + +// Returns the total number of currently running animations (includes both CSS transitions and CSS animations). +int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame *qframe) +{ + Frame* frame = QWebFramePrivate::core(qframe); + if (!frame) + return false; + + AnimationController* controller = frame->animation(); + if (!controller) + return false; + + return controller->numberOfActiveAnimations(); +} + void QWebFramePrivate::init(QWebFrame *qframe, WebCore::Page *webcorePage, QWebFrameData *frameData) { q = qframe; @@ -224,7 +281,7 @@ QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData) if (!frameData->url.isEmpty()) { WebCore::ResourceRequest request(frameData->url, frameData->referrer); - d->frame->loader()->load(request, frameData->name); + d->frame->loader()->load(request, frameData->name, false); } } @@ -255,24 +312,48 @@ QWebFrame::~QWebFrame() If you want to ensure that your QObjects remain accessible after loading a new URL, you should add them in a slot connected to the javaScriptWindowObjectCleared() signal. + + The \a object will never be explicitly deleted by QtWebKit. */ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object) { - JSC::JSLock lock(false); - JSDOMWindow *window = toJSDOMWindow(d->frame); - JSC::Bindings::RootObject *root = d->frame->script()->bindingRootObject(); - if (!window) { - qDebug() << "Warning: couldn't get window object"; - return; - } + addToJavaScriptWindowObject(name, object, QScriptEngine::QtOwnership); +} + +/*! + \fn void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership own) + \overload + + Make \a object available under \a name from within the frame's JavaScript + context. The \a object will be inserted as a child of the frame's window + object. + + Qt properties will be exposed as JavaScript properties and slots as + JavaScript methods. + + If you want to ensure that your QObjects remain accessible after loading a + new URL, you should add them in a slot connected to the + javaScriptWindowObjectCleared() signal. + + The ownership of \a object is specified using \a own. +*/ +void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership) +{ + JSC::JSLock lock(false); + JSDOMWindow* window = toJSDOMWindow(d->frame); + JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject(); + if (!window) { + qDebug() << "Warning: couldn't get window object"; + return; + } - JSC::ExecState* exec = window->globalExec(); + JSC::ExecState* exec = window->globalExec(); - JSC::JSObject *runtimeObject = - JSC::Bindings::QtInstance::getQtInstance(object, root)->createRuntimeObject(exec); + JSC::JSObject* runtimeObject = + JSC::Bindings::QtInstance::getQtInstance(object, root, ownership)->createRuntimeObject(exec); - JSC::PutPropertySlot slot; - window->put(exec, JSC::Identifier(exec, (const UChar *) name.constData(), name.length()), runtimeObject, slot); + JSC::PutPropertySlot slot; + window->put(exec, JSC::Identifier(exec, (const UChar *) name.constData(), name.length()), runtimeObject, slot); } /*! @@ -475,7 +556,7 @@ void QWebFrame::load(const QWebNetworkRequest &req) if (!postData.isEmpty()) request.setHTTPBody(WebCore::FormData::create(postData.constData(), postData.size())); - d->frame->loader()->load(request); + d->frame->loader()->load(request, false); if (d->parentFrame()) d->page->d->insideOpenCall = false; @@ -531,7 +612,7 @@ void QWebFrame::load(const QNetworkRequest &req, if (!body.isEmpty()) request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size())); - d->frame->loader()->load(request); + d->frame->loader()->load(request, false); if (d->parentFrame()) d->page->d->insideOpenCall = false; @@ -556,7 +637,7 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) const QByteArray utf8 = html.toUtf8(); WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), kurl); - d->frame->loader()->load(request, substituteData); + d->frame->loader()->load(request, substituteData, false); } /*! @@ -577,7 +658,7 @@ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, cons if (actualMimeType.isEmpty()) actualMimeType = QLatin1String("text/html"); WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), kurl); - d->frame->loader()->load(request, substituteData); + d->frame->loader()->load(request, substituteData, false); } @@ -886,7 +967,7 @@ QWebHitTestResult QWebFrame::hitTestContent(const QPoint &pos) const if (!d->frame->view() || !d->frame->contentRenderer()) return QWebHitTestResult(); - HitTestResult result = d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos), /*allowShadowContent*/ false); + HitTestResult result = d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos), /*allowShadowContent*/ false, /*ignoreClipping*/ true); return QWebHitTestResult(new QWebHitTestResultPrivate(result)); } @@ -905,6 +986,10 @@ bool QWebFrame::event(QEvent *e) */ void QWebFrame::print(QPrinter *printer) const { + QPainter painter; + if (!painter.begin(printer)) + return; + const qreal zoomFactorX = printer->logicalDpiX() / qt_defaultDpi(); const qreal zoomFactorY = printer->logicalDpiY() / qt_defaultDpi(); @@ -950,7 +1035,6 @@ void QWebFrame::print(QPrinter *printer) const ascending = false; } - QPainter painter(printer); painter.scale(zoomFactorX, zoomFactorY); GraphicsContext ctx(&painter); @@ -988,7 +1072,8 @@ void QWebFrame::print(QPrinter *printer) const #endif // QT_NO_PRINTER /*! - Evaluate JavaScript defined by \a scriptSource using this frame as context. + Evaluates the JavaScript defined by \a scriptSource using this frame as context + and returns the result of the last executed statement. \sa addToJavaScriptWindowObject(), javaScriptWindowObjectCleared() */ @@ -1135,6 +1220,9 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult WebCore::Frame *wframe = hitTest.targetFrame(); if (wframe) linkTargetFrame = QWebFramePrivate::kit(wframe); + Element* urlElement = hitTest.URLElement(); + if (urlElement) + linkTarget = urlElement->target(); isContentEditable = hitTest.isContentEditable(); isContentSelected = hitTest.isSelected(); @@ -1279,7 +1367,22 @@ QUrl QWebHitTestResult::linkTitle() const } /*! + \since 4.6 + Returns the name of the target frame that will load the link if it is activated. + + \sa linkTargetFrame +*/ +QString QWebHitTestResult::linkTarget() const +{ + if (!d) + return 0; + return d->linkTarget; +} + +/*! Returns the frame that will load the link if it is activated. + + \sa linkTarget */ QWebFrame *QWebHitTestResult::linkTargetFrame() const { diff --git a/WebKit/qt/Api/qwebframe.h b/WebKit/qt/Api/qwebframe.h index e53e2b5..d0fa193 100644 --- a/WebKit/qt/Api/qwebframe.h +++ b/WebKit/qt/Api/qwebframe.h @@ -25,6 +25,7 @@ #include <QtCore/qurl.h> #include <QtCore/qvariant.h> #include <QtGui/qicon.h> +#include <QtScript/qscriptengine.h> #if QT_VERSION >= 0x040400 #include <QtNetwork/qnetworkaccessmanager.h> #endif @@ -77,6 +78,7 @@ public: QUrl linkUrl() const; QUrl linkTitle() const; QWebFrame *linkTargetFrame() const; + QString linkTarget() const; QString alternateText() const; // for img, area, input and applet @@ -129,6 +131,7 @@ public: void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); void addToJavaScriptWindowObject(const QString &name, QObject *object); + void addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership); QString toHtml() const; QString toPlainText() const; QString renderTreeDump() const; diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index 30f94cf..c541cd3 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -107,6 +107,7 @@ public: QUrl linkUrl; QString linkTitle; QPointer<QWebFrame> linkTargetFrame; + QString linkTarget; QString alternateText; QUrl imageUrl; QPixmap pixmap; diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index df40fa6..ed94489 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -64,6 +64,7 @@ #include "HitTestResult.h" #include "WindowFeatures.h" #include "LocalizedStrings.h" +#include "Cache.h" #include "runtime/InitializeThreading.h" #include <QApplication> @@ -429,6 +430,14 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked) q->triggerAction(action, checked); } +#ifndef NDEBUG +void QWebPagePrivate::_q_cleanupLeakMessages() +{ + // Need this to make leak messages accurate. + cache()->setCapacities(0, 0, 0); +} +#endif + void QWebPagePrivate::updateAction(QWebPage::WebAction action) { QAction *a = actions[action]; @@ -454,60 +463,35 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) case QWebPage::Reload: enabled = !loader->isLoading(); break; - case QWebPage::Cut: - enabled = editor->canCut(); - break; - case QWebPage::Copy: - enabled = editor->canCopy(); - break; - case QWebPage::Paste: - enabled = editor->canPaste(); - break; #ifndef QT_NO_UNDOSTACK case QWebPage::Undo: case QWebPage::Redo: // those two are handled by QUndoStack break; #endif // QT_NO_UNDOSTACK - case QWebPage::MoveToNextChar: - case QWebPage::MoveToPreviousChar: - case QWebPage::MoveToNextWord: - case QWebPage::MoveToPreviousWord: - case QWebPage::MoveToNextLine: - case QWebPage::MoveToPreviousLine: - case QWebPage::MoveToStartOfLine: - case QWebPage::MoveToEndOfLine: - case QWebPage::MoveToStartOfBlock: - case QWebPage::MoveToEndOfBlock: - case QWebPage::MoveToStartOfDocument: - case QWebPage::MoveToEndOfDocument: - case QWebPage::SelectNextChar: - case QWebPage::SelectPreviousChar: - case QWebPage::SelectNextWord: - case QWebPage::SelectPreviousWord: - case QWebPage::SelectNextLine: - case QWebPage::SelectPreviousLine: - case QWebPage::SelectStartOfLine: - case QWebPage::SelectEndOfLine: - case QWebPage::SelectStartOfBlock: - case QWebPage::SelectEndOfBlock: - case QWebPage::SelectStartOfDocument: - case QWebPage::SelectEndOfDocument: - case QWebPage::DeleteStartOfWord: - case QWebPage::DeleteEndOfWord: + case QWebPage::SelectAll: // editor command is always enabled + break; case QWebPage::SetTextDirectionDefault: case QWebPage::SetTextDirectionLeftToRight: case QWebPage::SetTextDirectionRightToLeft: - case QWebPage::ToggleBold: - case QWebPage::ToggleItalic: - case QWebPage::ToggleUnderline: - enabled = editor->canEditRichly(); - if (enabled) - checked = editor->command(editorCommandForWebActions(action)).state() != FalseTriState; - else - checked = false; + enabled = editor->canEdit(); + checked = false; + break; + default: { + // see if it's an editor command + const char* commandName = editorCommandForWebActions(action); + + // if it's an editor command, let it's logic determine state + if (commandName) { + Editor::Command command = editor->command(commandName); + enabled = command.isEnabled(); + if (enabled) + checked = command.state() != FalseTriState; + else + checked = false; + } break; - default: break; + } } a->setEnabled(enabled); @@ -561,6 +545,8 @@ void QWebPagePrivate::updateEditorActions() updateAction(QWebPage::ToggleBold); updateAction(QWebPage::ToggleItalic); updateAction(QWebPage::ToggleUnderline); + updateAction(QWebPage::InsertParagraphSeparator); + updateAction(QWebPage::InsertLineSeparator); } void QWebPagePrivate::timerEvent(QTimerEvent *ev) @@ -1052,9 +1038,9 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const case Qt::ImCursorPosition: { Frame *frame = d->page->focusController()->focusedFrame(); if (frame) { - Selection selection = frame->selection()->selection(); + VisibleSelection selection = frame->selection()->selection(); if (selection.isCaret()) { - return QVariant(selection.start().offset()); + return QVariant(selection.start().m_offset); } } return QVariant(); @@ -1119,8 +1105,13 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const \enum QWebPage::WebAction This enum describes the types of action which can be performed on the web page. - Actions which are related to text editing, cursor movement, and text selection - only have an effect if \l contentEditable is true. + + Actions only have an effect when they are applicable. The availability of + actions can be be determined by checking \l{QAction::}{enabled()} on the + action returned by \l{QWebPage::}{action()}. + + One method of enabling the text editing, cursor movement, and text selection actions + is by setting \l contentEditable to true. \value NoWebAction No action is triggered. \value OpenLink Open the current link. @@ -1251,6 +1242,9 @@ QWebPage::QWebPage(QObject *parent) setView(qobject_cast<QWidget *>(parent)); connect(this, SIGNAL(loadProgress(int)), this, SLOT(_q_onLoadProgressChanged(int))); +#ifndef NDEBUG + connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(_q_cleanupLeakMessages())); +#endif } /*! @@ -1340,7 +1334,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { #ifndef QT_NO_MESSAGEBOX - QMessageBox::information(d->view, mainFrame()->title(), msg, QMessageBox::Ok); + QMessageBox::information(d->view, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok); #endif } @@ -1355,7 +1349,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) #ifdef QT_NO_MESSAGEBOX return true; #else - return QMessageBox::Yes == QMessageBox::information(d->view, mainFrame()->title(), msg, QMessageBox::Yes, QMessageBox::No); + return QMessageBox::Yes == QMessageBox::information(d->view, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Yes, QMessageBox::No); #endif } @@ -1372,7 +1366,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr { bool ok = false; #ifndef QT_NO_INPUTDIALOG - QString x = QInputDialog::getText(d->view, mainFrame()->title(), msg, QLineEdit::Normal, defaultValue, &ok); + QString x = QInputDialog::getText(d->view, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok); if (ok && result) { *result = x; } @@ -1471,9 +1465,16 @@ void QWebPage::triggerAction(WebAction action, bool checked) openNewWindow(url, frame); break; } - case CopyLinkToClipboard: + case CopyLinkToClipboard: { +#if defined(Q_WS_X11) + bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); + Pasteboard::generalPasteboard()->setSelectionMode(true); + editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText()); + Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); +#endif editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText()); break; + } case OpenImageInNewWindow: openNewWindow(d->hitTestResult.imageUrl(), frame); break; @@ -1550,7 +1551,7 @@ 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)); - frame->d->frame->forceLayout(); + view->forceLayout(); view->adjustViewSize(); } } @@ -1580,7 +1581,7 @@ void QWebPage::setFixedLayoutSize(const QSize &size) const if (frame->d->frame && frame->d->frame->view()) { WebCore::FrameView* view = frame->d->frame->view(); view->setFixedLayoutSize(size); - frame->d->frame->forceLayout(); + view->forceLayout(); } } @@ -1602,7 +1603,7 @@ void QWebPage::setUseFixedLayout(bool useFixedLayout) if (frame->d->frame && frame->d->frame->view()) { WebCore::FrameView* view = frame->d->frame->view(); view->setUseFixedLayout(useFixedLayout); - frame->d->frame->forceLayout(); + view->forceLayout(); } } @@ -1632,7 +1633,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkReques return true; case DelegateExternalLinks: - if (WebCore::FrameLoader::shouldTreatSchemeAsLocal(request.url().scheme())) + if (WebCore::FrameLoader::shouldTreatURLSchemeAsLocal(request.url().scheme())) return true; emit linkClicked(request.url()); return false; @@ -1790,6 +1791,9 @@ QAction *QWebPage::action(WebAction action) const case MoveToEndOfDocument: text = tr("Move the cursor to the end of the document"); break; + case SelectAll: + text = tr("Select all"); + break; case SelectNextChar: text = tr("Select to the next character"); break; @@ -1862,6 +1866,13 @@ QAction *QWebPage::action(WebAction action) const text = contextMenuItemTagInspectElement(); break; + case InsertParagraphSeparator: + text = tr("Insert a new paragraph"); + break; + case InsertLineSeparator: + text = tr("Insert a new line"); + break; + case NoWebAction: return 0; } @@ -2389,7 +2400,8 @@ QWebPluginFactory *QWebPage::pluginFactory() const \list \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system. \o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true. - \o %Locale% is replaced with QLocale::name(). + \o %Locale% is replaced with QLocale::name(). The locale is determined from the view of the QWebPage. If no view is set on the QWebPage, + then a default constructed QLocale is used instead. \o %WebKitVersion% currently expands to 527+ \o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. \endlist @@ -2577,7 +2589,7 @@ void QWebPagePrivate::_q_onLoadProgressChanged(int) { \sa bytesReceived() */ quint64 QWebPage::totalBytes() const { - return d->m_bytesReceived; + return d->m_totalBytes; } @@ -2587,7 +2599,7 @@ quint64 QWebPage::totalBytes() const { \sa totalBytes() */ quint64 QWebPage::bytesReceived() const { - return d->m_totalBytes; + return d->m_bytesReceived; } /*! @@ -2621,10 +2633,13 @@ quint64 QWebPage::bytesReceived() const { /*! \fn void QWebPage::linkHovered(const QString &link, const QString &title, const QString &textContent) - This signal is emitted when the mouse is hovering over a link. - The first parameter is the \a link url, the second is the link \a title - if any, and third \a textContent is the text content. Method is emitter with both - empty parameters when the mouse isn't hovering over any link element. + This signal is emitted when the mouse hovers over a link. + + \a link contains the link url. + \a title is the link element's title, if it is specified in the markup. + \a textContent provides text within the link element, e.g., text inside an HTML anchor tag. + + When the mouse leaves the link element the signal is emitted with empty parameters. \sa linkClicked() */ diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index 2bbbc2a..2853fcc 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -325,6 +325,9 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int)) Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked)) +#ifndef NDEBUG + Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages()) +#endif QWebPagePrivate *d; friend class QWebFrame; diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index fd915a2..a897bf1 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -79,6 +79,9 @@ public: void _q_onLoadProgressChanged(int); void _q_webActionTriggered(bool checked); +#ifndef NDEBUG + void _q_cleanupLeakMessages(); +#endif void updateAction(QWebPage::WebAction action); void updateNavigationActions(); void updateEditorActions(); diff --git a/WebKit/qt/Api/qwebsecurityorigin.h b/WebKit/qt/Api/qwebsecurityorigin.h index ebe4a77..b52194d 100644 --- a/WebKit/qt/Api/qwebsecurityorigin.h +++ b/WebKit/qt/Api/qwebsecurityorigin.h @@ -28,7 +28,7 @@ namespace WebCore { class SecurityOrigin; class ChromeClientQt; -}; +} class QWebSecurityOriginPrivate; class QWebDatabase; diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index 42baf93..f6acc42 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -183,6 +183,10 @@ void QWebSettingsPrivate::apply() value = attributes.value(QWebSettings::LocalStorageDatabaseEnabled, global->attributes.value(QWebSettings::LocalStorageDatabaseEnabled)); settings->setLocalStorageEnabled(value); + + value = attributes.value(QWebSettings::AllowUniversalAccessFromFileUrls, + global->attributes.value(QWebSettings::AllowUniversalAccessFromFileUrls)); + settings->setAllowUniversalAccessFromFileURLs(value); } else { QList<QWebSettingsPrivate *> settings = *::allSettings(); for (int i = 0; i < settings.count(); ++i) @@ -236,10 +240,6 @@ QWebSettings *QWebSettings::globalSettings() setOfflineStoragePath() with an appropriate file path, and can limit the quota for each application by calling setOfflineStorageDefaultQuota(). - The performance of Web applications can be enhanced with the use of an - offline cache. This can be enabled by calling setOfflineWebApplicationCache() - with an appropriate file path. - \sa QWebPage::settings(), QWebView::settings(), {Browser} */ @@ -292,8 +292,7 @@ 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. - Currently Flash and other plugins are not supported. + \value PluginsEnabled Enables or disables plugins in Web pages. \value PrivateBrowsingEnabled Private browsing prevents WebKit from recording visited pages in the history and storing web page icons. \value JavascriptCanOpenWindows Specifies whether JavaScript programs @@ -315,6 +314,8 @@ QWebSettings *QWebSettings::globalSettings() web application cache feature is enabled or not. \value LocalStorageDatabaseEnabled Specifies whether support for the HTML 5 local storage feature is enabled or not. + \value AllowUniversalAccessFromFileUrls Specifies whether documents from file + Urls should be granted universal access (e.g., to HTTP and HTTPS documents). */ /*! @@ -343,6 +344,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, true); d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, true); d->attributes.insert(QWebSettings::LocalStorageDatabaseEnabled, true); + d->attributes.insert(QWebSettings::AllowUniversalAccessFromFileUrls, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; } @@ -710,9 +712,10 @@ qint64 QWebSettings::offlineStorageDefaultQuota() return QWebSettings::globalSettings()->d->offlineStorageDefaultQuota; } -/*! - \since 4.5 - +/* + \internal + \relates QWebSettings + Sets the path for HTML5 offline web application cache storage to \a path. \a path must point to an existing directory where the cache is stored. @@ -721,22 +724,23 @@ qint64 QWebSettings::offlineStorageDefaultQuota() \sa offlineWebApplicationCachePath() */ -void QWebSettings::setOfflineWebApplicationCachePath(const QString& path) +void QWEBKIT_EXPORT qt_websettings_setOfflineWebApplicationCachePath(const QString& path) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) WebCore::cacheStorage().setCacheDirectory(path); #endif } -/*! - \since 4.5 - +/* + \internal + \relates QWebSettings + Returns the path of the HTML5 offline web application cache storage or an empty string if the feature is disabled. \sa setOfflineWebApplicationCachePath() */ -QString QWebSettings::offlineWebApplicationCachePath() +QString QWEBKIT_EXPORT qt_websettings_offlineWebApplicationCachePath() { #if ENABLE(OFFLINE_WEB_APPLICATIONS) return WebCore::cacheStorage().cacheDirectory(); @@ -747,6 +751,7 @@ QString QWebSettings::offlineWebApplicationCachePath() /* \since 4.5 + \relates QWebSettings Sets the path for HTML5 local storage databases to \a path. @@ -756,7 +761,6 @@ QString QWebSettings::offlineWebApplicationCachePath() \sa localStorageDatabasePath() */ - void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path) { QWebSettingsPrivate *d = settings->handle(); @@ -766,6 +770,7 @@ void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* set /* \since 4.5 + \relates QWebSettings Returns the path for HTML5 local storage databases or an empty string if the feature is disabled. diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index 4251fbb..5610797 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -63,7 +63,8 @@ public: PrintElementBackgrounds, OfflineStorageDatabaseEnabled, OfflineWebApplicationCacheEnabled, - LocalStorageDatabaseEnabled + LocalStorageDatabaseEnabled, + AllowUniversalAccessFromFileUrls }; enum WebGraphic { MissingImageGraphic, @@ -112,9 +113,6 @@ public: static void setOfflineStorageDefaultQuota(qint64 maximumSize); static qint64 offlineStorageDefaultQuota(); - static void setOfflineWebApplicationCachePath(const QString& path); - static QString offlineWebApplicationCachePath(); - inline QWebSettingsPrivate* handle() const { return d; } private: diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 04575c9..ba6d3ae 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,8 +1,355 @@ -2009-02-03 Mark Rowe <mrowe@apple.com> +2009-03-26 Simon Hausmann <simon.hausmann@nokia.com> - Merge r40508. + Rubber-stamped by Tor Arne Vestbø. + + Fix the documentation of the QLocale usage in userAgentForUrl. + + * Api/qwebpage.cpp: + +2009-03-20 Erik L. Bunce <elbunce@xendom.com> + + Reviewed by Simon Hausmann. + + Fix for InsertParagraphSeparator and InsertLineSeparator so that + QWebPage::action() creates QActions for them. Also make sure they get + updated appropriately. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateEditorActions): + (QWebPage::action): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textEditing): + +2009-03-20 Erik L. Bunce <elbunce@xendom.com> + + Reviewed by Tor Arne Vestbø. + + Fix QWebPage::WebActions action states to more closely match when they are + actually applicable and remove erroneous documentation. + + * Most WebActions implemented using editor commands now use the + Editor::Command::isEnabled() to control their availability. + * SelectAll is always enabled (since it's editor command is). + * SetTextDirection{} family of WebActions are available when canEdit() is true + and not just canEditRichly(). + + Fix and clarify documentation about the availability of various web actions. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + (QWebPagePrivate::updateEditorActions): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textSelection): + +2009-03-19 Ariya Hidayat <ariya.hidayat@trolltech.com> + + Reviewed by Simon Hausmann. + + Fixes pedantic compilation in QtWebKit. + + There are no semi-colons after namespace declarations. + + * Api/qwebdatabase.h: + * Api/qwebsecurityorigin.h: + +2009-03-19 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Doc: Removed obsolete warning about Flash and other plugins. + + * Api/qwebsettings.cpp: + +2009-03-19 Paul Olav Tvete <paul.tvete@nokia.com> + + Reviewed by Simon Hausmann. + + Properly escape tooltip text + + ManualTest: http://xkcd.com/554/ + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::setToolTip): + +2009-03-10 Adam Treat <adam.treat@torchmobile.com> + + Build fix for Qt after r41555. + + * Api/qwebpage.cpp: + (QWebPage::acceptNavigationRequest): + +2009-03-10 Xan Lopez <xlopez@igalia.com> + + Build fix, no review. + + * Api/qwebpage.cpp: + (QWebPage::inputMethodQuery): + +2009-03-07 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by Cameron Zwarich. + + These methods are clearly returning the wrong values as the two were + returning swapped information. + + * Api/qwebpage.cpp: + (QWebPage::totalBytes): + (QWebPage::bytesReceived): + +2009-03-05 Ariya Hidayat <ariya.hidayat@nokia.com> + + Rubber-stamped by Simon Hausmann. + + [Qt] NPAPI plugins are supported, adjust the API documentation. + + * Api/qwebsettings.cpp: + +2009-03-04 Adam Barth <abath@webkit.org> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=24356 + + Fix WebKit style for allowUniversalAccessFromFileURLs. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): - 2009-02-02 Geoffrey Garen <ggaren@apple.com> +2009-03-03 Adam Barth <abarth@webkit.org> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=24340 + + Expose AllowUniversalAccessFromFileUrls to Qt clients. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + +2009-03-03 Ariya Hidayat <ariya.hidayat@trolltech.com> + + Rubber-stamped by Simon Hausmann. + + [Qt] Create and update the action for SelectAll. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + (QWebPagePrivate::updateEditorActions): + (QWebPage::action): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textSelection): + +2009-03-02 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by Eric Seidel. + + Add three new drt helper functions that enable all of the tests in + LayoutTests/animation/* and LayoutTests/transitions/* to now pass. + + * Api/qwebframe.cpp: + (qt_drt_pauseAnimation): + (qt_drt_pauseTransitionOfProperty): + (qt_drt_numberOfActiveAnimations): + +2009-03-02 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=21230 + On X11 match the behavior of Firefox and also copy the url to the + clipboard selection when the action Copy Link Location is executed. + + * Api/qwebpage.cpp: + (QWebPage::triggerAction): + +2009-02-25 Kavindra Palaraja <kavindra.palaraja@nokia.com> + + Reviewed by Simon Hausmann. + + Fix the documentation for the linkHovered signal. + + * Api/qwebpage.cpp: + +2009-02-23 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=24094 + Make sure to empty the cache on exit to get rid of superfluous leak messages + for CachedResource's in order to keep the leak messages accurate. This + is analagous to what the Mac port is doing on application exit when all + WebView's have been closed. + + * Api/qwebpage.cpp: + (QWebPagePrivate::_q_cleanupLeakMessages): + (QWebPage::QWebPage): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + +2009-02-23 Thiago Macieira <thiago.macieira@nokia.com> + + Reviewed by Simon Hausmann. + + Fix the Copyright notices in a few files + + * WebKit_pch.h: + +2009-02-16 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Avoid loading plugins when they're disabled in the settings. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::canShowMIMEType): Don't call into the + PluginDatabase if plugins are disabled in the settings. + +2009-02-13 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by Nikolas Zimmermann. + + https://bugs.webkit.org/show_bug.cgi?id=23738 + Expose the url elements target frame string. This is the sister function + to the existing linkTargetFrame which returns the QWebFrame*. When the + linkTargetFrame is 0 it is useful to know what the target was to be. + + * Api/qwebframe.cpp: + (QWebHitTestResultPrivate::QWebHitTestResultPrivate): + (QWebHitTestResult::linkTarget): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + * tests/qwebframe/tst_qwebframe.cpp: + +2009-02-13 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Removed documentation for internal functions. + + * Api/qwebsettings.cpp: + +2009-02-13 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + Corrected some minor qdoc errors. + + * Api/qwebsettings.cpp: + +2009-02-11 Dimitri Dupuis-latour <dupuislatour@apple.com> + + Stub out InspectorClientQt::hiddenPanels. + + Reviewed by Timothy Hatcher. + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::hiddenPanels): + * WebCoreSupport/InspectorClientQt.h: + +2009-02-10 Karsten Heimrich <kheimric@trolltech.com> + + Reviewed by Simon Hausmann. + + Fixes missing navigation/url update while clicking on anchor inside + webpage. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidChangeLocationWithinPage): + update and emit in case we navigate inside a webpage + +2009-02-10 Adam Treat <adam.treat@torchmobile.com> + + Fix the Qt build as class Selection is now VisibleSelection. + + * Api/qwebpage.cpp: + (QWebPage::inputMethodQuery): + +2009-02-06 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks): + * WebCoreSupport/FrameLoaderClientQt.h: + +2009-02-06 Kavindra Palaraja <kavindra.palaraja@nokia.com> + + Reviewed by Simon Hausmann. + + Doc - made 2 functions internal as they are not part of the API anymore (and this fixes 2 qdoc warnings) + + * Api/qwebsettings.cpp: + +2009-02-06 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Added an overload of QWebFrame::addToJavaScriptWindowObject that takes a QScriptEngine::ValueOwnership parameter. + + * Api/qwebframe.cpp: + (QWebFrame::addToJavaScriptWindowObject): New overload. + * Api/qwebframe.h: + * tests/qwebframe/tst_qwebframe.cpp: Added unit tests for ownership + models. + +2009-02-06 Aaron Boodman <aa@chromium.org> + + Reviewed by Holger Freyther. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::documentElementAvailable):) + Fix compile error in Qt build introduced by the below change (r40694). + +2009-02-05 Aaron Boodman <aa@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=23708 + Adds documentElementAvailable() callback to FrameLoaderClient. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClient::documentElementAvailable): + Stub out documentElementAvailable(). + * WebCoreSupport/FrameLoaderClientQt.h: + Ditto. + +2009-02-04 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Doc: Documented the return value of the evaluateJavaScript() function. + + * Api/qwebframe.cpp: + +2009-02-03 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Added a unit test to verify the succesful conversion from QByteArray to + JSByteArray and back to QByteArray. + + * tests/qwebframe/tst_qwebframe.cpp: + +2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * Api/qwebframe.cpp: + (QWebFrame::QWebFrame): + (QWebFrame::load): + (QWebFrame::setHtml): + (QWebFrame::setContent): + +2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createFrame): + +2009-02-02 Geoffrey Garen <ggaren@apple.com> Reviewed by Sam Weinig. @@ -15,22 +362,78 @@ (WebCore::FrameLoaderClientQt::createFrame): * WebCoreSupport/FrameLoaderClientQt.h: -2009-02-03 Mark Rowe <mrowe@apple.com> +2009-02-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Update for changes to WebCore. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + (WebCore::FrameLoaderClientQt::createJavaAppletWidget): + * WebCoreSupport/FrameLoaderClientQt.h: + +2009-02-02 Adam Treat <adam.treat@torchmobile.com> - Merge r40436. + Reviewed by Nikolas Zimmermann. + + https://bugs.webkit.org/show_bug.cgi?id=23587 + Refactor HitTestRequest to eliminate all the ugly boolean arguments and + use an enum bitflag instead. Cleanup all the code that constructs the + various HitTestRequests to make the code more readable. + + * Api/qwebframe.cpp: + (QWebFrame::hitTestContent): - 2009-01-30 Geoffrey Garen <ggaren@apple.com> +2009-02-02 Adam Treat <adam.treat@torchmobile.com> + + Fix the Qt build to call forceLayout on the view instead. + + * Api/qwebpage.cpp: + (QWebPage::setFixedLayoutSize): + (QWebPage::setUseFixedLayout): + +2009-02-02 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Darin Adler. + + Move Frame::forceLayout, Frame::adjustPageHeight and Frame::forceLayoutWithPageWidthRange to FrameView + + https://bugs.webkit.org/show_bug.cgi?id=23428 + + FrameView::forceLayout could be killed but the comment might + contain a value over the the plain FrameView::layout... + + Adjust the WebCore/WebKit consumers of these methods. + + * Api/qwebpage.cpp: + (QWebPage::setViewportSize): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::forceLayout): + +2009-01-30 Geoffrey Garen <ggaren@apple.com> Build fix. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createFrame): -2009-02-03 Mark Rowe <mrowe@apple.com> +2009-01-30 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. - Merge r40432. + https://bugs.webkit.org/show_bug.cgi?id=22056 + + Kill FrameLoaderClient.cpp, move the code over to Frame::createView + + FrameLoaderClient is supposed to be an interface, move the + to be shared code to Frame which is a controller and is + allowed to create a FrameView. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage): - 2009-01-30 Geoffrey Garen <ggaren@apple.com> +2009-01-30 Geoffrey Garen <ggaren@apple.com> Reviewed by Sam Weinig. @@ -40,6 +443,64 @@ * Api/qwebpage.cpp: (QWebPage::triggerAction): +2009-01-30 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig + + Remove FrameLoaderClient code that is now handled by FrameLoader itself + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::frameLoadCompleted): + +2009-01-30 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Hide the Offline Web Application Cache path API from the public API + for now. + + * Api/qwebsettings.cpp: + (qt_websettings_setOfflineWebApplicationCachePath): + (qt_websettings_offlineWebApplicationCachePath): + * Api/qwebsettings.h: + +2009-01-28 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by Nikolas Zimmermann and George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=23557 + Do not clip the QWebFrame::hitTestContent method to the visible viewport + and add a regression test to make sure it works. + + * Api/qwebframe.cpp: + (QWebFrame::hitTestContent): + * tests/qwebframe/tst_qwebframe.cpp: + +2009-01-28 Ariya Hidayat <ariya.hidayat@trolltech.com> + + Rubber-stamped by Simon Hausmann. + + Provide default implementations of JavaScript dialog boxes like in + most web browsers, i.e. indicate that is from JavaScript and show the + frame URL. + + * Api/qwebpage.cpp: + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + +2009-01-27 Ariya Hidayat <ariya.hidayat@trolltech.com> + + Reviewed by Simon Hausmann. + + http://www.qtsoftware.com/developer/task-tracker/index_html?id=238391&method=entry + + [Qt] If QPainter fails to start on a QPrinter instance, do not + continue printing. + + * Api/qwebframe.cpp: + (QWebFrame::print): + 2009-01-27 Brady Eidson <beidson@apple.com> Reviewed by Dan Bernstein diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index c545769..fa52d6c 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -47,6 +47,7 @@ #include "qwebsecurityorigin_p.h" #include <qtooltip.h> +#include <qtextdocument.h> namespace WebCore { @@ -373,7 +374,7 @@ void ChromeClientQt::setToolTip(const String &tip) view->setToolTip(QString()); QToolTip::hideText(); } else { - QString dtip = QLatin1String("<p>") + tip + QLatin1String("</p>"); + QString dtip = QLatin1String("<p>") + Qt::escape(tip) + QLatin1String("</p>"); view->setToolTip(dtip); } #else diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index af96201..025bd4f 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -45,11 +45,14 @@ #include "RenderPart.h" #include "ResourceRequest.h" #include "HistoryItem.h" +#include "HTMLAppletElement.h" #include "HTMLFormElement.h" +#include "HTMLPlugInElement.h" #include "NotImplemented.h" #include "QNetworkReplyHandler.h" #include "ResourceHandleInternal.h" #include "ResourceHandle.h" +#include "Settings.h" #include "qwebpage.h" #include "qwebframe.h" @@ -214,12 +217,12 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() QBrush brush = m_webFrame->page()->palette().brush(QPalette::Base); QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor(); - WebCore::FrameLoaderClient::transitionToCommittedForNewPage(m_frame, m_webFrame->page()->viewportSize(), - backgroundColor, !backgroundColor.alpha(), - m_webFrame->page()->fixedLayoutSize(), - m_webFrame->page()->useFixedLayout(), - (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Horizontal), - (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Vertical)); + m_frame->createView(m_webFrame->page()->viewportSize(), + backgroundColor, !backgroundColor.alpha(), + m_webFrame->page()->fixedLayoutSize(), + m_webFrame->page()->useFixedLayout(), + (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Horizontal), + (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Vertical)); } @@ -231,7 +234,9 @@ void FrameLoaderClientQt::makeRepresentation(DocumentLoader*) void FrameLoaderClientQt::forceLayout() { - m_frame->forceLayout(true); + FrameView* view = m_frame->view(); + if (view) + view->forceLayout(true); } @@ -298,7 +303,11 @@ void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage() if (dumpFrameLoaderCallbacks) printf("%s - didChangeLocationWithinPageForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - notImplemented(); + if (!m_webFrame) + return; + + emit m_webFrame->urlChanged(m_webFrame->url()); + m_webFrame->page()->d->updateNavigationActions(); } @@ -508,7 +517,8 @@ bool FrameLoaderClientQt::canShowMIMEType(const String& MIMEType) const if (MIMETypeRegistry::isSupportedNonImageMIMEType(MIMEType)) return true; - if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(MIMEType)) + if (m_frame && m_frame->settings() && m_frame->settings()->arePluginsEnabled() + && PluginDatabase::installedPlugins()->isMIMETypeRegistered(MIMEType)) return true; return false; @@ -530,9 +540,6 @@ String FrameLoaderClientQt::generatedMIMETypeForURLScheme(const String& URLSchem void FrameLoaderClientQt::frameLoadCompleted() { // Note: Can be called multiple times. - // Even if already complete, we might have set a previous item on a frame that - // didn't do any data loading on the past transaction. Make sure to clear these out. - m_frame->loader()->setPreviousHistoryItem(0); } @@ -608,6 +615,11 @@ void FrameLoaderClientQt::windowObjectCleared() emit m_webFrame->javaScriptWindowObjectCleared(); } +void FrameLoaderClientQt::documentElementAvailable() +{ + return; +} + void FrameLoaderClientQt::didPerformFirstNavigation() const { if (m_frame->tree()->parent() || !m_webFrame) @@ -627,7 +639,7 @@ void FrameLoaderClientQt::updateGlobalHistory() history->addHistoryEntry(m_frame->loader()->documentLoader()->urlForHistory().prettyURL()); } -void FrameLoaderClientQt::updateGlobalHistoryForRedirectWithoutHistoryItem() +void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks() { } @@ -971,7 +983,7 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String FrameLoadType loadType = m_frame->loader()->loadType(); FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; - childFrame->loader()->loadURL(frameData.url, frameData.referrer, String(), childLoadType, 0, 0); + childFrame->loader()->loadURL(frameData.url, frameData.referrer, String(), false, childLoadType, 0, 0); // The frame's onload handler may have removed it from the document. if (!childFrame->tree()->parent()) @@ -1060,7 +1072,7 @@ public: } }; -Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames, +Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { // qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType; @@ -1148,7 +1160,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget) m_hasSentResponseToPlugin = false; } -Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, +Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { notImplemented(); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 908d2aa..c49bb62 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -147,7 +147,7 @@ namespace WebCore { virtual void finishedLoading(DocumentLoader*); virtual void updateGlobalHistory(); - virtual void updateGlobalHistoryForRedirectWithoutHistoryItem(); + virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; virtual ResourceError cancelledError(const ResourceRequest&); @@ -187,15 +187,16 @@ namespace WebCore { virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) ; - virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); + virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); virtual void redirectDataToPlugin(Widget* pluginWidget); - virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); + virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); virtual String overrideMediaType() const; virtual void windowObjectCleared(); + virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; virtual void registerForIconNotification(bool); diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 7335280..fe4d43a 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -114,6 +114,12 @@ String InspectorClientQt::localizedStringsURL() return String(); } +String InspectorClientQt::hiddenPanels() +{ + notImplemented(); + return String(); +} + void InspectorClientQt::showWindow() { if (!m_webPage) diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 49c2d56..60ed77a 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -52,6 +52,8 @@ namespace WebCore { virtual String localizedStringsURL(); + virtual String hiddenPanels(); + virtual void showWindow(); virtual void closeWindow(); virtual bool windowVisible(); diff --git a/WebKit/qt/WebKit_pch.h b/WebKit/qt/WebKit_pch.h index 9ef73f6..ae8ec88 100644 --- a/WebKit/qt/WebKit_pch.h +++ b/WebKit/qt/WebKit_pch.h @@ -1,7 +1,7 @@ /* * This file is part of the precompiled header for all of WebKit. * - * Copyright (C) 2007 Trolltech + * Copyright (C) 2009 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 diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 38a3543..d9c97c8 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2008,2009 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 @@ -576,6 +576,9 @@ private slots: void ipv6HostEncoding(); void metaData(); void popupFocus(); + void hitTestContent(); + void jsByteArray(); + void ownership(); private: QString evalJS(const QString&s) { // Convert an undefined return variant to the string "undefined" @@ -2272,5 +2275,95 @@ void tst_QWebFrame::popupFocus() "The input field should have a blinking caret"); } +void tst_QWebFrame::hitTestContent() +{ + QString html("<html><body><p>A paragraph</p><br/><br/><br/><a href=\"about:blank\" target=\"_foo\">link text</a></body></html>"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + frame->setHtml(html); + page.setViewportSize(QSize(200, 0)); //no height so link is not visible + QWebHitTestResult result = frame->hitTestContent(QPoint(10, 100)); + QCOMPARE(result.linkText(), QString("link text")); + QCOMPARE(result.linkTarget(), QString("_foo")); +} + +void tst_QWebFrame::jsByteArray() +{ + QByteArray ba("hello world"); + m_myObject->setByteArrayProperty(ba); + + // read-only property + QCOMPARE(m_myObject->byteArrayProperty(), ba); + QString type; + QVariant v = evalJSV("myObject.byteArrayProperty"); + QCOMPARE(int(v.type()), int(QVariant::ByteArray)); + + QCOMPARE(v.toByteArray(), ba); +} + +void tst_QWebFrame::ownership() +{ + // test ownership + { + QPointer<QObject> ptr = new QObject(); + QVERIFY(ptr != 0); + { + QWebPage page; + QWebFrame* frame = page.mainFrame(); + frame->addToJavaScriptWindowObject("test", ptr, QScriptEngine::ScriptOwnership); + } + QVERIFY(ptr == 0); + } + { + QPointer<QObject> ptr = new QObject(); + QVERIFY(ptr != 0); + QObject* before = ptr; + { + QWebPage page; + QWebFrame* frame = page.mainFrame(); + frame->addToJavaScriptWindowObject("test", ptr, QScriptEngine::QtOwnership); + } + QVERIFY(ptr == before); + delete ptr; + } + { + QObject* parent = new QObject(); + QObject* child = new QObject(parent); + QWebPage page; + QWebFrame* frame = page.mainFrame(); + frame->addToJavaScriptWindowObject("test", child, QScriptEngine::QtOwnership); + QVariant v = frame->evaluateJavaScript("test"); + QCOMPARE(qvariant_cast<QObject*>(v), child); + delete parent; + v = frame->evaluateJavaScript("test"); + QCOMPARE(qvariant_cast<QObject*>(v), (QObject *)0); + } + { + QPointer<QObject> ptr = new QObject(); + QVERIFY(ptr != 0); + { + QWebPage page; + QWebFrame* frame = page.mainFrame(); + frame->addToJavaScriptWindowObject("test", ptr, QScriptEngine::AutoOwnership); + } + // no parent, so it should be like ScriptOwnership + QVERIFY(ptr == 0); + } + { + QObject* parent = new QObject(); + QPointer<QObject> child = new QObject(parent); + QVERIFY(child != 0); + { + QWebPage page; + QWebFrame* frame = page.mainFrame(); + frame->addToJavaScriptWindowObject("test", child, QScriptEngine::AutoOwnership); + } + // has parent, so it should be like QtOwnership + QVERIFY(child != 0); + delete parent; + } +} + QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 6f2ce3b..d85e880 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -879,6 +879,7 @@ void tst_QWebPage::textSelection() QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox")); // these actions must exist + QVERIFY(page->action(QWebPage::SelectAll) != 0); QVERIFY(page->action(QWebPage::SelectNextChar) != 0); QVERIFY(page->action(QWebPage::SelectPreviousChar) != 0); QVERIFY(page->action(QWebPage::SelectNextWord) != 0); @@ -906,10 +907,14 @@ void tst_QWebPage::textSelection() QCOMPARE(page->action(QWebPage::SelectStartOfDocument)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectEndOfDocument)->isEnabled(), false); + // ..but SelectAll is awalys enabled + QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); + // make it editable before navigating the cursor page->setContentEditable(true); // here the actions are enabled after contentEditable is true + QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), true); @@ -951,6 +956,8 @@ void tst_QWebPage::textEditing() QVERIFY(page->action(QWebPage::ToggleBold) != 0); QVERIFY(page->action(QWebPage::ToggleItalic) != 0); QVERIFY(page->action(QWebPage::ToggleUnderline) != 0); + QVERIFY(page->action(QWebPage::InsertParagraphSeparator) != 0); + QVERIFY(page->action(QWebPage::InsertLineSeparator) != 0); // right now they are disabled because contentEditable is false QCOMPARE(page->action(QWebPage::DeleteStartOfWord)->isEnabled(), false); @@ -961,6 +968,8 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::ToggleBold)->isEnabled(), false); QCOMPARE(page->action(QWebPage::ToggleItalic)->isEnabled(), false); QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), false); + QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), false); + QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), false); // make it editable before navigating the cursor page->setContentEditable(true); @@ -974,6 +983,8 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::ToggleBold)->isEnabled(), true); QCOMPARE(page->action(QWebPage::ToggleItalic)->isEnabled(), true); QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), true); delete page; } |