summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/Api
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2010-04-12 14:02:38 (GMT)
committerJocelyn Turcotte <jocelyn.turcotte@nokia.com>2010-04-12 14:02:38 (GMT)
commit50a8b8782ab3dab6446cca9a5528d6287df9d7d1 (patch)
tree1d53792f2fa08423bc8145cf5c2f7dc3d09f50cf /src/3rdparty/webkit/WebKit/qt/Api
parent0d288fa2112a00ecd8e160dd6ff70ba2e54153ee (diff)
downloadQt-50a8b8782ab3dab6446cca9a5528d6287df9d7d1.zip
Qt-50a8b8782ab3dab6446cca9a5528d6287df9d7d1.tar.gz
Qt-50a8b8782ab3dab6446cca9a5528d6287df9d7d1.tar.bz2
Update src/3rdparty/webkit from trunk.
Imported from 862268aeb7150d3795d05bfc05f661bb5c598a27 in branch qtwebkit-2.0 of repository git://gitorious.org/+qtwebkit-developers/webkit/qtwebkit.git Reviewed-by: TrustMe
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp55
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp16
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.h2
7 files changed, 59 insertions, 31 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
index 2878960..ad66750 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
@@ -1059,7 +1059,12 @@ QWebSettings* QGraphicsWebView::settings() const
*/
QAction *QGraphicsWebView::pageAction(QWebPage::WebAction action) const
{
+#ifdef QT_NO_ACTION
+ Q_UNUSED(action)
+ return 0;
+#else
return page()->action(action);
+#endif
}
/*!
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index 06c82ba..394ea17 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -277,10 +277,11 @@ void QWEBKIT_EXPORT qt_drt_evaluateScriptInIsolatedWorld(QWebFrame* qFrame, int
static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos)
{
- if (!frame || !frame->document() || !frame->eventHandler())
+ if (!frame || !frame->document() || !frame->view() || !frame->eventHandler())
return false;
- Node* node = frame->document()->elementFromPoint(pos.x(), pos.y());
+ QPoint contentsPos = frame->view()->windowToContents(pos);
+ Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y());
if (!node)
return false;
@@ -321,37 +322,33 @@ static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const
*/
void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint& pos)
{
- Frame* frame = QWebFramePrivate::core(qFrame);
+ if (!qFrame)
+ return;
- if (!frame || !frame->view())
+ if (webframe_scrollOverflow(QWebFramePrivate::core(qFrame), dx, dy, pos))
return;
-
- if (!webframe_scrollOverflow(frame, dx, dy, pos)) {
- do {
- bool scrolledHorizontal = false;
- bool scrolledVertical = false;
-
- IntSize scrollOffset = frame->view()->scrollOffset();
- IntPoint maxScrollOffset = frame->view()->maximumScrollPosition();
- if (dx > 0) // scroll right
- scrolledHorizontal = scrollOffset.width() < maxScrollOffset.x();
- else if (dx < 0) // scroll left
- scrolledHorizontal = scrollOffset.width() > 0;
+ bool scrollHorizontal = false;
+ bool scrollVertical = false;
+
+ do {
+ if (dx > 0) // scroll right
+ scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal);
+ else if (dx < 0) // scroll left
+ scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal);
- if (dy > 0) // scroll down
- scrolledVertical = scrollOffset.height() < maxScrollOffset.y();
+ if (dy > 0) // scroll down
+ scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical);
else if (dy < 0) //scroll up
- scrolledVertical = scrollOffset.height() > 0;
+ scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical);
- if (scrolledHorizontal || scrolledVertical) {
- frame->view()->scrollBy(IntSize(dx, dy));
- return;
- }
-
- frame = frame->tree()->parent();
- } while (frame && frame->view());
- }
+ if (scrollHorizontal || scrollVertical) {
+ qFrame->scroll(dx, dy);
+ return;
+ }
+
+ qFrame = qFrame->parentFrame();
+ } while (qFrame);
}
@@ -1048,13 +1045,13 @@ void QWebFrame::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPol
if (orientation == Qt::Horizontal) {
d->horizontalScrollBarPolicy = policy;
if (d->frame->view()) {
- d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy);
+ d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */);
d->frame->view()->updateCanHaveScrollbars();
}
} else {
d->verticalScrollBarPolicy = policy;
if (d->frame->view()) {
- d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy);
+ d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */);
d->frame->view()->updateCanHaveScrollbars();
}
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h
index 9e8979f..665bf1b 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h
@@ -22,6 +22,12 @@
#include <QtCore/qglobal.h>
+#define QTWEBKIT_VERSION_STR "2.0.0"
+// QTWEBKIT_VERSION is (major << 16) + (minor << 8) + patch. Similar to Qt.
+#define QTWEBKIT_VERSION 0x020000
+// Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt.
+#define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
+
#if defined(QT_MAKEDLL) /* create a Qt DLL library */
# if defined(BUILD_WEBKIT)
# define QWEBKIT_EXPORT Q_DECL_EXPORT
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 4c92c9f..007aeac 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -619,6 +619,7 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen
}
#endif // QT_NO_CONTEXTMENU
+#ifndef QT_NO_ACTION
void QWebPagePrivate::_q_webActionTriggered(bool checked)
{
QAction *a = qobject_cast<QAction *>(q->sender());
@@ -627,6 +628,7 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked)
QWebPage::WebAction action = static_cast<QWebPage::WebAction>(a->data().toInt());
q->triggerAction(action, checked);
}
+#endif // QT_NO_ACTION
void QWebPagePrivate::_q_cleanupLeakMessages()
{
@@ -638,6 +640,9 @@ void QWebPagePrivate::_q_cleanupLeakMessages()
void QWebPagePrivate::updateAction(QWebPage::WebAction action)
{
+#ifdef QT_NO_ACTION
+ Q_UNUSED(action)
+#else
QAction *a = actions[action];
if (!a || !mainFrame)
return;
@@ -697,6 +702,7 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action)
if (a->isCheckable())
a->setChecked(checked);
+#endif // QT_NO_ACTION
}
void QWebPagePrivate::updateNavigationActions()
@@ -1320,7 +1326,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
case QInputMethodEvent::TextFormat: {
QTextCharFormat textCharFormat = a.value.value<QTextFormat>().toCharFormat();
QColor qcolor = textCharFormat.underlineColor();
- underlines.append(CompositionUnderline(a.start, a.length, Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false));
+ underlines.append(CompositionUnderline(qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length)), Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false));
break;
}
case QInputMethodEvent::Cursor: {
@@ -2297,6 +2303,7 @@ QString QWebPage::selectedText() const
return d->page->focusController()->focusedOrMainFrame()->selectedText();
}
+#ifndef QT_NO_ACTION
/*!
Returns a QAction for the specified WebAction \a action.
@@ -2569,6 +2576,7 @@ QAction *QWebPage::action(WebAction action) const
d->updateAction(action);
return a;
}
+#endif // QT_NO_ACTION
/*!
\property QWebPage::modified
@@ -2838,6 +2846,7 @@ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event)
*/
void QWebPage::updatePositionDependentActions(const QPoint &pos)
{
+#ifndef QT_NO_ACTION
// First we disable all actions, but keep track of which ones were originally enabled.
QBitArray originallyEnabledWebActions(QWebPage::WebActionCount);
for (int i = ContextMenuItemTagNoAction; i < ContextMenuItemBaseApplicationTag; ++i) {
@@ -2847,6 +2856,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
a->setEnabled(false);
}
}
+#endif // QT_NO_ACTION
d->createMainFrame();
WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame();
@@ -2873,6 +2883,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
d->currentContextMenu = d->createContextMenu(&menu, menu.platformDescription(), &visitedWebActions);
#endif // QT_NO_CONTEXTMENU
+#ifndef QT_NO_ACTION
// Finally, we restore the original enablement for the actions that were not put into the menu.
originallyEnabledWebActions &= ~visitedWebActions; // Mask out visited actions (they're part of the menu)
for (int i = 0; i < QWebPage::WebActionCount; ++i) {
@@ -2881,6 +2892,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
a->setEnabled(true);
}
}
+#endif // QT_NO_ACTION
// This whole process ensures that any actions put into to the context menu has the right
// enablement, while also keeping the correct enablement for actions that were left out of
@@ -3377,7 +3389,7 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
// Language
QLocale locale;
- if (d->client)
+ if (d->client && d->client->ownerWidget())
locale = d->client->ownerWidget()->locale();
QString name = locale.name();
name[2] = QLatin1Char('-');
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
index 24d0ed9..1adde06 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
@@ -220,7 +220,9 @@ public:
QString selectedText() const;
+#ifndef QT_NO_ACTION
QAction *action(WebAction action) const;
+#endif
virtual void triggerAction(WebAction action, bool checked = false);
QSize viewportSize() const;
@@ -348,7 +350,9 @@ protected:
private:
Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int))
+#ifndef QT_NO_ACTION
Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked))
+#endif
Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages())
QWebPagePrivate *d;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
index 4387f4a..fcd1f4b 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
@@ -585,6 +585,7 @@ QString QWebView::selectedText() const
return QString();
}
+#ifndef QT_NO_ACTION
/*!
Returns a pointer to a QAction that encapsulates the specified web action \a action.
*/
@@ -592,6 +593,7 @@ QAction *QWebView::pageAction(QWebPage::WebAction action) const
{
return page()->action(action);
}
+#endif
/*!
Triggers the specified \a action. If it is a checkable action the specified
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
index f681fbc..1d651d5 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
@@ -75,7 +75,9 @@ public:
QString selectedText() const;
+#ifndef QT_NO_ACTION
QAction* pageAction(QWebPage::WebAction action) const;
+#endif
void triggerPageAction(QWebPage::WebAction action, bool checked = false);
bool isModified() const;