Changeset 141554 in webkit


Ignore:
Timestamp:
Feb 1, 2013 12:48:05 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Touch disambiguation blacklist is not being queried properly
https://bugs.webkit.org/show_bug.cgi?id=108222

Patch by Dan Alcantara <dfalcantara@chromium.org> on 2013-02-01
Reviewed by Adam Barth.

TEST=WebFrameTest::DisambiguationPopupBlacklist

Source/WebCore:

Fix the blacklist so that we check it for the right nodes.
Add a chromium test to check that the blacklist is being built and used
correctly. Also update the other DisambiguationPopup tests to
use the new page scale method.

  • page/TouchDisambiguation.cpp:

(WebCore::findGoodTouchTargets):

Source/WebKit/chromium:

Fix the blacklist so that we check it for the right nodes.
Add a test to check that the blacklist is being built and used
correctly. Also update the other DisambiguationPopup tests to
use the new page scale method.

  • tests/WebFrameTest.cpp:
  • tests/data/disambiguation_popup_blacklist.html: Added.
Location:
trunk/Source
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141553 r141554  
     12013-02-01  Dan Alcantara  <dfalcantara@chromium.org>
     2
     3        Touch disambiguation blacklist is not being queried properly
     4        https://bugs.webkit.org/show_bug.cgi?id=108222
     5
     6        Reviewed by Adam Barth.
     7
     8        TEST=WebFrameTest::DisambiguationPopupBlacklist
     9
     10        Fix the blacklist so that we check it for the right nodes.
     11        Add a chromium test to check that the blacklist is being built and used
     12        correctly.  Also update the other DisambiguationPopup tests to
     13        use the new page scale method.
     14
     15        * page/TouchDisambiguation.cpp:
     16        (WebCore::findGoodTouchTargets):
     17
    1182013-01-31  Kentaro Hara  <haraken@chromium.org>
    219
  • trunk/Source/WebCore/page/TouchDisambiguation.cpp

    r141062 r141554  
    107107    HashSet<Node*> blackList;
    108108    for (ListHashSet<RefPtr<Node> >::const_iterator it = hitResults.begin(); it != hitResults.end(); ++it) {
     109        // Ignore any Nodes that can't be clicked on.
    109110        RenderObject* renderer = it->get()->renderer();
    110         if (!renderer)
     111        if (!renderer || !it->get()->willRespondToMouseClickEvents())
    111112            continue;
     113
     114        // Blacklist all of the Node's containers.
    112115        for (RenderBlock* container = renderer->containingBlock(); container; container = container->containingBlock()) {
    113116            Node* containerNode = container->node();
     
    123126    for (ListHashSet<RefPtr<Node> >::const_iterator it = hitResults.begin(); it != hitResults.end(); ++it) {
    124127        for (Node* node = it->get(); node; node = node->parentNode()) {
    125             if (blackList.contains(it->get()))
     128            if (blackList.contains(node))
    126129                continue;
    127130            if (node->isDocumentNode() || node->hasTagName(HTMLNames::htmlTag) || node->hasTagName(HTMLNames::bodyTag))
  • trunk/Source/WebKit/chromium/ChangeLog

    r141550 r141554  
     12013-02-01  Dan Alcantara  <dfalcantara@chromium.org>
     2
     3        Touch disambiguation blacklist is not being queried properly
     4        https://bugs.webkit.org/show_bug.cgi?id=108222
     5
     6        Reviewed by Adam Barth.
     7
     8        TEST=WebFrameTest::DisambiguationPopupBlacklist
     9
     10        Fix the blacklist so that we check it for the right nodes.
     11        Add a test to check that the blacklist is being built and used
     12        correctly.  Also update the other DisambiguationPopup tests to
     13        use the new page scale method.
     14
     15        * tests/WebFrameTest.cpp:
     16        * tests/data/disambiguation_popup_blacklist.html: Added.
     17
    1182013-02-01  Eberhard Graether  <egraether@google.com>
    219
  • trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp

    r141538 r141554  
    18251825    // only becomes available after the load begins.
    18261826    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
     1827    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
     1828    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    18271829    webViewImpl->resize(WebSize(1000, 1000));
    18281830    webViewImpl->layout();
     
    18691871    // only becomes available after the load begins.
    18701872    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client));
     1873    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
     1874    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    18711875    webViewImpl->resize(WebSize(1000, 1000));
    18721876    webViewImpl->layout();
     
    18871891    // only becomes available after the load begins.
    18881892    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
     1893    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
     1894    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    18891895    webViewImpl->resize(WebSize(1000, 1000));
    18901896    webViewImpl->layout();
     
    19091915        EXPECT_FALSE(client.triggered());
    19101916    }
     1917}
     1918
     1919TEST_F(WebFrameTest, DisambiguationPopupBlacklist)
     1920{
     1921    const unsigned viewportWidth = 500;
     1922    const unsigned viewportHeight = 1000;
     1923    const unsigned divHeight = 100;
     1924    const std::string htmlFile = "disambiguation_popup_blacklist.html";
     1925    registerMockedHttpURLLoad(htmlFile);
     1926
     1927    DisambiguationPopupTestWebViewClient client;
     1928
     1929    // Make sure we initialize to minimum scale, even if the window size
     1930    // only becomes available after the load begins.
     1931    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
     1932    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
     1933    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
     1934    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
     1935    webViewImpl->layout();
     1936
     1937    // Click somewhere where the popup shouldn't appear.
     1938    client.resetTriggered();
     1939    webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, 0));
     1940    EXPECT_FALSE(client.triggered());
     1941
     1942    // Click directly in between two container divs with click handlers, with children that don't handle clicks.
     1943    client.resetTriggered();
     1944    webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight));
     1945    EXPECT_TRUE(client.triggered());
     1946
     1947    // The third div container should be blacklisted if you click on the link it contains.
     1948    client.resetTriggered();
     1949    webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25));
     1950    EXPECT_FALSE(client.triggered());
    19111951}
    19121952
Note: See TracChangeset for help on using the changeset viewer.