summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brüning <michael.bruning@digia.com>2013-01-28 10:35:42 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-28 15:52:43 +0100
commitfb05427cdb248eaffeac8b045a90b004f896f605 (patch)
treedcc4259e5e203f4fc7198345d7fdb9c20308d80f
parentd65f551ec3dd28be38d75a893f74919dfa27071e (diff)
downloadqtwebkit-fb05427cdb248eaffeac8b045a90b004f896f605.tar.gz
[Qt] Horizontal scrollbars events are offseted making them difficult to use
https://bugs.webkit.org/show_bug.cgi?id=105014 Reviewed by Allan Sandfeld Jensen. Patch co-authored by Simon Hausmann. Only copy the layout direction from the facade options if the current option is Qt::LayoutDirectionAuto in order to prevent misinterpretations as different layout direction when hit testing. Tests added to tst_qwebview and tst_qgraphicswebview to verify that the view actually is scrolled in the right direction. * WidgetSupport/QStyleFacadeImp.cpp: (WebKit::initGenericStyleOption): * tests/qgraphicswebview/resources/scrolltest_page.html: Added. * tests/qgraphicswebview/tst_qgraphicswebview.cpp: (tst_QGraphicsWebView): (tst_QGraphicsWebView::horizontalScrollbarTest): * tests/qgraphicswebview/tst_qgraphicswebview.qrc: * tests/qwebview/resources/scrolltest_page.html: Added. * tests/qwebview/tst_qwebview.cpp: (tst_QWebView): (tst_QWebView::horizontalScrollbarTest): * tests/qwebview/tst_qwebview.qrc: [Qt] Apply correct patch for the scrolling issue from bug 105014 https://bugs.webkit.org/show_bug.cgi?id=106219 Correct the if condition when overwriting the layout direction option with the values from the facade options to only overwrite if the facade direction is not equal to LayoutDirectionAuto. Reviewed by Allan Sandfeld Jensen. * WidgetSupport/QStyleFacadeImp.cpp: (WebKit::initGenericStyleOption): Change-Id: I8a8c8d483beabf304cb2cdf63276cba61600138d Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--Source/WebKit/qt/ChangeLog43
-rw-r--r--Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp3
-rw-r--r--Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp39
-rw-r--r--Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc1
-rw-r--r--Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp27
-rw-r--r--Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc1
6 files changed, 113 insertions, 1 deletions
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index 94441de35..77eea541b 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,46 @@
+2013-01-07 Michael Brüning <michael.bruning@digia.com>
+
+ [Qt] Apply correct patch for the scrolling issue from bug 105014
+ https://bugs.webkit.org/show_bug.cgi?id=106219
+
+ Correct the if condition when overwriting the layout direction option
+ with the values from the facade options to only overwrite if the facade
+ direction is not equal to LayoutDirectionAuto.
+
+ Reviewed by Allan Sandfeld Jensen.
+
+ * WidgetSupport/QStyleFacadeImp.cpp:
+ (WebKit::initGenericStyleOption):
+
+2013-01-07 Michael Brüning <michael.bruning@digia.com>
+
+ [Qt] Horizontal scrollbars events are offseted making them difficult to use
+ https://bugs.webkit.org/show_bug.cgi?id=105014
+
+ Reviewed by Allan Sandfeld Jensen.
+
+ Patch co-authored by Simon Hausmann.
+
+ Only copy the layout direction from the facade options if the
+ current option is Qt::LayoutDirectionAuto in order to prevent
+ misinterpretations as different layout direction when hit testing.
+
+ Tests added to tst_qwebview and tst_qgraphicswebview to verify
+ that the view actually is scrolled in the right direction.
+
+ * WidgetSupport/QStyleFacadeImp.cpp:
+ (WebKit::initGenericStyleOption):
+ * tests/qgraphicswebview/resources/scrolltest_page.html: Added.
+ * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
+ (tst_QGraphicsWebView):
+ (tst_QGraphicsWebView::horizontalScrollbarTest):
+ * tests/qgraphicswebview/tst_qgraphicswebview.qrc:
+ * tests/qwebview/resources/scrolltest_page.html: Added.
+ * tests/qwebview/tst_qwebview.cpp:
+ (tst_QWebView):
+ (tst_QWebView::horizontalScrollbarTest):
+ * tests/qwebview/tst_qwebview.qrc:
+
2012-12-06 Pierre Rossi <pierre.rossi@gmail.com>
[Qt] QWebView uses the mobile style and doesn't follow Qt's style
diff --git a/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp
index 7e2b8cab7..bc8840755 100644
--- a/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp
+++ b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp
@@ -77,7 +77,8 @@ static void initGenericStyleOption(QStyleOption* option, QWidget* widget, const
option->rect = facadeOption.rect;
option->state = convertToQStyleState(facadeOption.state);
- option->direction = facadeOption.direction;
+ if (facadeOption.direction != Qt::LayoutDirectionAuto)
+ option->direction = facadeOption.direction;
option->palette = facadeOption.palette;
}
diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index 9ae960b9c..af70e59b2 100644
--- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
+++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -42,6 +42,7 @@ private Q_SLOTS:
void crashOnSetScaleBeforeSetUrl();
void widgetsRenderingThroughCache();
void windowResizeEvent();
+ void horizontalScrollbarTest();
#if !(defined(WTF_USE_QT_MOBILE_THEME) && WTF_USE_QT_MOBILE_THEME)
void setPalette_data();
@@ -680,6 +681,44 @@ void tst_QGraphicsWebView::windowResizeEvent()
QCOMPARE(resizeSpy.size(), QSize(60, 60));
}
+void tst_QGraphicsWebView::horizontalScrollbarTest()
+{
+ QWebPage* page = new QWebPage;
+ GraphicsWebView* webView = new GraphicsWebView;
+ webView->setPage(page);
+ webView->setGeometry(QRect(0, 0, 600, 600));
+ QGraphicsView* view = new QGraphicsView;
+ QGraphicsScene* scene = new QGraphicsScene(view);
+ view->setScene(scene);
+ scene->addItem(webView);
+
+ // Turn off scrolling on the containing QGraphicsView, let the
+ // QGraphicsWebView handle the scrolling by itself.
+ view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view->show();
+ QCoreApplication::processEvents();
+
+ QUrl url("qrc:///resources/scrolltest_page.html");
+ page->mainFrame()->load(url);
+ page->mainFrame()->setFocus();
+
+ QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool))));
+
+ QVERIFY(webView->page()->mainFrame()->scrollPosition() == QPoint(0, 0));
+
+ // Note: The test below assumes that the layout direction is Qt::LeftToRight.
+ webView->fireMouseClick(QPointF(550.0, 590.0));
+ QVERIFY(page->mainFrame()->scrollPosition().x() > 0);
+
+ // Note: The test below assumes that the layout direction is Qt::LeftToRight.
+ webView->fireMouseClick(QPointF(20.0, 590.0));
+ QVERIFY(page->mainFrame()->scrollPosition() == QPoint(0, 0));
+
+ delete webView;
+ delete view;
+}
+
QTEST_MAIN(tst_QGraphicsWebView)
#include "tst_qgraphicswebview.moc"
diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc
index 97726ba73..ff06bd8c4 100644
--- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc
+++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc
@@ -4,5 +4,6 @@
<file>resources/pointing_right.html</file>
<file>resources/pointing_up.html</file>
<file>resources/greendiv.html</file>
+ <file>resources/scrolltest_page.html</file>
</qresource>
</RCC>
diff --git a/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index 6ff2d1ff5..a990ad0f2 100644
--- a/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -52,6 +52,7 @@ private Q_SLOTS:
void reusePage();
void microFocusCoordinates();
void focusInputTypes();
+ void horizontalScrollbarTest();
void crashTests();
#if !(defined(WTF_USE_QT_MOBILE_THEME) && WTF_USE_QT_MOBILE_THEME)
@@ -303,6 +304,32 @@ void tst_QWebView::focusInputTypes()
QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
}
+void tst_QWebView::horizontalScrollbarTest()
+{
+ QWebView webView;
+ webView.resize(600, 600);
+ webView.show();
+ QTest::qWaitForWindowExposed(&webView);
+
+ QUrl url("qrc:///resources/scrolltest_page.html");
+ QWebFrame* const mainFrame = webView.page()->mainFrame();
+ mainFrame->load(url);
+ mainFrame->setFocus();
+
+ QVERIFY(waitForSignal(&webView, SIGNAL(loadFinished(bool))));
+
+ QVERIFY(webView.page()->mainFrame()->scrollPosition() == QPoint(0, 0));
+
+ // Note: The test below assumes that the layout direction is Qt::LeftToRight.
+ QTest::mouseClick(&webView, Qt::LeftButton, 0, QPoint(550, 595));
+ QVERIFY(webView.page()->mainFrame()->scrollPosition().x() > 0);
+
+ // Note: The test below assumes that the layout direction is Qt::LeftToRight.
+ QTest::mouseClick(&webView, Qt::LeftButton, 0, QPoint(20, 595));
+ QVERIFY(webView.page()->mainFrame()->scrollPosition() == QPoint(0, 0));
+}
+
+
#if !(defined(WTF_USE_QT_MOBILE_THEME) && WTF_USE_QT_MOBILE_THEME)
void tst_QWebView::setPalette_data()
{
diff --git a/Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc
index 8710a9a17..e4b9ad776 100644
--- a/Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc
+++ b/Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc
@@ -3,6 +3,7 @@
<file>resources/index.html</file>
<file>resources/frame_a.html</file>
<file>resources/input_types.html</file>
+ <file>resources/scrolltest_page.html</file>
</qresource>
</RCC>