Changeset 195607 in webkit


Ignore:
Timestamp:
Jan 26, 2016 12:09:27 PM (8 years ago)
Author:
dino@apple.com
Message:

[iOS] Documents without an explicit width should not get fast tapping
https://bugs.webkit.org/show_bug.cgi?id=153465
Source/WebCore:

<rdar://problem/23962529>

Reviewed by Simon Fraser (and Wenson Hseih).

As the title says, documents that do not set a viewport should
not get the fast click behaviour. There were complaints that we broke
double-tap to scroll in ImageDocuments where the image was narrow and long.

The fix is to just keep a flag that tells the UI process if the
width was explicit. However, it turns out that those ImageDocuments
are given an explicit device-width, which is fine for scaling but
really should behave as auto for fast tapping. So we also need
to tell the UIProcess if the viewport arguments came from an
ImageDocument.

Test: fast/events/ios/viewport-no-width-value-allows-double-tap.html

  • dom/ViewportArguments.cpp:

(WebCore::findSizeValue): Add a parameter that toggles a flag
if the size was explicitly set.
(WebCore::setViewportFeature): Remember if the width was
explicit.

  • dom/ViewportArguments.h: Add a widthWasExplicit flag.

(WebCore::ViewportArguments::operator==):

Source/WebKit2:

<rdar://problem/23962529>

Reviewed by Simon Fraser (and Wenson Hseih).

As the title says, documents that do not set a viewport should
not get the fast click behaviour. There were complaints that we broke
double-tap to scroll in ImageDocuments where the image was narrow and long.

The fix is to just keep a flag that tells the UI process if the
width was explicit. However, it turns out that those ImageDocuments
are given an explicit device-width, which is fine for scaling but
really should behave as auto for fast tapping. So we also need
to tell the UIProcess if the viewport arguments came from an
ImageDocument.

  • Shared/mac/RemoteLayerTreeTransaction.h: Add two new flags into

the transaction.
(WebKit::RemoteLayerTreeTransaction::viewportMetaTagWidthWasExplicit):
(WebKit::RemoteLayerTreeTransaction::setViewportMetaTagWidthWasExplicit):
(WebKit::RemoteLayerTreeTransaction::viewportMetaTagCameFromImageDocument):
(WebKit::RemoteLayerTreeTransaction::setViewportMetaTagCameFromImageDocument):

  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):
(WebKit::RemoteLayerTreeTransaction::description):

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _didCommitLayerTree:]): Notice whether or not the viewport
width was explicit.
(-[WKWebView _allowsDoubleTapGestures]): Return yes if the width
was not explicit, or if the viewport came from an ImageDocument.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::willCommitLayerTree):

LayoutTests:

Reviewed by Simon Fraser (and Wenson Hseih).

  • fast/events/ios/thin-gradient.jpg: Added.
  • fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt: Added.
  • fast/events/ios/viewport-no-width-value-allows-double-tap.html: Added.
  • platform/ios-simulator/TestExpectations:
