Changeset 138933 in webkit


Ignore:
Timestamp:
Jan 7, 2013 2:09:16 AM (11 years ago)
Author:
michael.bruning@digia.com
Message:

[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:
Location:
trunk/Source/WebKit/qt
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/ChangeLog

    r138427 r138933  
     12013-01-07  Michael Brüning  <michael.bruning@digia.com>
     2
     3        [Qt] Horizontal scrollbars events are offseted making them difficult to use
     4        https://bugs.webkit.org/show_bug.cgi?id=105014
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7
     8        Patch co-authored by Simon Hausmann.
     9
     10        Only copy the layout direction from the facade options if the
     11        current option is Qt::LayoutDirectionAuto in order to prevent
     12        misinterpretations as different layout direction when hit testing.
     13
     14        Tests added to tst_qwebview and tst_qgraphicswebview to verify
     15        that the view actually is scrolled in the right direction.
     16
     17        * WidgetSupport/QStyleFacadeImp.cpp:
     18        (WebKit::initGenericStyleOption):
     19        * tests/qgraphicswebview/resources/scrolltest_page.html: Added.
     20        * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
     21        (tst_QGraphicsWebView):
     22        (tst_QGraphicsWebView::horizontalScrollbarTest):
     23        * tests/qgraphicswebview/tst_qgraphicswebview.qrc:
     24        * tests/qwebview/resources/scrolltest_page.html: Added.
     25        * tests/qwebview/tst_qwebview.cpp:
     26        (tst_QWebView):
     27        (tst_QWebView::horizontalScrollbarTest):
     28        * tests/qwebview/tst_qwebview.qrc:
     29
    1302012-12-23  Alexey Proskuryakov  <ap@apple.com>
    231
  • trunk/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp

    r136685 r138933  
    7878    option->rect = facadeOption.rect;
    7979    option->state = convertToQStyleState(facadeOption.state);
    80     option->direction = facadeOption.direction;
     80    if (option->direction == Qt::LayoutDirectionAuto)
     81        option->direction = facadeOption.direction;
    8182    option->palette = facadeOption.palette;
    8283}
  • trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp

    r128158 r138933  
    4343    void widgetsRenderingThroughCache();
    4444    void windowResizeEvent();
     45    void horizontalScrollbarTest();
    4546
    4647#if !(defined(WTF_USE_QT_MOBILE_THEME) && WTF_USE_QT_MOBILE_THEME)
     
    681682}
    682683
     684void tst_QGraphicsWebView::horizontalScrollbarTest()
     685{
     686    QWebPage* page = new QWebPage;
     687    GraphicsWebView* webView = new GraphicsWebView;
     688    webView->setPage(page);
     689    webView->setGeometry(QRect(0, 0, 600, 600));
     690    QGraphicsView* view = new QGraphicsView;
     691    QGraphicsScene* scene = new QGraphicsScene(view);
     692    view->setScene(scene);
     693    scene->addItem(webView);
     694
     695    // Turn off scrolling on the containing QGraphicsView, let the
     696    // QGraphicsWebView handle the scrolling by itself.
     697    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     698    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     699    view->show();
     700    QCoreApplication::processEvents();
     701
     702    QUrl url("qrc:///resources/scrolltest_page.html");
     703    page->mainFrame()->load(url);
     704    page->mainFrame()->setFocus();
     705
     706    QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool))));
     707
     708    QVERIFY(webView->page()->mainFrame()->scrollPosition() == QPoint(0, 0));
     709
     710    // Note: The test below assumes that the layout direction is Qt::LeftToRight.
     711    webView->fireMouseClick(QPointF(550.0, 590.0));
     712    QVERIFY(page->mainFrame()->scrollPosition().x() > 0);
     713
     714    // Note: The test below assumes that the layout direction is Qt::LeftToRight.
     715    webView->fireMouseClick(QPointF(20.0, 590.0));
     716    QVERIFY(page->mainFrame()->scrollPosition() == QPoint(0, 0));
     717
     718    delete webView;
     719    delete view;
     720}
     721
    683722QTEST_MAIN(tst_QGraphicsWebView)
    684723
  • trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc

    r97945 r138933  
    55        <file>resources/pointing_up.html</file>
    66        <file>resources/greendiv.html</file>
     7        <file>resources/scrolltest_page.html</file>
    78    </qresource>
    89</RCC>
  • trunk/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp

    r136235 r138933  
    5353    void microFocusCoordinates();
    5454    void focusInputTypes();
     55    void horizontalScrollbarTest();
    5556
    5657    void crashTests();
     
    303304    QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled));
    304305}
     306
     307void tst_QWebView::horizontalScrollbarTest()
     308{
     309    QWebView webView;
     310    webView.resize(600, 600);
     311    webView.show();
     312    QTest::qWaitForWindowExposed(&webView);
     313
     314    QUrl url("qrc:///resources/scrolltest_page.html");
     315    QWebFrame* const mainFrame = webView.page()->mainFrame();
     316    mainFrame->load(url);
     317    mainFrame->setFocus();
     318
     319    QVERIFY(waitForSignal(&webView, SIGNAL(loadFinished(bool))));
     320
     321    QVERIFY(webView.page()->mainFrame()->scrollPosition() == QPoint(0, 0));
     322
     323    // Note: The test below assumes that the layout direction is Qt::LeftToRight.
     324    QTest::mouseClick(&webView, Qt::LeftButton, 0, QPoint(550, 595));
     325    QVERIFY(webView.page()->mainFrame()->scrollPosition().x() > 0);
     326
     327    // Note: The test below assumes that the layout direction is Qt::LeftToRight.
     328    QTest::mouseClick(&webView, Qt::LeftButton, 0, QPoint(20, 595));
     329    QVERIFY(webView.page()->mainFrame()->scrollPosition() == QPoint(0, 0));
     330}
     331
    305332
    306333#if !(defined(WTF_USE_QT_MOBILE_THEME) && WTF_USE_QT_MOBILE_THEME)
  • trunk/Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc

    r60958 r138933  
    44    <file>resources/frame_a.html</file>
    55    <file>resources/input_types.html</file>
     6    <file>resources/scrolltest_page.html</file>
    67</qresource>
    78</RCC>
Note: See TracChangeset for help on using the changeset viewer.