- Revision
- 195607
- Author
- [email protected]
- Date
- 2016-01-26 12:09:27 -0800 (Tue, 26 Jan 2016)
Log 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:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (195606 => 195607)
--- trunk/LayoutTests/ChangeLog 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/LayoutTests/ChangeLog 2016-01-26 20:09:27 UTC (rev 195607)
@@ -1,3 +1,15 @@
+2016-01-26 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-26 Ryan Haddad <[email protected]>
Skipping fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html on ios-simulator
Added: trunk/LayoutTests/fast/events/ios/thin-gradient.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/fast/events/ios/thin-gradient.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt (0 => 195607)
--- trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt 2016-01-26 20:09:27 UTC (rev 195607)
@@ -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.
+
+
Property changes on: trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html (0 => 195607)
--- trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html (rev 0)
+++ trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html 2016-01-26 20:09:27 UTC (rev 195607)
@@ -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>
Property changes on: trunk/LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (195606 => 195607)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-01-26 20:09:27 UTC (rev 195607)
@@ -2839,6 +2839,7 @@
webkit.org/b/152134 fast/events/ios/single-tap-generates-click.html [ Pass Timeout ]
webkit.org/b/152134 fast/events/ios/unscalable-viewport-clicks-on-doubletap.html [ Pass Timeout ]
webkit.org/b/152134 fast/events/ios/viewport-device-width-at-initial-scale-fast-clicks.html [ Pass Timeout ]
+webkit.org/b/152134 fast/events/ios/viewport-no-width-value-allows-double-tap.html [ Pass Timeout ]
# Failing tests related to picture element
webkit.org/b/152141 fast/picture/image-picture-1x.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (195606 => 195607)
--- trunk/Source/WebCore/ChangeLog 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebCore/ChangeLog 2016-01-26 20:09:27 UTC (rev 195607)
@@ -1,3 +1,32 @@
+2016-01-26 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-25 Dave Hyatt <[email protected]>
Speculative fixes for crashing in viewportChangeAffectedPicture
Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (195606 => 195607)
--- trunk/Source/WebCore/dom/ViewportArguments.cpp 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp 2016-01-26 20:09:27 UTC (rev 195607)
@@ -307,24 +307,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 (equalLettersIgnoringASCIICase(valueString, "device-width"))
return ViewportArguments::ValueDeviceWidth;
+
if (equalLettersIgnoringASCIICase(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)
@@ -383,7 +390,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: trunk/Source/WebCore/dom/ViewportArguments.h (195606 => 195607)
--- trunk/Source/WebCore/dom/ViewportArguments.h 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebCore/dom/ViewportArguments.h 2016-01-26 20:09:27 UTC (rev 195607)
@@ -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: trunk/Source/WebKit2/ChangeLog (195606 => 195607)
--- trunk/Source/WebKit2/ChangeLog 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebKit2/ChangeLog 2016-01-26 20:09:27 UTC (rev 195607)
@@ -1,3 +1,41 @@
+2016-01-26 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-26 Tim Horton <[email protected]>
REGRESSION (r194557): Keyboard shortcuts stop working after the WKWebView is unparented and reparented
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (195606 => 195607)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2016-01-26 20:09:27 UTC (rev 195607)
@@ -230,6 +230,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; }
@@ -271,6 +277,8 @@
WebCore::LayoutMilestones m_newlyReachedLayoutMilestones { 0 };
bool m_scaleWasSetByUIProcess { false };
bool m_allowsUserScaling { false };
+ bool m_viewportMetaTagWidthWasExplicit { false };
+ bool m_viewportMetaTagCameFromImageDocument { false };
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (195606 => 195607)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2016-01-26 20:09:27 UTC (rev 195607)
@@ -528,6 +528,9 @@
encoder << m_scaleWasSetByUIProcess;
encoder << m_allowsUserScaling;
+ encoder << m_viewportMetaTagWidthWasExplicit;
+ encoder << m_viewportMetaTagCameFromImageDocument;
+
encoder << m_callbackIDs;
}
@@ -620,6 +623,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;
@@ -819,6 +828,8 @@
ts.dumpProperty("maximumScaleFactor", m_maximumScaleFactor);
ts.dumpProperty("initialScaleFactor", m_initialScaleFactor);
ts.dumpProperty("viewportMetaTagWidth", m_viewportMetaTagWidth);
+ ts.dumpProperty("viewportMetaTagWidthWasExplicit", m_viewportMetaTagWidthWasExplicit);
+ ts.dumpProperty("viewportMetaTagCameFromImageDocument", m_viewportMetaTagCameFromImageDocument);
ts.dumpProperty("renderTreeSize", m_renderTreeSize);
ts << "root-layer " << m_rootLayerID << ")";
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (195606 => 195607)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-01-26 20:09:27 UTC (rev 195607)
@@ -201,6 +201,8 @@
CGSize _maximumUnobscuredSizeOverride;
CGRect _inputViewBounds;
CGFloat _viewportMetaTagWidth;
+ BOOL _viewportMetaTagWidthWasExplicit;
+ BOOL _viewportMetaTagCameFromImageDocument;
CGFloat _initialScaleFactor;
BOOL _fastClickingIsDisabled;
@@ -1118,6 +1120,8 @@
[_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
_viewportMetaTagWidth = layerTreeTransaction.viewportMetaTagWidth();
+ _viewportMetaTagWidthWasExplicit = layerTreeTransaction.viewportMetaTagWidthWasExplicit();
+ _viewportMetaTagCameFromImageDocument = layerTreeTransaction.viewportMetaTagCameFromImageDocument();
_initialScaleFactor = layerTreeTransaction.initialScaleFactor();
if (![_contentView _mayDisableDoubleTapGesturesDuringSingleTap])
[_contentView _setDoubleTapGesturesEnabled:self._allowsDoubleTapGestures];
@@ -1595,6 +1599,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: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (195606 => 195607)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-26 20:07:07 UTC (rev 195606)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-26 20:09:27 UTC (rev 195607)
@@ -2982,6 +2982,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)