Location:
trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r195599 r195607  
     12016-01-26  Dean Jackson  <dino@apple.com>
     2
     3        [iOS] Documents without an explicit width should not get fast tapping
     4        https://bugs.webkit.org/show_bug.cgi?id=153465
     5
     6        Reviewed by Simon Fraser (and Wenson Hseih).
     7
     8        * fast/events/ios/thin-gradient.jpg: Added.
     9        * fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt: Added.
     10        * fast/events/ios/viewport-no-width-value-allows-double-tap.html: Added.
     11        * platform/ios-simulator/TestExpectations:
     12
    1132016-01-26  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r195599 r195607  
    28402840webkit.org/b/152134 fast/events/ios/unscalable-viewport-clicks-on-doubletap.html [ Pass Timeout ]
    28412841webkit.org/b/152134 fast/events/ios/viewport-device-width-at-initial-scale-fast-clicks.html  [ Pass Timeout ]
     2842webkit.org/b/152134 fast/events/ios/viewport-no-width-value-allows-double-tap.html  [ Pass Timeout ]
    28422843
    28432844# Failing tests related to picture element
  • trunk/Source/WebCore/ChangeLog

    r195606 r195607  
     12016-01-26  Dean Jackson  <dino@apple.com>
     2
     3        [iOS] Documents without an explicit width should not get fast tapping
     4        https://bugs.webkit.org/show_bug.cgi?id=153465
     5        <rdar://problem/23962529>
     6
     7        Reviewed by Simon Fraser (and Wenson Hseih).
     8
     9        As the title says, documents that do not set a viewport should
     10        not get the fast click behaviour. There were complaints that we broke
     11        double-tap to scroll in ImageDocuments where the image was narrow and long.
     12
     13        The fix is to just keep a flag that tells the UI process if the
     14        width was explicit. However, it turns out that those ImageDocuments
     15        are given an explicit device-width, which is fine for scaling but
     16        really should behave as auto for fast tapping. So we also need
     17        to tell the UIProcess if the viewport arguments came from an
     18        ImageDocument.
     19
     20        Test: fast/events/ios/viewport-no-width-value-allows-double-tap.html
     21
     22        * dom/ViewportArguments.cpp:
     23        (WebCore::findSizeValue): Add a parameter that toggles a flag
     24        if the size was explicitly set.
     25        (WebCore::setViewportFeature): Remember if the width was
     26        explicit.
     27        * dom/ViewportArguments.h: Add a widthWasExplicit flag.
     28        (WebCore::ViewportArguments::operator==):
     29
    1302016-01-25  Dave Hyatt  <hyatt@apple.com>
    231
  • trunk/Source/WebCore/dom/ViewportArguments.cpp

    r195452 r195607  
    308308}
    309309
    310 static float findSizeValue(const String& keyString, const String& valueString, Document* document)
     310static float findSizeValue(const String& keyString, const String& valueString, Document* document, bool* valueWasExplicit = nullptr)
    311311{
    312312    // 1) Non-negative number values are translated to px lengths.
     
    315315    // 4) Other keywords and unknown values translate to 0.0.
    316316
     317    if (valueWasExplicit)
     318        *valueWasExplicit = true;
     319
    317320    if (equalLettersIgnoringASCIICase(valueString, "device-width"))
    318321        return ViewportArguments::ValueDeviceWidth;
     322
    319323    if (equalLettersIgnoringASCIICase(valueString, "device-height"))
    320324        return ViewportArguments::ValueDeviceHeight;
    321325
    322     float value = numericPrefix(keyString, valueString, document);
    323 
    324     if (value < 0)
     326    float sizeValue = numericPrefix(keyString, valueString, document);
     327
     328    if (sizeValue < 0) {
     329        if (valueWasExplicit)
     330            *valueWasExplicit = false;
    325331        return ViewportArguments::ValueAuto;
    326 
    327     return value;
     332    }
     333
     334    return sizeValue;
    328335}
    329336
     
    384391
    385392    if (keyString == "width")
    386         arguments->width = findSizeValue(keyString, valueString, document);
     393        arguments->width = findSizeValue(keyString, valueString, document, &arguments->widthWasExplicit);
    387394    else if (keyString == "height")
    388395        arguments->height = findSizeValue(keyString, valueString, document);
  • trunk/Source/WebCore/dom/ViewportArguments.h

    r191243 r195607  
    9696    float orientation { ValueAuto };
    9797    float shrinkToFit { ValueAuto };
     98    bool widthWasExplicit { false };
    9899
    99100    bool operator==(const ViewportArguments& other) const
     
    112113            && userZoom == other.userZoom
    113114            && orientation == other.orientation
    114             && shrinkToFit == other.shrinkToFit;
     115            && shrinkToFit == other.shrinkToFit
     116            && widthWasExplicit == other.widthWasExplicit;
    115117    }
    116118
  • trunk/Source/WebKit2/ChangeLog

    r195602 r195607  
     12016-01-26  Dean Jackson  <dino@apple.com>
     2
     3        [iOS] Documents without an explicit width should not get fast tapping
     4        https://bugs.webkit.org/show_bug.cgi?id=153465
     5        <rdar://problem/23962529>
     6
     7        Reviewed by Simon Fraser (and Wenson Hseih).
     8
     9        As the title says, documents that do not set a viewport should
     10        not get the fast click behaviour. There were complaints that we broke
     11        double-tap to scroll in ImageDocuments where the image was narrow and long.
     12
     13        The fix is to just keep a flag that tells the UI process if the
     14        width was explicit. However, it turns out that those ImageDocuments
     15        are given an explicit device-width, which is fine for scaling but
     16        really should behave as auto for fast tapping. So we also need
     17        to tell the UIProcess if the viewport arguments came from an
     18        ImageDocument.
     19
     20        * Shared/mac/RemoteLayerTreeTransaction.h: Add two new flags into
     21        the transaction.
     22        (WebKit::RemoteLayerTreeTransaction::viewportMetaTagWidthWasExplicit):
     23        (WebKit::RemoteLayerTreeTransaction::setViewportMetaTagWidthWasExplicit):
     24        (WebKit::RemoteLayerTreeTransaction::viewportMetaTagCameFromImageDocument):
     25        (WebKit::RemoteLayerTreeTransaction::setViewportMetaTagCameFromImageDocument):
     26        * Shared/mac/RemoteLayerTreeTransaction.mm:
     27        (WebKit::RemoteLayerTreeTransaction::encode):
     28        (WebKit::RemoteLayerTreeTransaction::decode):
     29        (WebKit::RemoteLayerTreeTransaction::description):
     30
     31        * UIProcess/API/Cocoa/WKWebView.mm:
     32        (-[WKWebView _didCommitLayerTree:]): Notice whether or not the viewport
     33        width was explicit.
     34        (-[WKWebView _allowsDoubleTapGestures]): Return yes if the width
     35        was not explicit, or if the viewport came from an ImageDocument.
     36        * WebProcess/WebPage/WebPage.cpp:
     37        (WebKit::WebPage::willCommitLayerTree):
     38
    1392016-01-26  Tim Horton  <timothy_horton@apple.com>
    240
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r194496 r195607  
    231231    void setViewportMetaTagWidth(double width) { m_viewportMetaTagWidth = width; }
    232232
     233    bool viewportMetaTagWidthWasExplicit() const { return m_viewportMetaTagWidthWasExplicit; }
     234    void setViewportMetaTagWidthWasExplicit(bool widthWasExplicit) { m_viewportMetaTagWidthWasExplicit = widthWasExplicit; }
     235
     236    bool viewportMetaTagCameFromImageDocument() const { return m_viewportMetaTagCameFromImageDocument; }
     237    void setViewportMetaTagCameFromImageDocument(bool cameFromImageDocument) { m_viewportMetaTagCameFromImageDocument = cameFromImageDocument; }
     238
    233239    bool allowsUserScaling() const { return m_allowsUserScaling; }
    234240    void setAllowsUserScaling(bool allowsUserScaling) { m_allowsUserScaling = allowsUserScaling; }
     
    272278    bool m_scaleWasSetByUIProcess { false };
    273279    bool m_allowsUserScaling { false };
     280    bool m_viewportMetaTagWidthWasExplicit { false };
     281    bool m_viewportMetaTagCameFromImageDocument { false };
    274282};
    275283
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r194496 r195607  
    529529    encoder << m_allowsUserScaling;
    530530
     531    encoder << m_viewportMetaTagWidthWasExplicit;
     532    encoder << m_viewportMetaTagCameFromImageDocument;
     533
    531534    encoder << m_callbackIDs;
    532535}
     
    619622
    620623    if (!decoder.decode(result.m_allowsUserScaling))
     624        return false;
     625
     626    if (!decoder.decode(result.m_viewportMetaTagWidthWasExplicit))
     627        return false;
     628
     629    if (!decoder.decode(result.m_viewportMetaTagCameFromImageDocument))
    621630        return false;
    622631
     
    820829    ts.dumpProperty("initialScaleFactor", m_initialScaleFactor);
    821830    ts.dumpProperty("viewportMetaTagWidth", m_viewportMetaTagWidth);
     831    ts.dumpProperty("viewportMetaTagWidthWasExplicit", m_viewportMetaTagWidthWasExplicit);
     832    ts.dumpProperty("viewportMetaTagCameFromImageDocument", m_viewportMetaTagCameFromImageDocument);
    822833    ts.dumpProperty("renderTreeSize", m_renderTreeSize);
    823834
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r195494 r195607  
    202202    CGRect _inputViewBounds;
    203203    CGFloat _viewportMetaTagWidth;
     204    BOOL _viewportMetaTagWidthWasExplicit;
     205    BOOL _viewportMetaTagCameFromImageDocument;
    204206    CGFloat _initialScaleFactor;
    205207    BOOL _fastClickingIsDisabled;
     
    11191121
    11201122    _viewportMetaTagWidth = layerTreeTransaction.viewportMetaTagWidth();
     1123    _viewportMetaTagWidthWasExplicit = layerTreeTransaction.viewportMetaTagWidthWasExplicit();
     1124    _viewportMetaTagCameFromImageDocument = layerTreeTransaction.viewportMetaTagCameFromImageDocument();
    11211125    _initialScaleFactor = layerTreeTransaction.initialScaleFactor();
    11221126    if (![_contentView _mayDisableDoubleTapGesturesDuringSingleTap])
     
    15951599    if (![_scrollView isZoomEnabled] || [_scrollView minimumZoomScale] >= [_scrollView maximumZoomScale])
    15961600        return NO;
     1601
     1602    // If the viewport width was not explicit, we allow double tap gestures.
     1603    if (!_viewportMetaTagWidthWasExplicit || _viewportMetaTagCameFromImageDocument)
     1604        return YES;
    15971605
    15981606    // For scalable viewports, only disable double tap gestures if the viewport width is device width.
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r195317 r195607  
    29832983    layerTransaction.setInitialScaleFactor(m_viewportConfiguration.initialScale());
    29842984    layerTransaction.setViewportMetaTagWidth(m_viewportConfiguration.viewportArguments().width);
     2985    layerTransaction.setViewportMetaTagWidthWasExplicit(m_viewportConfiguration.viewportArguments().widthWasExplicit);
     2986    layerTransaction.setViewportMetaTagCameFromImageDocument(m_viewportConfiguration.viewportArguments().type == ViewportArguments::ImageDocument);
    29852987    layerTransaction.setAllowsUserScaling(allowsUserScaling());
    29862988#endif
Note: See TracChangeset for help on using the changeset viewer.