diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-02-01 13:52:17 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-02-01 13:52:50 (GMT) |
commit | b8102ec6d2f01a0aedf2ecd5bbf16d3a5f6c296e (patch) | |
tree | 0d3e167b5b52ecb075b95c3ffc1aca262a607f30 /src/3rdparty/webkit/WebKit/qt/Api | |
parent | b67bd25be08b54c3e6e49b2b9429e54ff58db268 (diff) | |
download | Qt-b8102ec6d2f01a0aedf2ecd5bbf16d3a5f6c296e.zip Qt-b8102ec6d2f01a0aedf2ecd5bbf16d3a5f6c296e.tar.gz Qt-b8102ec6d2f01a0aedf2ecd5bbf16d3a5f6c296e.tar.bz2 |
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( afc4c208fe296f5a1dd0e73f2bd1273bd22d9b24 )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2010-01-28 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Do not set the combobox font on Maemo5 and S60; use the
default instead.
* WebCoreSupport/QtFallbackWebPopup.cpp:
(WebCore::QtFallbackWebPopup::populate):
2010-01-28 Andreas Kling <andreas.kling@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Support kinetic scrolling on Maemo 5
https://bugs.webkit.org/show_bug.cgi?id=34267
Patch by Ralf Engels <ralf.engels@nokia.com> and
Robert Griebl <rgriebl@trolltech.com>
* Api/qwebview.cpp:
(QWebViewKineticScroller::QWebViewKineticScroller):
(QWebViewKineticScroller::eventFilter):
(QWebViewKineticScroller::currentFrame):
(QWebViewKineticScroller::scrollingFrameAt):
(QWebViewKineticScroller::attachToWidget):
(QWebViewKineticScroller::removeFromWidget):
(QWebViewKineticScroller::positionRange):
(QWebViewKineticScroller::position):
(QWebViewKineticScroller::viewportSize):
(QWebViewKineticScroller::setPosition):
(QWebView::QWebView):
2010-01-29 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann
Disable auto-uppercase and predictive text on Maemo5, just like the
build-in MicroB Browser.
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::setInputMethodState):
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 1d4b46f..79538ff 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -57,6 +57,106 @@ void QWebViewPrivate::_q_pageDestroyed() view->setPage(0); } +#ifdef Q_WS_MAEMO_5 +#include "qabstractkineticscroller.h" + +class QWebViewKineticScroller : public QAbstractKineticScroller { +public: + QWebViewKineticScroller() : QAbstractKineticScroller() {} + // remember the frame where the button was pressed + bool eventFilter(QObject* o, QEvent* ev) + { + switch (ev->type()) { + case QEvent::MouseButtonPress: { + QWebFrame* hitFrame = scrollingFrameAt(static_cast<QMouseEvent*>(ev)->pos()); + if (hitFrame) + m_frame = hitFrame; + break; + } + default: + break; + } + return QAbstractKineticScroller::eventFilter(o, ev); + } + +protected: + QWebFrame* currentFrame() const + { + if (!m_frame.isNull()) + return m_frame.data(); + + QWebView* view = static_cast<QWebView*>(widget()); + QWebFrame* frame = view->page()->mainFrame(); + return frame; + } + + // Returns the innermost frame at the given position that can scroll. + QWebFrame* scrollingFrameAt(const QPoint& pos) const + { + QWebView* view = static_cast<QWebView*>(widget()); + QWebFrame* mainFrame = view->page()->mainFrame(); + QWebFrame* hitFrame = mainFrame->hitTestContent(pos).frame(); + QSize range = hitFrame->contentsSize() - hitFrame->geometry().size(); + + while (hitFrame && range.width() <= 1 && range.height() <= 1) + hitFrame = hitFrame->parentFrame(); + + return hitFrame; + } + + void attachToWidget() + { + QWebView* view = static_cast<QWebView*>(widget()); + QWebFrame* mainFrame = view->page()->mainFrame(); + m_oldHorizontalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Horizontal); + m_oldVerticalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Vertical); + mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + view->installEventFilter(this); + } + + void removeFromWidget() + { + QWebView* view = static_cast<QWebView*>(widget()); + view->removeEventFilter(this); + QWebFrame* mainFrame = view->page()->mainFrame(); + mainFrame->setScrollBarPolicy(Qt::Vertical, m_oldVerticalScrollBarPolicy); + mainFrame->setScrollBarPolicy(Qt::Horizontal, m_oldHorizontalScrollBarPolicy); + } + + QRect positionRange() const + { + QRect r; + QWebFrame* frame = currentFrame(); + r.setSize(frame->contentsSize() - frame->geometry().size()); + return r; + } + + QPoint position() const + { + QWebFrame* frame = currentFrame(); + return frame->scrollPosition(); + } + + QSize viewportSize() const + { + return static_cast<QWebView*>(widget())->page()->viewportSize(); + } + + void setPosition(const QPoint& point, const QPoint& /* overShootDelta */) + { + QWebFrame* frame = currentFrame(); + frame->setScrollPosition(point); + } + + QPointer<QWebFrame> m_frame; + Qt::ScrollBarPolicy m_oldVerticalScrollBarPolicy; + Qt::ScrollBarPolicy m_oldHorizontalScrollBarPolicy; +}; + +#endif // Q_WS_MAEMO_5 + + /*! \class QWebView \since 4.4 @@ -153,6 +253,10 @@ QWebView::QWebView(QWidget *parent) setAttribute(Qt::WA_InputMethodEnabled); #endif +#if defined(Q_WS_MAEMO_5) + QAbstractKineticScroller* scroller = new QWebViewKineticScroller(); + scroller->setWidget(this); +#endif setAcceptDrops(true); setMouseTracking(true); |