diff options
Diffstat (limited to 'WebKit/qt/Api')
-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 |
10 files changed, 236 insertions, 105 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: |