Changeset 141019 in webkit


Ignore:
Timestamp:
Jan 28, 2013 3:38:14 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[Chromium, Mobile] Do not show disambiguation pop up in mobile sites
https://bugs.webkit.org/show_bug.cgi?id=107607

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

Add a check before showing the disambiguation popup to prevent it from appearing
on mobile sites. Makes a similar test to the current disambiguation popup test
that expects the popup to never appear.

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::handleGestureEvent):
(WebKit):
(WebKit::WebViewImpl::isLikelyMobileSite):

  • src/WebViewImpl.h:

(WebViewImpl):

  • tests/WebFrameTest.cpp:
  • tests/data/disambiguation_popup_mobile_site.html: Added.
  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::handleGestureEvent):
(WebKit):
(WebKit::WebViewImpl::shouldDisableDesktopWorkarounds):

  • src/WebViewImpl.h:

(WebViewImpl):

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

Legend:

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

    r141018 r141019  
     12013-01-28  Dan Alcantara  <dfalcantara@chromium.org>
     2
     3        [Chromium, Mobile] Do not show disambiguation pop up in mobile sites
     4        https://bugs.webkit.org/show_bug.cgi?id=107607
     5
     6        Reviewed by Adam Barth.
     7
     8        Add a check before showing the disambiguation popup to prevent it from appearing
     9        on mobile sites.  Makes a similar test to the current disambiguation popup test
     10        that expects the popup to never appear.
     11
     12        * src/WebViewImpl.cpp:
     13        (WebKit::WebViewImpl::handleGestureEvent):
     14        (WebKit):
     15        (WebKit::WebViewImpl::isLikelyMobileSite):
     16        * src/WebViewImpl.h:
     17        (WebViewImpl):
     18        * tests/WebFrameTest.cpp:
     19        * tests/data/disambiguation_popup_mobile_site.html: Added.
     20
     21        * src/WebViewImpl.cpp:
     22        (WebKit::WebViewImpl::handleGestureEvent):
     23        (WebKit):
     24        (WebKit::WebViewImpl::shouldDisableDesktopWorkarounds):
     25        * src/WebViewImpl.h:
     26        (WebViewImpl):
     27        * tests/WebFrameTest.cpp:
     28        * tests/data/disambiguation_popup_mobile_site.html: Added.
     29
    1302013-01-28  Stephen Chenney  <schenney@chromium.org>
    231
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r141015 r141019  
    754754        ASSERT(!m_selectPopup);
    755755
    756         if (event.data.tap.width > 0) {
     756        // Don't trigger a disambiguation popup on sites designed for mobile devices.
     757        // Instead, assume that the page has been designed with big enough buttons and links.
     758        if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds()) {
    757759            IntRect boundingBox(event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, event.data.tap.width, event.data.tap.height);
    758760            Vector<IntRect> goodTargets;
     
    43664368#endif
    43674369
     4370bool WebViewImpl::shouldDisableDesktopWorkarounds()
     4371{
     4372    ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewportArguments();
     4373    return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments.userZoom
     4374        || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != ViewportArguments::ValueAuto);
     4375}
     4376
    43684377} // namespace WebKit
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r140808 r141019  
    602602#endif
    603603
     604    // Heuristic-based function for determining if we should disable workarounds
     605    // for viewing websites that are not optimized for mobile devices.
     606    bool shouldDisableDesktopWorkarounds();
     607
    604608#if ENABLE(GESTURE_EVENTS)
    605609    // Exposed for tests.
  • trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp

    r141015 r141019  
    19301930}
    19311931
     1932TEST_F(WebFrameTest, DisambiguationPopupMobileSite)
     1933{
     1934    registerMockedHttpURLLoad("disambiguation_popup_mobile_site.html");
     1935
     1936    DisambiguationPopupTestWebViewClient client;
     1937
     1938    // Make sure we initialize to minimum scale, even if the window size
     1939    // only becomes available after the load begins.
     1940    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup.html", true, 0, &client));
     1941    webViewImpl->resize(WebSize(1000, 1000));
     1942    webViewImpl->layout();
     1943
     1944    client.resetTriggered();
     1945    webViewImpl->handleInputEvent(fatTap(0, 0));
     1946    EXPECT_FALSE(client.triggered());
     1947
     1948    client.resetTriggered();
     1949    webViewImpl->handleInputEvent(fatTap(200, 115));
     1950    EXPECT_FALSE(client.triggered());
     1951
     1952    for (int i = 0; i <= 46; i++) {
     1953        client.resetTriggered();
     1954        webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));
     1955        EXPECT_FALSE(client.triggered());
     1956    }
     1957
     1958    for (int i = 0; i <= 46; i++) {
     1959        client.resetTriggered();
     1960        webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));
     1961        EXPECT_FALSE(client.triggered());
     1962    }
     1963}
     1964
    19321965class TestSubstituteDataWebFrameClient : public WebFrameClient {
    19331966public:
Note: See TracChangeset for help on using the changeset viewer.