Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (195766 => 195767)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2016-01-28 19:30:55 UTC (rev 195767)
@@ -1,3 +1,19 @@
+2016-01-28 Babak Shafiei <[email protected]>
+
+ Merge r195607.
+
+ 2016-01-27 Dean Jackson <[email protected]>
+
+ [iOS] Documents without an explicit width should not get fast tapping
+ https://bugs.webkit.org/show_bug.cgi?id=153465
+
+ 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:
+
2016-01-27 Babak Shafiei <[email protected]>
Merge r195625.
Added: branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/thin-gradient.jpg ( => )
Added: branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt
===================================================================
--- branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt 2016-01-28 19:30:55 UTC (rev 195767)
@@ -0,0 +1,8 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Double tapping on the image should scroll.
+
+This test is best run in WebKitTestRunner. If you are running this test manually, verify that double tapping on the bottom of the viewport caused a scroll.
+
+
Added: branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html (0 => 195767)
--- branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html 2016-01-28 19:30:55 UTC (rev 195767)
@@ -0,0 +1,51 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<meta name="viewport" content="initial-scale=1.0">
+
+<head>
+ <script src=""
+ <script id="ui-script" type="text/plain">
+ (function() {
+ uiController.doubleTapAtPoint(15, 400, function() {
+ uiController.uiScriptComplete();
+ });
+ })();
+ </script>
+
+ <script>
+ var scriptCompleted = false;
+ var clickCount = 0;
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ function getUIScript() {
+ return document.getElementById("ui-script").text;
+ }
+
+ function runTest() {
+ window.addEventListener("scroll", scrolled, false);
+ if (testRunner.runUIScript)
+ testRunner.runUIScript(getUIScript());
+ }
+ function scrolled() {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ </script>
+
+ <style>
+ body {
+ margin: 0;
+ }
+ </style>
+</head>
+
+<body _onload_="runTest()">
+ <p>Double tapping on the image should scroll.</p>
+ <p>This test is best run in WebKitTestRunner. If you are running this test manually, verify that double tapping on the bottom of the viewport caused a scroll.</p>
+ <img src=""
+ <script src=""
+</body>
+
+</html>
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2016-01-28 19:30:55 UTC (rev 195767)
@@ -1,5 +1,39 @@
2016-01-28 Babak Shafiei <[email protected]>
+ Merge r195607.
+
+ 2016-01-27 Dean Jackson <[email protected]>
+
+ [iOS] Documents without an explicit width should not get fast tapping
+ https://bugs.webkit.org/show_bug.cgi?id=153465
+ <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==):
+
+
+2016-01-28 Babak Shafiei <[email protected]>
+
Follow-up fix for r195625.
2016-01-27 Babak Shafiei <[email protected]>
Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/ViewportArguments.cpp (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebCore/dom/ViewportArguments.cpp 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/ViewportArguments.cpp 2016-01-28 19:30:55 UTC (rev 195767)
@@ -306,24 +306,31 @@
return value;
}
-static float findSizeValue(const String& keyString, const String& valueString, Document* document)
+static float findSizeValue(const String& keyString, const String& valueString, Document* document, bool* valueWasExplicit = nullptr)
{
// 1) Non-negative number values are translated to px lengths.
// 2) Negative number values are translated to auto.
// 3) device-width and device-height are used as keywords.
// 4) Other keywords and unknown values translate to 0.0.
+ if (valueWasExplicit)
+ *valueWasExplicit = true;
+
if (equalIgnoringCase(valueString, "device-width"))
return ViewportArguments::ValueDeviceWidth;
+
if (equalIgnoringCase(valueString, "device-height"))
return ViewportArguments::ValueDeviceHeight;
- float value = numericPrefix(keyString, valueString, document);
+ float sizeValue = numericPrefix(keyString, valueString, document);
- if (value < 0)
+ if (sizeValue < 0) {
+ if (valueWasExplicit)
+ *valueWasExplicit = false;
return ViewportArguments::ValueAuto;
+ }
- return value;
+ return sizeValue;
}
static float findScaleValue(const String& keyString, const String& valueString, Document* document)
@@ -382,7 +389,7 @@
ViewportArguments* arguments = static_cast<ViewportArguments*>(data);
if (keyString == "width")
- arguments->width = findSizeValue(keyString, valueString, document);
+ arguments->width = findSizeValue(keyString, valueString, document, &arguments->widthWasExplicit);
else if (keyString == "height")
arguments->height = findSizeValue(keyString, valueString, document);
else if (keyString == "initial-scale")
Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/ViewportArguments.h (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebCore/dom/ViewportArguments.h 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/ViewportArguments.h 2016-01-28 19:30:55 UTC (rev 195767)
@@ -95,6 +95,7 @@
float userZoom { ValueAuto };
float orientation { ValueAuto };
float shrinkToFit { ValueAuto };
+ bool widthWasExplicit { false };
bool operator==(const ViewportArguments& other) const
{
@@ -111,7 +112,8 @@
&& maxZoom == other.maxZoom
&& userZoom == other.userZoom
&& orientation == other.orientation
- && shrinkToFit == other.shrinkToFit;
+ && shrinkToFit == other.shrinkToFit
+ && widthWasExplicit == other.widthWasExplicit;
}
bool operator!=(const ViewportArguments& other) const
Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2016-01-28 19:30:55 UTC (rev 195767)
@@ -1,5 +1,47 @@
2016-01-28 Babak Shafiei <[email protected]>
+ Merge r195607.
+
+ 2016-01-27 Dean Jackson <[email protected]>
+
+ [iOS] Documents without an explicit width should not get fast tapping
+ https://bugs.webkit.org/show_bug.cgi?id=153465
+ <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):
+
+2016-01-28 Babak Shafiei <[email protected]>
+
Follow-up fix for r194750.
2016-01-27 Babak Shafiei <[email protected]>
Modified: branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2016-01-28 19:30:55 UTC (rev 195767)
@@ -228,6 +228,12 @@
double viewportMetaTagWidth() const { return m_viewportMetaTagWidth; }
void setViewportMetaTagWidth(double width) { m_viewportMetaTagWidth = width; }
+ bool viewportMetaTagWidthWasExplicit() const { return m_viewportMetaTagWidthWasExplicit; }
+ void setViewportMetaTagWidthWasExplicit(bool widthWasExplicit) { m_viewportMetaTagWidthWasExplicit = widthWasExplicit; }
+
+ bool viewportMetaTagCameFromImageDocument() const { return m_viewportMetaTagCameFromImageDocument; }
+ void setViewportMetaTagCameFromImageDocument(bool cameFromImageDocument) { m_viewportMetaTagCameFromImageDocument = cameFromImageDocument; }
+
bool allowsUserScaling() const { return m_allowsUserScaling; }
void setAllowsUserScaling(bool allowsUserScaling) { m_allowsUserScaling = allowsUserScaling; }
@@ -265,6 +271,8 @@
uint64_t m_transactionID;
bool m_scaleWasSetByUIProcess;
bool m_allowsUserScaling;
+ bool m_viewportMetaTagWidthWasExplicit { false };
+ bool m_viewportMetaTagCameFromImageDocument { false };
};
} // namespace WebKit
Modified: branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2016-01-28 19:30:55 UTC (rev 195767)
@@ -533,6 +533,9 @@
encoder << m_scaleWasSetByUIProcess;
encoder << m_allowsUserScaling;
+ encoder << m_viewportMetaTagWidthWasExplicit;
+ encoder << m_viewportMetaTagCameFromImageDocument;
+
encoder << m_callbackIDs;
}
@@ -622,6 +625,12 @@
if (!decoder.decode(result.m_allowsUserScaling))
return false;
+ if (!decoder.decode(result.m_viewportMetaTagWidthWasExplicit))
+ return false;
+
+ if (!decoder.decode(result.m_viewportMetaTagCameFromImageDocument))
+ return false;
+
if (!decoder.decode(result.m_callbackIDs))
return false;
Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-01-28 19:30:55 UTC (rev 195767)
@@ -188,6 +188,8 @@
CGSize _maximumUnobscuredSizeOverride;
CGRect _inputViewBounds;
CGFloat _viewportMetaTagWidth;
+ BOOL _viewportMetaTagWidthWasExplicit;
+ BOOL _viewportMetaTagCameFromImageDocument;
CGFloat _initialScaleFactor;
BOOL _fastClickingIsDisabled;
@@ -1038,6 +1040,8 @@
[_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
_viewportMetaTagWidth = layerTreeTransaction.viewportMetaTagWidth();
+ _viewportMetaTagWidthWasExplicit = layerTreeTransaction.viewportMetaTagWidthWasExplicit();
+ _viewportMetaTagCameFromImageDocument = layerTreeTransaction.viewportMetaTagCameFromImageDocument();
_initialScaleFactor = layerTreeTransaction.initialScaleFactor();
if (![_contentView _mayDisableDoubleTapGesturesDuringSingleTap])
[_contentView _setDoubleTapGesturesEnabled:self._allowsDoubleTapGestures];
@@ -3138,6 +3142,10 @@
if (![_scrollView isZoomEnabled] || [_scrollView minimumZoomScale] >= [_scrollView maximumZoomScale])
return NO;
+ // If the viewport width was not explicit, we allow double tap gestures.
+ if (!_viewportMetaTagWidthWasExplicit || _viewportMetaTagCameFromImageDocument)
+ return YES;
+
// For scalable viewports, only disable double tap gestures if the viewport width is device width.
if (_viewportMetaTagWidth != WebCore::ViewportArguments::ValueDeviceWidth)
return YES;
Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (195766 => 195767)
--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-28 19:21:37 UTC (rev 195766)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-28 19:30:55 UTC (rev 195767)
@@ -2954,6 +2954,8 @@
layerTransaction.setMaximumScaleFactor(m_viewportConfiguration.maximumScale());
layerTransaction.setInitialScaleFactor(m_viewportConfiguration.initialScale());
layerTransaction.setViewportMetaTagWidth(m_viewportConfiguration.viewportArguments().width);
+ layerTransaction.setViewportMetaTagWidthWasExplicit(m_viewportConfiguration.viewportArguments().widthWasExplicit);
+ layerTransaction.setViewportMetaTagCameFromImageDocument(m_viewportConfiguration.viewportArguments().type == ViewportArguments::ImageDocument);
layerTransaction.setAllowsUserScaling(allowsUserScaling());
#endif
#if PLATFORM(MAC)